BreakExceptionTest.php 960 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of Psy Shell.
  4. *
  5. * (c) 2012-2018 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\BreakException;
  12. class BreakExceptionTest extends \PHPUnit\Framework\TestCase
  13. {
  14. public function testInstance()
  15. {
  16. $e = new BreakException();
  17. $this->assertInstanceOf('Psy\Exception\Exception', $e);
  18. $this->assertInstanceOf('Psy\Exception\BreakException', $e);
  19. }
  20. public function testMessage()
  21. {
  22. $e = new BreakException('foo');
  23. $this->assertContains('foo', $e->getMessage());
  24. $this->assertSame('foo', $e->getRawMessage());
  25. }
  26. /**
  27. * @expectedException \Psy\Exception\BreakException
  28. * @expectedExceptionMessage Goodbye
  29. */
  30. public function testExitShell()
  31. {
  32. BreakException::exitShell();
  33. }
  34. }