コード例 #1
0
ファイル: ContainerAliasTest.php プロジェクト: weew/container
 public function test_remove_parent_definition_and_get_alias()
 {
     $container = new Container();
     $container->set([SimpleImplementation::class, IImplementation::class], SimpleImplementation::class);
     $value1 = $container->get(SimpleImplementation::class);
     $value2 = $container->get(IImplementation::class);
     $this->assertTrue($value1 instanceof SimpleImplementation);
     $this->assertTrue($value2 instanceof SimpleImplementation);
     $container->remove(SimpleImplementation::class);
     $this->assertFalse($container->has(SimpleImplementation::class));
     $this->assertTrue($container->has(IImplementation::class));
     $value2 = $container->get(IImplementation::class);
     $this->assertTrue($value2 instanceof SimpleImplementation);
 }
コード例 #2
0
ファイル: ContainerTest.php プロジェクト: weew/container
 public function test_remove_invalid_id()
 {
     $container = new Container();
     $container->remove('foo');
 }