Nelmio\Alice\Parser\Chainable\YamlParserTest::testThrowsAnExceptionOnUnexpectedParseException PHP Method

testThrowsAnExceptionOnUnexpectedParseException() public method

    public function testThrowsAnExceptionOnUnexpectedParseException()
    {
        try {
            $file = self::$dir . '/basic.yml';
            $symfonyYamlParserProphecy = $this->prophesize(SymfonyYamlParser::class);
            $symfonyYamlParserProphecy->parse(Argument::any())->willThrow(\Exception::class);
            /* @var SymfonyYamlParser $symfonyYamlParser */
            $symfonyYamlParser = $symfonyYamlParserProphecy->reveal();
            $parser = new YamlParser($symfonyYamlParser);
            $parser->parse($file);
            $this->fail('Expected exception to be thrown.');
        } catch (UnparsableFileException $exception) {
            $this->assertRegExp('/^Could not parse the file ".+\\/basic\\.yml"\\.$/', $exception->getMessage());
            $this->assertEquals(0, $exception->getCode());
            $this->assertNotNull($exception->getPrevious());
        }
    }