예제 #1
0
 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
 public function test_remove_invalid_id()
 {
     $container = new Container();
     $container->remove('foo');
 }