BetterReflectionTest\SourceLocator\Type\AbstractSourceLocatorTest::testLocateIdentifierReturnsNullWithoutTryingToFindReflectionWhenUnableToLocateSource PHP Method

testLocateIdentifierReturnsNullWithoutTryingToFindReflectionWhenUnableToLocateSource() public method

    public function testLocateIdentifierReturnsNullWithoutTryingToFindReflectionWhenUnableToLocateSource()
    {
        /** @var Reflector|\PHPUnit_Framework_MockObject_MockObject $mockReflector */
        $mockReflector = $this->createMock(Reflector::class);
        $identifier = new Identifier('Foo', new IdentifierType(IdentifierType::IDENTIFIER_CLASS));
        /** @var AstLocator|\PHPUnit_Framework_MockObject_MockObject $astLocator */
        $astLocator = $this->createMock(AstLocator::class);
        $astLocator->expects($this->never())->method('findReflection');
        /** @var AbstractSourceLocator|\PHPUnit_Framework_MockObject_MockObject $sourceLocator */
        $sourceLocator = $this->getMockBuilder(AbstractSourceLocator::class)->setConstructorArgs([$astLocator])->setMethods(['createLocatedSource'])->getMock();
        $sourceLocator->expects($this->once())->method('createLocatedSource')->with($identifier)->will($this->returnValue(null));
        $this->assertNull($sourceLocator->locateIdentifier($mockReflector, $identifier));
    }