X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fpq-gateway;a=blobdiff_plain;f=tests%2Flib%2Fpq%2FGateway%2FRowsetTest.php;h=61f6b11af4668fa1b30c8e8566b47eba8de6cfa9;hp=49e1853b35088968b3e2cc4c853c38f34c223b4d;hb=80c4d645e1650304b1dbcae85dbf17a6593896e4;hpb=409fca54acfee2db6c62540a8f67b1adfa695a38;ds=sidebyside diff --git a/tests/lib/pq/Gateway/RowsetTest.php b/tests/lib/pq/Gateway/RowsetTest.php index 49e1853..61f6b11 100644 --- a/tests/lib/pq/Gateway/RowsetTest.php +++ b/tests/lib/pq/Gateway/RowsetTest.php @@ -111,12 +111,16 @@ class RowsetTest extends \PHPUnit_Framework_TestCase { } public function testJsonSerialize() { - $json = sprintf('[{"id":"1","created":"%s","counter":"-1","number":"-1.1","data":"yesterday","list":[-1,0,1],"prop":null}' - .',{"id":"2","created":"%s","counter":"0","number":"0","data":"today","list":[0,1,2],"prop":null}' - .',{"id":"3","created":"%s","counter":"1","number":"1.1","data":"tomorrow","list":[1,2,3],"prop":null}]', - new \pq\DateTime("yesterday"), - new \pq\DateTime("today"), - new \pq\DateTime("tomorrow") + $yday = new \pq\DateTime("yesterday"); + $tday = new \pq\DateTime("today"); + $tmrw = new \pq\DateTime("tomorrow"); + + $yday->format = $tday->format = $tmrw->format = "Y-m-d H:i:s.u"; + + $json = sprintf('[{"id":1,"created":"%s","counter":-1,"number":-1.1,"data":"yesterday","list":[-1,0,1],"prop":null}' + .',{"id":2,"created":"%s","counter":0,"number":0,"data":"today","list":[0,1,2],"prop":null}' + .',{"id":3,"created":"%s","counter":1,"number":1.1,"data":"tomorrow","list":[1,2,3],"prop":null}]', + $yday, $tday, $tmrw ); $this->assertJsonStringEqualsJsonString($json, json_encode($this->table->find())); }