/**
  * @covers Veles\DataBase\DbPaginator::getCurrPage
  */
 public function testGetCurrPage()
 {
     $expected = 1;
     $result = $this->object->getCurrPage();
     $msg = 'DbPaginator::getCurrPage() returns wrong result!';
     $this->assertSame($expected, $result, $msg);
     $expected = 5;
     $object = new DbPaginator('', 5);
     $result = $object->getCurrPage();
     $msg = 'DbPaginator::getCurrPage() returns wrong result!';
     $this->assertSame($expected, $result, $msg);
 }
Beispiel #2
0
 /**
  * Построение произвольного запроса с постраничным выводом
  *
  * @param string      $sql   Запрос
  * @param DbPaginator $pager Экземпляр постраничного вывода
  *
  * @return string
  */
 public function setPage($sql, DbPaginator $pager)
 {
     $sql = str_replace('SELECT', 'SELECT SQL_CALC_FOUND_ROWS', $sql);
     return $sql . $pager->getSqlLimit();
 }