annotate vendor/psy/psysh/test/Exception/FatalErrorExceptionTest.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\FatalErrorException;
Chris@0 15
Chris@0 16 class FatalErrorExceptionTest extends \PHPUnit\Framework\TestCase
Chris@0 17 {
Chris@0 18 public function testInstance()
Chris@0 19 {
Chris@0 20 $e = new FatalErrorException();
Chris@0 21
Chris@0 22 $this->assertInstanceOf('Psy\Exception\Exception', $e);
Chris@0 23 $this->assertInstanceOf('ErrorException', $e);
Chris@0 24 $this->assertInstanceOf('Psy\Exception\FatalErrorException', $e);
Chris@0 25 }
Chris@0 26
Chris@0 27 public function testMessage()
Chris@0 28 {
Chris@0 29 $e = new FatalErrorException('{msg}', 0, 0, '{filename}', 13);
Chris@0 30
Chris@0 31 $this->assertSame('{msg}', $e->getRawMessage());
Chris@0 32 $this->assertContains('{msg}', $e->getMessage());
Chris@0 33 $this->assertContains('{filename}', $e->getMessage());
Chris@0 34 $this->assertContains('line 13', $e->getMessage());
Chris@0 35 }
Chris@0 36
Chris@0 37 public function testMessageWithNoFilename()
Chris@0 38 {
Chris@0 39 $e = new FatalErrorException('{msg}');
Chris@0 40
Chris@0 41 $this->assertSame('{msg}', $e->getRawMessage());
Chris@0 42 $this->assertContains('{msg}', $e->getMessage());
Chris@0 43 $this->assertContains('eval()\'d code', $e->getMessage());
Chris@0 44 }
Chris@0 45
Chris@0 46 public function testNegativeOneLineNumberIgnored()
Chris@0 47 {
Chris@0 48 $e = new FatalErrorException('{msg}', 0, 1, null, -1);
Chris@0 49 $this->assertEquals(0, $e->getLine());
Chris@0 50 }
Chris@0 51 }