| @@ 155-161 (lines=7) @@ | ||
| 152 | $this->assertEquals(['foo' => 'a', 'bar' => 'b', 'baz' => 'c'], $cont->getAll()); |
|
| 153 | } |
|
| 154 | ||
| 155 | public function testArrayAccessUnset() |
|
| 156 | { |
|
| 157 | $cont = new ImmutableContainer(['foo' => 'a', 'bar' => 'b', 'baz' => 'c']); |
|
| 158 | ||
| 159 | unset($cont['baz']); |
|
| 160 | $this->assertTrue($cont->has('baz')); |
|
| 161 | } |
|
| 162 | ||
| 163 | public function testArrayAccessSet() |
|
| 164 | { |
|
| @@ 163-169 (lines=7) @@ | ||
| 160 | $this->assertTrue($cont->has('baz')); |
|
| 161 | } |
|
| 162 | ||
| 163 | public function testArrayAccessSet() |
|
| 164 | { |
|
| 165 | $cont = new ImmutableContainer(['foo' => 'a', 'bar' => 'b', 'baz' => 'c']); |
|
| 166 | ||
| 167 | $cont['baz'] = 'd'; |
|
| 168 | $this->assertEquals('c', $cont->get('baz')); |
|
| 169 | } |
|
| 170 | ||
| 171 | public function testExtractedChildDoesNotModifyParent() |
|
| 172 | { |
|
| @@ 155-161 (lines=7) @@ | ||
| 152 | $this->assertEquals(['foo' => 'a', 'bar' => 'b', 'baz' => 'c'], $cont->getAll()); |
|
| 153 | } |
|
| 154 | ||
| 155 | public function testArrayAccessUnset() |
|
| 156 | { |
|
| 157 | $cont = new ImmutableFlatContainer(['foo' => 'a', 'bar' => 'b', 'baz' => 'c']); |
|
| 158 | ||
| 159 | unset($cont['baz']); |
|
| 160 | $this->assertTrue($cont->has('baz')); |
|
| 161 | } |
|
| 162 | ||
| 163 | public function testArrayAccessSet() |
|
| 164 | { |
|
| @@ 163-169 (lines=7) @@ | ||
| 160 | $this->assertTrue($cont->has('baz')); |
|
| 161 | } |
|
| 162 | ||
| 163 | public function testArrayAccessSet() |
|
| 164 | { |
|
| 165 | $cont = new ImmutableFlatContainer(['foo' => 'a', 'bar' => 'b', 'baz' => 'c']); |
|
| 166 | ||
| 167 | $cont['baz'] = 'd'; |
|
| 168 | $this->assertEquals('c', $cont->get('baz')); |
|
| 169 | } |
|
| 170 | ||
| 171 | public function testImmutableChildren() |
|
| 172 | { |
|
| @@ 176-182 (lines=7) @@ | ||
| 173 | $this->assertEquals('a', $cont['foo']); |
|
| 174 | } |
|
| 175 | ||
| 176 | public function testArraySet() |
|
| 177 | { |
|
| 178 | $cont = new Container(['foo' => 'a', 'bar' => 'b']); |
|
| 179 | $cont['baz'] = 'c'; |
|
| 180 | ||
| 181 | $this->assertEquals(['foo' => 'a', 'bar' => 'b', 'baz' => 'c'], $cont->getAll()); |
|
| 182 | } |
|
| 183 | ||
| 184 | public function testArrayHasIsTrue() |
|
| 185 | { |
|
| @@ 198-204 (lines=7) @@ | ||
| 195 | $this->assertFalse(isset($cont['foo'])); |
|
| 196 | } |
|
| 197 | ||
| 198 | public function testArrayRemove() |
|
| 199 | { |
|
| 200 | $cont = new Container(['foo' => 'a', 'bar' => 'b', 'baz' => 'c']); |
|
| 201 | unset($cont['bar']); |
|
| 202 | ||
| 203 | $this->assertEquals(['foo' => 'a', 'baz' => 'c'], $cont->getAll()); |
|
| 204 | } |
|
| 205 | ||
| 206 | public function testArrayRemoveMissing() |
|
| 207 | { |
|