mirror of
https://github.com/filp/whoops.git
synced 2026-09-01 04:58:14 +00:00
Add Frame serialization test
This commit is contained in:
@@ -180,4 +180,30 @@ class FrameTest extends TestCase
|
||||
$this->assertEquals($comments[0]['comment'], $testComments[0][0]);
|
||||
$this->assertEquals($comments[1]['comment'], $testComments[1][0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Whoops\Exception\Frame::serialize
|
||||
* @covers Whoops\Exception\Frame::unserialize
|
||||
*/
|
||||
public function testFrameIsSerializable()
|
||||
{
|
||||
$data = $this->getFrameData();
|
||||
$frame = $this->getFrameInstance();
|
||||
$commentText = "Gee I hope this works";
|
||||
$commentContext = "test";
|
||||
|
||||
$frame->addComment($commentText, $commentContext);
|
||||
|
||||
$serializedFrame = serialize($frame);
|
||||
$newFrame = unserialize($serializedFrame);
|
||||
|
||||
$this->assertInstanceOf('Whoops\\Exception\\Frame', $newFrame);
|
||||
$this->assertEquals($newFrame->getFile(), $data['file']);
|
||||
$this->assertEquals($newFrame->getLine(), $data['line']);
|
||||
|
||||
$comments = $newFrame->getComments();
|
||||
$this->assertCount(1, $comments);
|
||||
$this->assertEquals($comments[0]["comment"], $commentText);
|
||||
$this->assertEquals($comments[0]["context"], $commentContext);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user