@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | public function testFirstReturnsFirstItemInCollection() |
21 | 21 | { |
22 | - $coll = Factory::create($this->fixtures['names']); |
|
22 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
23 | 23 | $this->assertEquals('Chelsea', $coll->first()); |
24 | 24 | } |
25 | 25 | } |
@@ -19,14 +19,14 @@ |
||
19 | 19 | { |
20 | 20 | public function testSetWillSetValueOnCollectionInPlace() |
21 | 21 | { |
22 | - $exp = $this->fixtures['assoc']; |
|
22 | + $exp = $this->fixtures[ 'assoc' ]; |
|
23 | 23 | $coll = Factory::create($exp); |
24 | 24 | $this->assertEquals($exp, $coll->toArray()); |
25 | 25 | $this->assertSame($coll, $coll->set('1st', 'worst'), 'Collection::set() should return the collection itself.'); |
26 | - $exp['1st'] = 'worst'; |
|
26 | + $exp[ '1st' ] = 'worst'; |
|
27 | 27 | $this->assertEquals($exp, $coll->toArray()); |
28 | 28 | $coll->set('first', 'worst'); |
29 | - $exp['first'] = 'worst'; |
|
29 | + $exp[ 'first' ] = 'worst'; |
|
30 | 30 | $this->assertEquals($exp, $coll->toArray()); |
31 | 31 | } |
32 | 32 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | public function testAddAppendsItemToCollectionWithNextNumericIndex() |
21 | 21 | { |
22 | - $array = Factory::create($this->fixtures['array']); |
|
22 | + $array = Factory::create($this->fixtures[ 'array' ]); |
|
23 | 23 | $this->assertEquals( |
24 | 24 | [ |
25 | 25 | 0 => 'first', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $array->toArray() |
51 | 51 | ); |
52 | 52 | |
53 | - $assoc = Factory::create($this->fixtures['assoc']); |
|
53 | + $assoc = Factory::create($this->fixtures[ 'assoc' ]); |
|
54 | 54 | $this->assertEquals( |
55 | 55 | [ |
56 | 56 | '1st' => 'first', |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | public function testLastReturnsLastItemInCollection() |
21 | 21 | { |
22 | - $coll = Factory::create($this->fixtures['names']); |
|
22 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
23 | 23 | $this->assertEquals('Nakia', $coll->last()); |
24 | 24 | } |
25 | 25 | } |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | { |
20 | 20 | public function testCurrentReturnsCurrentValue() |
21 | 21 | { |
22 | - $coll = Factory::create($this->fixtures['names']); |
|
22 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
23 | 23 | $this->assertEquals('Chelsea', $coll->current()); |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function testNextMovesCollectionInternalPointer() |
27 | 27 | { |
28 | - $coll = Factory::create($this->fixtures['names']); |
|
28 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
29 | 29 | $this->assertEquals( |
30 | 30 | 'Chelsea', |
31 | 31 | $coll->current(), |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public function testKeyReturnsCurrentKeyInCollection() |
72 | 72 | { |
73 | - $coll = Factory::create($this->fixtures['names']); |
|
73 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
74 | 74 | $this->assertSame(0, $coll->key(), 'Initial call to key() should return first item in collection.'); |
75 | 75 | $this->assertSame(0, $coll->key(), 'Subsequent calls to key() should continue to return the same value.'); |
76 | 76 | $coll->next(); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | public function testValidReturnsFalseWhenCollectionHasBeenIteratedBeyondItsLastItem() |
111 | 111 | { |
112 | - $coll = Factory::create($this->fixtures['names']); |
|
112 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
113 | 113 | $this->assertTrue($coll->valid(), 'Initial call to valid() should always return true.'); |
114 | 114 | $coll->next(); |
115 | 115 | $this->assertTrue($coll->valid(), 'Subsequent calls to valid() should continue to return true.'); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function testRewindWillReturnInternalPointerToItsInitialPosition() |
134 | 134 | { |
135 | - $coll = Factory::create($this->fixtures['names']); |
|
135 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
136 | 136 | $this->assertEquals('Chelsea', $coll->first()); |
137 | 137 | $this->assertTrue($coll->valid(), 'Initial call to valid() should always return true.'); |
138 | 138 | $coll->next(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | public function testInstantiationShouldRewindArrayArgsInternalPointer() |
174 | 174 | { |
175 | - $arr = $this->fixtures['names']; |
|
175 | + $arr = $this->fixtures[ 'names' ]; |
|
176 | 176 | $this->assertEquals('Chelsea', current($arr)); |
177 | 177 | next($arr); |
178 | 178 | $this->assertEquals('Adella', current($arr)); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | public function testRemoveRemovesItemByKey() |
21 | 21 | { |
22 | - $exp = $this->fixtures['assoc']; |
|
22 | + $exp = $this->fixtures[ 'assoc' ]; |
|
23 | 23 | $coll = Factory::create($exp); |
24 | 24 | $this->assertTrue($coll->containsKey('2nd')); |
25 | 25 | $removed = $coll->remove('2nd'); |
@@ -20,9 +20,9 @@ |
||
20 | 20 | { |
21 | 21 | public function testTransformTransformsCollectionInPlace() |
22 | 22 | { |
23 | - $coll = Factory::create($this->fixtures['names']); |
|
23 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
24 | 24 | $transformed = $coll->transform( |
25 | - function ($val, $key) { |
|
25 | + function($val, $key) { |
|
26 | 26 | return $val.$key; |
27 | 27 | } |
28 | 28 | ); |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | { |
20 | 20 | public function testPruneFiltersCollectionInPlace() |
21 | 21 | { |
22 | - $coll = Factory::create($this->fixtures['names']); |
|
22 | + $coll = Factory::create($this->fixtures[ 'names' ]); |
|
23 | 23 | $this->assertCount(10, $coll); |
24 | 24 | $this->assertSame( |
25 | 25 | $coll, |
26 | 26 | $coll->prune( |
27 | - function ($value, $key) { |
|
27 | + function($value, $key) { |
|
28 | 28 | return $key % 2 == 0; |
29 | 29 | } |
30 | 30 | ) |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->assertSame( |
34 | 34 | $coll, |
35 | 35 | $coll->prune( |
36 | - function ($value, $key) { |
|
36 | + function($value, $key) { |
|
37 | 37 | return strlen($value) >= 6; |
38 | 38 | } |
39 | 39 | ) |
@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | { |
20 | 20 | public function testArrayAccessUnsetRemovesItemByKeyAndReturnsNull() |
21 | 21 | { |
22 | - $exp = $this->fixtures['assoc']; |
|
22 | + $exp = $this->fixtures[ 'assoc' ]; |
|
23 | 23 | $coll = Factory::create($exp); |
24 | 24 | $this->assertTrue($coll->containsKey('2nd')); |
25 | 25 | $removed = $coll->offsetUnset('2nd'); |
26 | 26 | $this->assertFalse($coll->containsKey('2nd')); |
27 | 27 | $this->assertNull($removed, 'The ArrayAccess interface expects offsetUnset to have no return value.'); |
28 | 28 | $this->assertTrue($coll->containsKey('3rd')); |
29 | - unset($coll['3rd']); |
|
29 | + unset($coll[ '3rd' ]); |
|
30 | 30 | $this->assertFalse($coll->containsKey('3rd')); |
31 | 31 | } |
32 | 32 | |
33 | 33 | public function testArrayAccessOffsetExistsAllowsIssetToWorkWithSquareBrackets() |
34 | 34 | { |
35 | 35 | // associative |
36 | - $exp = $this->fixtures['assoc']; |
|
36 | + $exp = $this->fixtures[ 'assoc' ]; |
|
37 | 37 | $coll = Factory::create($exp); |
38 | 38 | $this->assertTrue($coll->containsKey('2nd')); |
39 | 39 | $this->assertTrue($coll->offsetExists('2nd'), 'Collection::offsetExists should return true if index exists.'); |
40 | 40 | $this->assertTrue( |
41 | - isset($coll['2nd']), |
|
41 | + isset($coll[ '2nd' ]), |
|
42 | 42 | 'Collection::offsetExists should allow for the use of isset() on a collection using square brackets.' |
43 | 43 | ); |
44 | 44 | $this->assertFalse($coll->containsKey('4th')); |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | 'Collection::offsetExists should return false if index does not exist.' |
48 | 48 | ); |
49 | 49 | $this->assertFalse( |
50 | - isset($coll['4th']), |
|
50 | + isset($coll[ '4th' ]), |
|
51 | 51 | 'Collection::offsetExists should allow for the use of isset() on a '. |
52 | 52 | 'collection using square brackets for an index that does not exist.' |
53 | 53 | ); |
54 | 54 | |
55 | 55 | // numeric |
56 | - $exp = $this->fixtures['array']; |
|
56 | + $exp = $this->fixtures[ 'array' ]; |
|
57 | 57 | $coll = Factory::create($exp); |
58 | 58 | $this->assertTrue($coll->containsKey(1)); |
59 | 59 | $this->assertTrue( |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | 'Collection::offsetExists should return true if numeric offset exists.' |
62 | 62 | ); |
63 | 63 | $this->assertTrue( |
64 | - isset($coll[1]), |
|
64 | + isset($coll[ 1 ]), |
|
65 | 65 | 'Collection::offsetExists should allow for the use of isset() on a collection using '. |
66 | 66 | 'square brackets and numeric offset.' |
67 | 67 | ); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | 'Collection::offsetExists should return false if numeric offset does not exist.' |
72 | 72 | ); |
73 | 73 | $this->assertFalse( |
74 | - isset($coll[5]), |
|
74 | + isset($coll[ 5 ]), |
|
75 | 75 | 'Collection::offsetExists should allow for the use of isset() on a collection using square brackets '. |
76 | 76 | 'for a numeric offset that does not exist.' |
77 | 77 | ); |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | public function testArrayAccessOffsetSetAllowsUseOfSquareBracketsForSetting() |
81 | 81 | { |
82 | 82 | // associative |
83 | - $exp = $this->fixtures['assoc']; |
|
83 | + $exp = $this->fixtures[ 'assoc' ]; |
|
84 | 84 | $coll = Factory::create($exp); |
85 | 85 | $this->assertFalse($coll->containsKey('foo')); |
86 | - $coll['foo'] = 'bar'; |
|
86 | + $coll[ 'foo' ] = 'bar'; |
|
87 | 87 | $this->assertTrue($coll->containsKey('foo')); |
88 | 88 | $this->assertEquals('bar', $coll->get('foo')); |
89 | 89 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | $this->assertEquals('far', $coll->get('boo')); |
94 | 94 | |
95 | 95 | // numeric |
96 | - $exp = $this->fixtures['array']; |
|
96 | + $exp = $this->fixtures[ 'array' ]; |
|
97 | 97 | $coll = Factory::create($exp); |
98 | 98 | $this->assertFalse($coll->containsKey(5)); |
99 | - $coll[5] = 'bar'; |
|
99 | + $coll[ 5 ] = 'bar'; |
|
100 | 100 | $this->assertTrue($coll->containsKey(5)); |
101 | 101 | $this->assertEquals('bar', $coll->get(5)); |
102 | 102 | |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | public function testArrayAccessOffsetSetAllowsUseOfSquareBracketsForSettingWithoutIndex() |
110 | 110 | { |
111 | 111 | // associative |
112 | - $assoc = $this->fixtures['assoc']; |
|
112 | + $assoc = $this->fixtures[ 'assoc' ]; |
|
113 | 113 | $aColl = Factory::create($assoc); |
114 | 114 | $this->assertFalse($aColl->containsKey(0)); |
115 | - $aColl[] = 'test'; |
|
115 | + $aColl[ ] = 'test'; |
|
116 | 116 | $this->assertTrue($aColl->containsKey(0)); |
117 | 117 | |
118 | 118 | // numeric |
119 | - $arr = $this->fixtures['array']; |
|
119 | + $arr = $this->fixtures[ 'array' ]; |
|
120 | 120 | $arrColl = Factory::create($arr); |
121 | 121 | $this->assertTrue($arrColl->containsKey(0)); |
122 | 122 | $this->assertTrue($arrColl->containsKey(1)); |
123 | 123 | $this->assertTrue($arrColl->containsKey(2)); |
124 | 124 | $this->assertFalse($arrColl->containsKey(3)); |
125 | - $arrColl[] = 'test'; |
|
125 | + $arrColl[ ] = 'test'; |
|
126 | 126 | $this->assertTrue($arrColl->containsKey(3)); |
127 | 127 | } |
128 | 128 | |
129 | 129 | public function testArrayAccessOffsetGetAllowsUseOfSquareBracketsForGetting() |
130 | 130 | { |
131 | - $exp = $this->fixtures['assoc']; |
|
131 | + $exp = $this->fixtures[ 'assoc' ]; |
|
132 | 132 | $coll = Factory::create($exp); |
133 | 133 | $this->assertEquals('first', $coll->offsetGet('1st')); |
134 | - $this->assertEquals('first', $coll['1st']); |
|
134 | + $this->assertEquals('first', $coll[ '1st' ]); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function testArrayAccessOffsetGetThrowsExceptionIfIndexDoesNotExist() |
142 | 142 | { |
143 | - $exp = $this->fixtures['assoc']; |
|
143 | + $exp = $this->fixtures[ 'assoc' ]; |
|
144 | 144 | $coll = Factory::create($exp); |
145 | - $foo = $coll['foo']; |
|
145 | + $foo = $coll[ 'foo' ]; |
|
146 | 146 | } |
147 | 147 | } |