菜谱项目

ParseExceptionTest.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Yaml\Tests;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Yaml\Exception\ParseException;
  13. class ParseExceptionTest extends TestCase
  14. {
  15. public function testGetMessage()
  16. {
  17. $exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml');
  18. $message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
  19. $this->assertEquals($message, $exception->getMessage());
  20. }
  21. public function testGetMessageWithUnicodeInFilename()
  22. {
  23. $exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
  24. $message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
  25. $this->assertEquals($message, $exception->getMessage());
  26. }
  27. }