4 * This file is part of Psy Shell.
6 * (c) 2012-2018 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Test\Exception;
14 use Psy\Exception\FatalErrorException;
16 class FatalErrorExceptionTest extends \PHPUnit\Framework\TestCase
18 public function testInstance()
20 $e = new FatalErrorException();
22 $this->assertInstanceOf('Psy\Exception\Exception', $e);
23 $this->assertInstanceOf('ErrorException', $e);
24 $this->assertInstanceOf('Psy\Exception\FatalErrorException', $e);
27 public function testMessage()
29 $e = new FatalErrorException('{msg}', 0, 0, '{filename}', 13);
31 $this->assertSame('{msg}', $e->getRawMessage());
32 $this->assertContains('{msg}', $e->getMessage());
33 $this->assertContains('{filename}', $e->getMessage());
34 $this->assertContains('line 13', $e->getMessage());
37 public function testMessageWithNoFilename()
39 $e = new FatalErrorException('{msg}');
41 $this->assertSame('{msg}', $e->getRawMessage());
42 $this->assertContains('{msg}', $e->getMessage());
43 $this->assertContains('eval()\'d code', $e->getMessage());