This repository has been archived by the owner on Jan 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/ZendDeveloperTools for the canonical source repository | ||
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendDeveloperToolsTest\Exception; | ||
|
||
use Exception; | ||
use PHPUnit_Framework_TestCase as TestCase; | ||
use stdClass; | ||
use Throwable; | ||
use ZendDeveloperTools\Exception\SerializableException; | ||
|
||
class SerializableExceptionTest extends TestCase | ||
{ | ||
public function testSerializableExceptionUsesPreviousExceptionMessage() | ||
{ | ||
$original = new Exception('foo'); | ||
$serializable = new SerializableException($original); | ||
$this->assertEquals($original->getMessage(), $serializable->getMessage()); | ||
} | ||
|
||
/** | ||
* @requires PHP 7 | ||
*/ | ||
public function testSerializableExceptionReportsCallToUndefinedMethod() | ||
{ | ||
try { | ||
(new stdClass)->iDoNotExist(); | ||
} catch (Throwable $exception) { | ||
$serializable = new SerializableException($exception); | ||
$this->assertEquals('Call to undefined method stdClass::iDoNotExist()', $serializable->getMessage()); | ||
} | ||
} | ||
} |