Microweber\tests\DbTest::testLimitAndPaging PHP Method

testLimitAndPaging() public method

public testLimitAndPaging ( )
    public function testLimitAndPaging()
    {
        $add_page = db_save('content', $this->save);
        $add_page = db_save('content', $this->save);
        $add_page = db_save('content', $this->save);
        $add_page = db_save('content', $this->save);
        $pages_count = db_get('content', 'limit=2&count_paging=1');
        $first_page = db_get('content', 'limit=2');
        $second_page = db_get('content', 'limit=2&current_page=2');
        $first_page_items = count($first_page);
        $second_page_items = count($second_page);
        $ids_on_first_page = array();
        foreach ($first_page as $item) {
            $this->assertTrue(isset($item['id']));
            $ids_on_first_page[] = $item['id'];
        }
        foreach ($second_page as $item) {
            $this->assertTrue(isset($item['id']));
            $this->assertFalse(in_array($item['id'], $ids_on_first_page));
        }
        $this->assertEquals($first_page_items, $second_page_items, 'First page item count: ' . $first_page_items . ', second page item count: ' . $second_page_items);
        $this->assertTrue(intval($pages_count) > 1);
        // @todo: fix  the count_paging param to return integer    $this->assertTrue(is_int($pages_count));
    }