No Description

ParseErrorExceptionTest.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /*
  3. * This file is part of Psy Shell
  4. *
  5. * (c) 2012-2014 Justin Hileman
  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 Psy\Test\Exception;
  11. use Psy\Exception\Exception;
  12. use Psy\Exception\ParseErrorException;
  13. class ParseErrorExceptionTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testInstance()
  16. {
  17. $e = new ParseErrorException();
  18. $this->assertTrue($e instanceof Exception);
  19. $this->assertTrue($e instanceof \PHPParser_Error);
  20. $this->assertTrue($e instanceof ParseErrorException);
  21. }
  22. public function testMessage()
  23. {
  24. $e = new ParseErrorException('{msg}', 1);
  25. $this->assertContains('{msg}', $e->getMessage());
  26. $this->assertContains('PHP Parse error:', $e->getMessage());
  27. }
  28. public function testConstructFromParseError()
  29. {
  30. $e = ParseErrorException::fromParseError(new \PHPParser_Error('{msg}'));
  31. $this->assertContains('{msg}', $e->getRawMessage());
  32. $this->assertContains('PHP Parse error:', $e->getMessage());
  33. }
  34. }