summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-01-07 12:39:04 +0100
committerArthur Schiwon <blizzz@owncloud.com>2015-01-07 12:39:29 +0100
commit6c335ee6fc846275b2138d480286a1dbcf1f4afe (patch)
tree4f16728f1f519a457dae051d7dcef073020b1e02
parentae9c9a46b8f11a0f548dfbbc23d3c215910130aa (diff)
downloadnextcloud-server-6c335ee6fc846275b2138d480286a1dbcf1f4afe.tar.gz
nextcloud-server-6c335ee6fc846275b2138d480286a1dbcf1f4afe.zip
add test for mapping's getList method
-rw-r--r--apps/user_ldap/tests/mapping/abstractmappingtest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/mapping/abstractmappingtest.php b/apps/user_ldap/tests/mapping/abstractmappingtest.php
index a5cb62253af..cafa36a4edb 100644
--- a/apps/user_ldap/tests/mapping/abstractmappingtest.php
+++ b/apps/user_ldap/tests/mapping/abstractmappingtest.php
@@ -191,4 +191,28 @@ abstract class AbstractMappingTest extends \Test\TestCase {
$this->assertFalse($name);
}
}
+
+ /**
+ * tests getList() method
+ */
+ public function testList() {
+ list($mapper, $data) = $this->initTest();
+
+ // get all entries without specifying offset or limit
+ $results = $mapper->getList();
+ $this->assertSame(3, count($results));
+
+ // get all-1 entries by specifying offset, and an high limit
+ // specifying only offset without limit will not work by underlying lib
+ $results = $mapper->getList(1, 999);
+ $this->assertSame(count($data) - 1, count($results));
+
+ // get first 2 entries by limit, but not offset
+ $results = $mapper->getList(null, 2);
+ $this->assertSame(2, count($results));
+
+ // get 2nd entry by specifying both offset and limit
+ $results = $mapper->getList(1, 1);
+ $this->assertSame(1, count($results));
+ }
}