X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fpq-gateway;a=blobdiff_plain;f=tests%2Flib%2Fpq%2FGateway%2FRowsetTest.php;h=49e1853b35088968b3e2cc4c853c38f34c223b4d;hp=6f16595994316ba4a49c0da7b89d275ca57bf463;hb=409fca54acfee2db6c62540a8f67b1adfa695a38;hpb=0b0830c9c6254d596808d461755309200582825a diff --git a/tests/lib/pq/Gateway/RowsetTest.php b/tests/lib/pq/Gateway/RowsetTest.php index 6f16595..49e1853 100644 --- a/tests/lib/pq/Gateway/RowsetTest.php +++ b/tests/lib/pq/Gateway/RowsetTest.php @@ -71,7 +71,7 @@ class RowsetTest extends \PHPUnit_Framework_TestCase { } public function testCreateFail() { - $this->setExpectedException("\\pq\\Exception"); + $this->setExpectedException("\\OutOfBoundsException"); $rowset = new Rowset($this->table); $rowset->append(new Row($this->table, array("foo" => "bar"), true)); $rowset->create(); @@ -111,9 +111,9 @@ class RowsetTest extends \PHPUnit_Framework_TestCase { } public function testJsonSerialize() { - $json = sprintf('[{"id":"1","created":"%s","counter":"-1","number":"-1.1","data":"yesterday"}' - .',{"id":"2","created":"%s","counter":"0","number":"0","data":"today"}' - .',{"id":"3","created":"%s","counter":"1","number":"1.1","data":"tomorrow"}]', + $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") @@ -155,4 +155,14 @@ class RowsetTest extends \PHPUnit_Framework_TestCase { $this->assertSame(array(), $rowset3->getRows()); $this->assertCount(1, $rowset->filter(function($row) { return $row->id->get() == 1; })); } + + public function testApplyAppend() { + $rowset1 = $this->table->find(null, null, 1); + $rowset2 = $this->table->find(null, null, 1, 1); + $this->assertCount(1, $rowset1); + $this->assertCount(1, $rowset2); + $rowset2->apply(array($rowset1, "append")); + $this->assertCount(1, $rowset2); + $this->assertCount(2, $rowset1); + } }