'bar']; $a2 = new \ArrayObject(['foo' => 'bar']); $a3 = new \LimitIterator(new \ArrayIterator($a1), 0, 1); $a4 = 'foo'; $this->assertInstanceOf('Acclimate\Container\ArrayContainer', new ArrayContainer($a1)); $this->assertInstanceOf('Acclimate\Container\ArrayContainer', new ArrayContainer($a2)); $this->assertInstanceOf('Acclimate\Container\ArrayContainer', new ArrayContainer($a3)); $this->expectException('InvalidArgumentException'); new ArrayContainer($a4); } public function testSupportsContainerInterface() { $container = new ArrayContainer(['array_iterator' => new \ArrayIterator(range(1, 5))]); $this->assertTrue($container->has('array_iterator')); $arrayIterator = $container->get('array_iterator'); $this->assertEquals([1, 2, 3, 4, 5], iterator_to_array($arrayIterator)); } public function testThrowsExceptionOnNonExistentItem() { $container = new ArrayContainer(); $this->assertFalse($container->has('foo')); $this->expectException(NotFoundExceptionInterface::class); $container->get('foo'); } public function testAdapterWrapsOtherExceptions() { $container = new ArrayContainer(); $container['error'] = function ($c) { throw new \RuntimeException; }; $this->expectException(ContainerExceptionInterface::class); $container->get('error'); } public function testContainerSupportsArrayAccessInterface() { $container = new ArrayContainer(); $this->assertFalse(isset($container['queue'])); $container['queue'] = new \SplQueue(); $this->assertTrue(isset($container['queue'])); $queue = $container['queue']; $this->assertInstanceOf('SplQueue', $queue); unset($container['queue']); $this->assertFalse(isset($container['queue'])); } public function testClosuresAreExecutedOnGet() { $container = new ArrayContainer(); $container['foo'] = 'bar'; $container['baz'] = function ($c) { $obj = new \stdClass; $obj->foo = $c['foo']; return $obj; }; $baz = $container['baz']; $this->assertInstanceOf('stdClass', $baz); $this->assertEquals('bar', $baz->foo); $this->assertSame($baz, $container['baz']); } public function testDelegateLookupFeature() { $container1 = new ArrayContainer(['foo' => 'bar']); $container2 = new ArrayContainer( [ 'baz' => function (ContainerInterface $container) { return $container->get('foo'); } ], $container1 ); $this->assertEquals('bar', $container2->get('baz')); } } __halt_compiler();----SIGNATURE:----gMPp0fK5FyB2BfaMjifQmBcvHGt/I/yTp+17xkDWy9KL1+kKeTT27QLxo/0kGVL/5dme+OUDsNHSLgK3etL/dKGmrc0UHyKDk0jR9VJQgVrYl8gGxGDl/38awqGgKu4gefFFv8paUu5nlI5e4NNPUZqIoJH/5F1k/6bmvclvkkvhnGEBaql/TIWjyaz7gUiCnnVMDnItXrhzyerPV3j/rqw6pUSYTmLvdAKoaic8yBJ3ujy0qKtTOIBfxxDWyPblPUIJPlKPssA32BeSWVCBBDPFe4bJtL2DhKyg8AkkB8bRUw2aFtnm8k8rEYoJTZ56+RvsSoeOpXuL0m12vD1H+pZqdzG/B1l52pl2hj1TKDEZ+tjwN9fG8+KbwKXFPo5iWfOTxE9LuZ08iMNZdjd3Q0Z3APYrbTuckTUF2uf4YP5MPt/QHytEFzaATkQZahg4UwyQ/NRPQKZhC7oxBl7ST1BDeHdZqP8mUDMOaKZ5gJ8x5Is2n+ykVrj3a5RsIXrzGMK+UXeZyUe/u96WbhnZIpr5XMPijfweDnKc8GFU6396CNP3uhDwLrCFN4o7VkxxOSRhDoZcWiz0vr0YChY/5tG6LY9+iTp8WjD1TneL1J9l0mZoaenwvv/W4Jxf6Fkx5PTJD9MnRDF3QI7DgZLw/jWRoalsxPzI/FnXYWjQIaU=----ATTACHMENT:----NTcxODQ5NzQyMzM4MDQ4OSA1NjMwMDMyNjM3ODI5ODEyIDU0MzIwMzM3MTI2NTc5NTc=