X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Flib%2Fpq%2FGateway%2FRowTest.php;fp=tests%2Flib%2Fpq%2FGateway%2FRowTest.php;h=28d2728c006817ad09e59470d492ed8abf93d666;hb=4879955d1b86d606dc24401f26ebde9be7612fbf;hp=0000000000000000000000000000000000000000;hpb=20d2b6bcce8f1c7a1aaa375b86ffb5be30674956;p=m6w6%2Fpq-gateway diff --git a/tests/lib/pq/Gateway/RowTest.php b/tests/lib/pq/Gateway/RowTest.php new file mode 100644 index 0000000..28d2728 --- /dev/null +++ b/tests/lib/pq/Gateway/RowTest.php @@ -0,0 +1,53 @@ +conn = new \pq\Connection(PQ_DSN); + $this->conn->exec(PQ_TEST_DROP_TABLE); + $this->conn->exec(PQ_TEST_CREATE_TABLE); + $this->conn->exec(PQ_TEST_CREATE_DATA); + + $this->table = new Table(PQ_TEST_TABLE_NAME, $this->conn); + } + + protected function tearDown() { + $this->conn->exec(PQ_TEST_DROP_TABLE); + } + + function testBasic() { + $row = new Row($this->table, array("id" => 3), true); + $this->assertTrue($row->isDirty()); + $row->refresh(); + $this->assertSame( + array( + "id" => "3", + "created" => date("Y-m-d H:i:s", strtotime("tomorrow")), + "counter" => "1", + "number" => "1.1", + "data" => "tomorrow" + ), + $row->getData() + ); + $this->assertFalse($row->isDirty()); + } + + function testGetTable() { + $row = new Row($this->table); + $this->assertSame($this->table, $row->getTable()); + } +}