| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a4defb2 commit eda331e
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ class Attribute implements ValueAccessInterface | |||
| 10 | 10 | /** | |
| 11 | 11 | * @var array|Value[]|ValueInterface[] | |
| 12 | 12 | */ | |
| 13 | - private $values = []; | ||
| 13 | + private $values = array(); | ||
| 14 | 14 | ||
| 15 | 15 | /** | |
| 16 | 16 | * @var string | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ class Entity implements ValueAccessInterface | |||
| 10 | 10 | /** | |
| 11 | 11 | * @var array|Value[]|ValueInterface[] | |
| 12 | 12 | */ | |
| 13 | - private $values = []; | ||
| 13 | + private $values = array(); | ||
| 14 | 14 | ||
| 15 | 15 | /** | |
| 16 | 16 | * @var string | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,9 +36,15 @@ public function testAddValue() | |||
| 36 | 36 | $attribute = new Attribute(); | |
| 37 | 37 | $attribute->setName('Color'); | |
| 38 | 38 | ||
| 39 | - $values[] = (new Value($attribute))->setName('Silver'); | ||
| 40 | - $values[] = (new Value($attribute))->setName('Gold'); | ||
| 41 | - $values[] = (new Value($attribute))->setName('Space Grey'); | ||
| 39 | + $colorSilver = new Value($attribute); | ||
| 40 | + $colorSilver->setName('Silver'); | ||
| 41 | + $values[] = $colorSilver; | ||
| 42 | + $colorGold = new Value($attribute); | ||
| 43 | + $colorGold->setName('Gold'); | ||
| 44 | + $values[] = $colorGold; | ||
| 45 | + $colorSpaceGrey = new Value($attribute); | ||
| 46 | + $colorSpaceGrey->setName('Space Grey'); | ||
| 47 | + $values[] = $colorSpaceGrey; | ||
| 42 | 48 | ||
| 43 | 49 | $this->assertEquals($values, $attribute->getValues()); | |
| 44 | 50 | } | |
@@ -48,14 +54,20 @@ public function testAddValue() | |||
| 48 | 54 | */ | |
| 49 | 55 | public function testRemoveValue() | |
| 50 | 56 | { | |
| 51 | - $values = []; | ||
| 57 | + $values = array(); | ||
| 52 | 58 | ||
| 53 | 59 | $attribute = new Attribute(); | |
| 54 | 60 | $attribute->setName('Color'); | |
| 55 | 61 | ||
| 56 | - $values[] = (new Value($attribute))->setName('Silver'); | ||
| 57 | - $values[] = (new Value($attribute))->setName('Gold'); | ||
| 58 | - $values[] = (new Value($attribute))->setName('Space Grey'); | ||
| 62 | + $colorSilver = new Value($attribute); | ||
| 63 | + $colorSilver->setName('Silver'); | ||
| 64 | + $values[] = $colorSilver; | ||
| 65 | + $colorGold = new Value($attribute); | ||
| 66 | + $colorGold->setName('Gold'); | ||
| 67 | + $values[] = $colorGold; | ||
| 68 | + $colorSpaceGrey = new Value($attribute); | ||
| 69 | + $colorSpaceGrey->setName('Space Grey'); | ||
| 70 | + $values[] = $colorSpaceGrey; | ||
| 59 | 71 | ||
| 60 | 72 | $randomIndex = array_rand($values); | |
| 61 | 73 | $attribute->removeValue($values[$randomIndex]); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,62 +71,75 @@ public function testRemoveValue($name, array $values) | |||
| 71 | 71 | public function valueProvider() | |
| 72 | 72 | { | |
| 73 | 73 | // color attribute | |
| 74 | - $color = (new Attribute())->setName('Color'); | ||
| 74 | + $color = new Attribute(); | ||
| 75 | + $color->setName('Color'); | ||
| 75 | 76 | // color values | |
| 76 | - $colorSilver = (new Value($color))->setName('Silver'); | ||
| 77 | - $colorGold = (new Value($color))->setName('Gold'); | ||
| 78 | - $colorSpaceGrey = (new Value($color))->setName('Space Grey'); | ||
| 77 | + $colorSilver = new Value($color); | ||
| 78 | + $colorSilver->setName('Silver'); | ||
| 79 | + $colorGold = new Value($color); | ||
| 80 | + $colorGold->setName('Gold'); | ||
| 81 | + $colorSpaceGrey = new Value($color); | ||
| 82 | + $colorSpaceGrey->setName('Space Grey'); | ||
| 79 | 83 | ||
| 80 | 84 | // memory attribute | |
| 81 | - $memory = (new Attribute())->setName('Memory'); | ||
| 85 | + $memory = new Attribute(); | ||
| 86 | + $memory->setName('Memory'); | ||
| 82 | 87 | // memory values | |
| 83 | - $memory4Gb = (new Value($memory))->setName('4GB'); | ||
| 84 | - $memory8Gb = (new Value($memory))->setName('8GB'); | ||
| 85 | - $memory16Gb = (new Value($memory))->setName('16GB'); | ||
| 88 | + $memory4Gb = new Value($memory); | ||
| 89 | + $memory4Gb->setName('4GB'); | ||
| 90 | + $memory8Gb = new Value($memory); | ||
| 91 | + $memory8Gb->setName('8GB'); | ||
| 92 | + $memory16Gb = new Value($memory); | ||
| 93 | + $memory16Gb->setName('16GB'); | ||
| 86 | 94 | ||
| 87 | 95 | // storage attribute | |
| 88 | - $storage = (new Attribute())->setName('Storage'); | ||
| 96 | + $storage = new Attribute(); | ||
| 97 | + $storage->setName('Storage'); | ||
| 89 | 98 | // storage values | |
| 90 | - $storage128Gb = (new Value($storage))->setName('128GB'); | ||
| 91 | - $storage256Gb = (new Value($storage))->setName('256GB'); | ||
| 92 | - $storage512Gb = (new Value($storage))->setName('512GB'); | ||
| 93 | - $storage1Tb = (new Value($storage))->setName('1TB'); | ||
| 99 | + $storage128Gb = new Value($storage); | ||
| 100 | + $storage128Gb->setName('128GB'); | ||
| 101 | + $storage256Gb = new Value($storage); | ||
| 102 | + $storage256Gb->setName('256GB'); | ||
| 103 | + $storage512Gb = new Value($storage); | ||
| 104 | + $storage512Gb->setName('512GB'); | ||
| 105 | + $storage1Tb = new Value($storage); | ||
| 106 | + $storage1Tb->setName('1TB'); | ||
| 94 | 107 | ||
| 95 | - return [ | ||
| 96 | - [ | ||
| 108 | + return array( | ||
| 109 | + array( | ||
| 97 | 110 | 'MacBook', | |
| 98 | - [ | ||
| 111 | + array( | ||
| 99 | 112 | $colorSilver, | |
| 100 | 113 | $colorGold, | |
| 101 | 114 | $colorSpaceGrey, | |
| 102 | 115 | $memory8Gb, | |
| 103 | 116 | $storage256Gb, | |
| 104 | 117 | $storage512Gb, | |
| 105 | - ], | ||
| 106 | - ], | ||
| 107 | - [ | ||
| 118 | + ), | ||
| 119 | + ), | ||
| 120 | + array( | ||
| 108 | 121 | 'MacBook Air', | |
| 109 | - [ | ||
| 122 | + array( | ||
| 110 | 123 | $colorSilver, | |
| 111 | 124 | $memory4Gb, | |
| 112 | 125 | $memory8Gb, | |
| 113 | 126 | $storage128Gb, | |
| 114 | 127 | $storage256Gb, | |
| 115 | 128 | $storage512Gb, | |
| 116 | - ], | ||
| 117 | - ], | ||
| 118 | - [ | ||
| 129 | + ), | ||
| 130 | + ), | ||
| 131 | + array( | ||
| 119 | 132 | 'MacBook Pro', | |
| 120 | - [ | ||
| 133 | + array( | ||
| 121 | 134 | $colorSilver, | |
| 122 | 135 | $memory8Gb, | |
| 123 | 136 | $memory16Gb, | |
| 124 | 137 | $storage128Gb, | |
| 125 | 138 | $storage256Gb, | |
| 126 | 139 | $storage512Gb, | |
| 127 | 140 | $storage1Tb, | |
| 128 | - ], | ||
| 129 | - ], | ||
| 130 | - ]; | ||
| 141 | + ), | ||
| 142 | + ), | ||
| 143 | + ); | ||
| 131 | 144 | } | |
| 132 | 145 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments