X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=tests%2Flib%2Fpq%2FGateway%2FRowsetTest.php;h=6f16595994316ba4a49c0da7b89d275ca57bf463;hb=348c73cdaf65cf9df2d6f582a96bf8694f1255f5;hp=48ac624574615cc366a655835c34cfc56350b72e;hpb=0e2eb1f13ef60ce9a8709354136c42f7d87b2345;p=m6w6%2Fpq-gateway diff --git a/tests/lib/pq/Gateway/RowsetTest.php b/tests/lib/pq/Gateway/RowsetTest.php index 48ac624..6f16595 100644 --- a/tests/lib/pq/Gateway/RowsetTest.php +++ b/tests/lib/pq/Gateway/RowsetTest.php @@ -18,16 +18,14 @@ class RowsetTest extends \PHPUnit_Framework_TestCase { protected function setUp() { $this->conn = new \pq\Connection(PQ_TEST_DSN); - $this->conn->exec(PQ_TEST_TABLE_CREATE); - $this->conn->exec(PQ_TEST_REFTABLE_CREATE); - $this->conn->exec(PQ_TEST_DATA); + $this->conn->exec(PQ_TEST_SETUP_SQL); Table::$defaultConnection = $this->conn; $this->table = new Table("test"); + $this->table->getQueryExecutor()->attach(new \QueryLogger()); } protected function tearDown() { - $this->conn->exec(PQ_TEST_REFTABLE_DROP); - $this->conn->exec(PQ_TEST_TABLE_DROP); + $this->conn->exec(PQ_TEST_TEARDOWN_SQL); } public function test__invoke() { @@ -107,7 +105,7 @@ class RowsetTest extends \PHPUnit_Framework_TestCase { } public function testDeleteFail() { - $this->setExpectedException("pq\\Exception"); + $this->setExpectedException("Exception"); $rowset = new Rowset($this->table); $rowset->append(new Row($this->table, array("xx" => 0)))->delete(); } @@ -116,9 +114,9 @@ class RowsetTest extends \PHPUnit_Framework_TestCase { $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"}]', - date("Y-m-d H:i:s", strtotime("yesterday")), - date("Y-m-d H:i:s", strtotime("today")), - date("Y-m-d H:i:s", strtotime("tomorrow")) + new \pq\DateTime("yesterday"), + new \pq\DateTime("today"), + new \pq\DateTime("tomorrow") ); $this->assertJsonStringEqualsJsonString($json, json_encode($this->table->find())); }