public function testReadWithViewConditions() { $couchdb = new CouchDb($this->_testConfig); $this->_query->conditions(array('design' => 'latest', 'view' => 'all', 'limit' => 10, 'descending' => 'true')); $result = $couchdb->read($this->_query); $this->assertEqual(array('total_rows' => 3, 'offset' => 0), $result->stats()); $expected = array('id' => 'a1', 'rev' => '1-1', 'author' => 'author 1', 'body' => 'body 1'); $result = $result->data(); $this->assertEqual($expected, $result['a1']); $expected = '/lithium-test/_design/latest/_view/all/'; $result = $couchdb->last->request->path; $this->assertEqual($expected, $result); $expected = '?limit=10&descending=true'; $result = $couchdb->last->request->queryString(); $this->assertEqual($expected, $result); }
public function testReadWithViewConditions() { $couchdb = new CouchDb($this->_testConfig); $this->query->conditions(array('design' => 'latest', 'view' => 'all', 'limit' => 10, 'descending' => 'true')); $result = $couchdb->read($this->query); $this->assertEqual(array('total_rows' => null, 'offset' => null), $result->stats()); $this->assertTrue($result); $expected = '/lithium-test/_design/latest/_view/all/'; $result = $couchdb->last->request->path; $this->assertEqual($expected, $result); $expected = 'limit=10&descending=true'; $result = $couchdb->last->request->params; $this->assertEqual($expected, $result); }
public function testReadWithViewConditions() { $couchdb = new CouchDb($this->_testConfig); $expected = true; $this->query->conditions(array('design' => 'latest', 'view' => 'all', 'limit' => 10, 'descending' => 'true')); $result = $couchdb->read($this->query); $this->assertEqual($expected, $result); $expected = '/posts/_design/latest/_view/all'; $result = $couchdb->last->request->path; $this->assertEqual($expected, $result); $expected = 'limit=10&descending=true'; $result = $couchdb->last->request->params; $this->assertEqual($expected, $result); }