4
* This file is part of the Symfony package.
6
* (c) Fabien Potencier <fabien@symfony.com>
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
12
namespace Symfony\Component\Yaml\Tests;
14
use Symfony\Component\Yaml\Exception\ParseException;
16
class ParseExceptionTest extends \PHPUnit_Framework_TestCase
18
public function testGetMessage()
20
$exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml');
21
if (PHP_VERSION_ID >= 50400) {
22
$message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
24
$message = 'Error message in "\\/var\\/www\\/app\\/config.yml" at line 42 (near "foo: bar")';
27
$this->assertEquals($message, $exception->getMessage());
30
public function testGetMessageWithUnicodeInFilename()
32
$exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
33
if (PHP_VERSION_ID >= 50400) {
34
$message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
36
$message = 'Error message in "\u00e4\u00f6\u00fc.yml" at line 42 (near "foo: bar")';
39
$this->assertEquals($message, $exception->getMessage());