コード例 #1
0
 /**
  * Test Missing Class Dependency 
  */
 public function testMissingClassDependency()
 {
     $this->setExpectedException(ContainerException::class);
     $container = new Container();
     $container->get(Mocks\ClassMissingDependency::class);
 }
コード例 #2
0
 /**
  * Test for Class that does not exist or cannot be autoloaded
  */
 public function testHasNotClass()
 {
     $container = new Container();
     $this->assertFalse($container->has('GunnaPHP\\DI\\Test\\Mocks\\DoesNotExist'));
 }
コード例 #3
0
 public function testOverloadAliasNotFound()
 {
     $this->setExpectedException(NotFoundException::class);
     $container = new Container();
     $container->ClassNotExist();
 }
コード例 #4
0
 public function testInterfaceToAlias()
 {
     $container = new Container(['MyAlias' => 'stdClass', 'Vendor\\Package\\Interface' => 'MyAlias']);
     $this->assertInstanceOf('stdClass', $container->get('Vendor\\Package\\Interface'));
 }