public function testNullReturnedWhenInvalidTypeGiven() { $locator = new AutoloadSourceLocator(); $type = new IdentifierType(); $typeReflection = new \ReflectionObject($type); $prop = $typeReflection->getProperty('name'); $prop->setAccessible(true); $prop->setValue($type, 'nonsense'); $identifier = new Identifier('foo', $type); $this->assertNull($locator->__invoke($identifier)); }
public function testExceptionThrownWhenInvalidTypeGiven() { $locator = new AutoloadSourceLocator(); $type = new IdentifierType(); $typeReflection = new \ReflectionObject($type); $prop = $typeReflection->getProperty('name'); $prop->setAccessible(true); $prop->setValue($type, 'nonsense'); $this->setExpectedException(UnloadableIdentifierType::class, 'AutoloadSourceLocator cannot locate nonsense'); $identifier = new Identifier('foo', $type); $locator->__invoke($identifier); }