Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
update tests with exception and require section
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jul 1, 2016
1 parent 12b9af8 commit 78afa02
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions test/Exception/SerializableExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,26 @@

class SerializableExceptionTest extends PHPUnit_Framework_TestCase
{
public function testExceptionAndThrowable()
public function testException()
{
try {
$a = 1 / 0;
} catch (\Throwable $exception) {
$serializable = new SerializableException($exception);
$this->assertEquals('Division by zero', $serializable->getMessage());

return;
new \Exception('foo');
} catch (\Exception $exception) {
$serializable = new SerializableException($exception);
$this->assertEquals('Division by zero', $serializable->getMessage());
$this->assertEquals('foo', $serializable->getMessage());
}
}

/**
* @requires PHP 7
*/
public function testStdClassCallNotExistMethod()
{
try {
(new \stdClass)->iDoNotExist();
} catch (\Throwable $exception) {
$serializable = new SerializableException($exception);
$this->assertEquals('Call to undefined method stdClass::iDoNotExist()', $serializable->getMessage());

return;
}

$this->fail('fatal error');
}
}

0 comments on commit 78afa02

Please sign in to comment.