public function testLocateIdentifierCallsFindReflection()
{
/** @var Reflector|\PHPUnit_Framework_MockObject_MockObject $mockReflector */
$mockReflector = $this->createMock(Reflector::class);
$locatedSource = new LocatedSource('<?php class Foo{}', null);
$identifier = new Identifier('Foo', new IdentifierType(IdentifierType::IDENTIFIER_CLASS));
$mockReflection = $this->createMock(ReflectionClass::class);
/** @var AstLocator|\PHPUnit_Framework_MockObject_MockObject $astLocator */
$astLocator = $this->createMock(AstLocator::class);
$astLocator->expects($this->once())->method('findReflection')->with($mockReflector, $locatedSource, $identifier)->will($this->returnValue($mockReflection));
/** @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($locatedSource));
$this->assertSame($mockReflection, $sourceLocator->locateIdentifier($mockReflector, $identifier));
}