Nelmio\Alice\Parser\RuntimeCacheParserTest::testCanParseFile PHP Метод

testCanParseFile() публичный Метод

public testCanParseFile ( )
    public function testCanParseFile()
    {
        $file = 'foo.php';
        $expected = [new \stdClass()];
        $fileLocatorProphecy = $this->prophesize(FileLocatorInterface::class);
        $fileLocatorProphecy->locate($file)->willReturn('/path/to/foo.php');
        /** @var FileLocatorInterface $fileLocator */
        $fileLocator = $fileLocatorProphecy->reveal();
        $decoratedParserProphecy = $this->prophesize(ParserInterface::class);
        $decoratedParserProphecy->parse('/path/to/foo.php')->willReturn($expected);
        /* @var ParserInterface $decoratedParser */
        $decoratedParser = $decoratedParserProphecy->reveal();
        $includeProcessor = new FakeIncludeProcessor();
        $parser = new RuntimeCacheParser($decoratedParser, $fileLocator, $includeProcessor);
        $actual = $parser->parse($file);
        $this->assertSame($expected, $actual);
        // As the parser cache the results, parsing each file does not re-trigger a parse call
        $actual = $parser->parse($file);
        $this->assertSame($expected, $actual);
    }