Sokil\Mongo\PaginatorTest::testPaginatorWhenPageNotExistsRequested PHP Method

testPaginatorWhenPageNotExistsRequested() public method

    public function testPaginatorWhenPageNotExistsRequested()
    {
        $d11 = $this->collection->createDocument(array('param1' => 1, 'param2' => 1))->save();
        $d12 = $this->collection->createDocument(array('param1' => 1, 'param2' => 2))->save();
        $d21 = $this->collection->createDocument(array('param1' => 2, 'param2' => 1))->save();
        $d22 = $this->collection->createDocument(array('param1' => 2, 'param2' => 2))->save();
        $pager = $this->collection->find()->paginate(20, 2);
        $this->assertEquals(4, $pager->getTotalRowsCount());
        $this->assertEquals(2, $pager->getTotalPagesCount());
        $this->assertEquals(2, $pager->getCurrentPage());
        $this->assertEquals($d21->getId(), $pager->current()->getId());
        $pager->next();
        $this->assertEquals($d22->getId(), $pager->current()->getId());
    }