Exemplo n.º 1
0
 public function testMultipleRegistrationsOfSameInterfaceReturnedInGetAllPass()
 {
     $ioc = new IocImpl();
     $ioc->register(A::class);
     $ioc->register(AB::class);
     $allA = $ioc->getAll(IA::class);
     $this->assertNotNull($allA);
     $this->assertArrayHasKey(0, $allA);
     $this->assertArrayHasKey(1, $allA);
     $b = $ioc->get(IB::class);
     $this->assertInstanceOf(IB::class, $b);
     $a = $ioc->get(IA::class);
     $this->assertInstanceOf(IA::class, $a);
 }