/** * 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')); }
public function testOverloadAliasNotFound() { $this->setExpectedException(NotFoundException::class); $container = new Container(); $container->ClassNotExist(); }
public function testInterfaceToAlias() { $container = new Container(['MyAlias' => 'stdClass', 'Vendor\\Package\\Interface' => 'MyAlias']); $this->assertInstanceOf('stdClass', $container->get('Vendor\\Package\\Interface')); }
/** * Test Missing Class Dependency */ public function testMissingClassDependency() { $this->setExpectedException(ContainerException::class); $container = new Container(); $container->get(Mocks\ClassMissingDependency::class); }