Add Frame serialization test

This commit is contained in:
filp
2013-05-10 19:09:00 +01:00
parent fe1c72287a
commit 65d80cfcfb
+26
View File
@@ -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);
}
}