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

Fixes #216 remove \Exception type hint #217

Merged
merged 4 commits into from
Sep 8, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update tests with exception and require section
  • Loading branch information
samsonasik committed Jul 1, 2016
commit 78afa0275f1de7b062e126d69a75aea74207b48c
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test requires PHP 7 - you can use the PHPUnit annotation for that

{
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');
}
}