annotate vendor/psy/psysh/test/Exception/ParseErrorExceptionTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /*
Chris@0 4 * This file is part of Psy Shell.
Chris@0 5 *
Chris@0 6 * (c) 2012-2018 Justin Hileman
Chris@0 7 *
Chris@0 8 * For the full copyright and license information, please view the LICENSE
Chris@0 9 * file that was distributed with this source code.
Chris@0 10 */
Chris@0 11
Chris@0 12 namespace Psy\Test\Exception;
Chris@0 13
Chris@0 14 use Psy\Exception\ParseErrorException;
Chris@0 15
Chris@0 16 class ParseErrorExceptionTest extends \PHPUnit\Framework\TestCase
Chris@0 17 {
Chris@0 18 public function testInstance()
Chris@0 19 {
Chris@0 20 $e = new ParseErrorException();
Chris@0 21
Chris@0 22 $this->assertInstanceOf('Psy\Exception\Exception', $e);
Chris@0 23 $this->assertInstanceOf('PhpParser\Error', $e);
Chris@0 24 $this->assertInstanceOf('Psy\Exception\ParseErrorException', $e);
Chris@0 25 }
Chris@0 26
Chris@0 27 public function testMessage()
Chris@0 28 {
Chris@0 29 $e = new ParseErrorException('{msg}', 1);
Chris@0 30
Chris@0 31 $this->assertContains('{msg}', $e->getMessage());
Chris@0 32 $this->assertContains('PHP Parse error:', $e->getMessage());
Chris@0 33 }
Chris@0 34
Chris@0 35 public function testConstructFromParseError()
Chris@0 36 {
Chris@0 37 $e = ParseErrorException::fromParseError(new \PhpParser\Error('{msg}'));
Chris@0 38
Chris@0 39 $this->assertContains('{msg}', $e->getRawMessage());
Chris@0 40 $this->assertContains('PHP Parse error:', $e->getMessage());
Chris@0 41 }
Chris@0 42 }