summaryrefslogtreecommitdiff
path: root/tests/units/Pagination/UserPaginationTest.php
blob: c475aacde0111ed460a244d94e16b33dc2a3d52d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

use Kanboard\Model\UserModel;
use Kanboard\Pagination\UserPagination;

require_once __DIR__.'/../Base.php';

class UserPaginationTest extends Base
{
    public function testListingPagination()
    {
        $userModel = new UserModel($this->container);
        $userPagination = new UserPagination($this->container);

        $this->assertEquals(2, $userModel->create(array('username' => 'test1')));
        $this->assertEquals(3, $userModel->create(array('username' => 'test2')));

        $this->assertCount(3, $userPagination->getListingPaginator()->setOrder('id')->getCollection());
        $this->assertCount(3, $userPagination->getListingPaginator()->setOrder('username')->getCollection());
        $this->assertCount(3, $userPagination->getListingPaginator()->setOrder('name')->getCollection());
        $this->assertCount(3, $userPagination->getListingPaginator()->setOrder('email')->getCollection());
        $this->assertCount(3, $userPagination->getListingPaginator()->setOrder('role')->getCollection());
        $this->assertCount(3, $userPagination->getListingPaginator()->setOrder('twofactor_activated')->setDirection('DESC')->getCollection());
        $this->assertCount(3, $userPagination->getListingPaginator()->setOrder('is_ldap_user')->getCollection());
        $this->assertCount(3, $userPagination->getListingPaginator()->setOrder('is_active')->getCollection());
    }
}