/**
     * @covers Veles\Model\QueryBuilder::setPage
     */
    public function testSetPage()
    {
        $pager = new DbPaginator('');
        $news = new News();
        $expected = '
			SELECT SQL_CALC_FOUND_ROWS
				"id", "title", "content", "author"
			FROM
				"news" LIMIT 0, 5';
        $sql = $this->object->find($news, new DbFilter());
        $result = $this->object->setPage($sql, $pager);
        $msg = 'QueryBuilder::setPage returns wrong result!';
        $this->assertSame($expected, $result, $msg);
    }
Exemple #2
0
 /**
  * Get unique object
  *
  * @param bool|DbFilter $filter Filter object
  *
  * @return bool
  */
 public function find($filter = false)
 {
     $sql = $this->builder->find($this, $filter);
     return $this->getResult($sql);
 }