aboutsummaryrefslogtreecommitdiff
path: root/tests/api_test.php
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2019-05-09 18:09:36 +0300
committerValentin Popov <info@valentineus.link>2019-05-09 18:09:36 +0300
commitcb6d5c7e13c0eee799b0e9fcb42432eaad674117 (patch)
tree69706adbf809f7eaf8e24feef51e819aeed77fd5 /tests/api_test.php
parentda306feae32b859f5cd40793aa9cefe6180a900f (diff)
downloadlocal_webhooks-cb6d5c7e13c0eee799b0e9fcb42432eaad674117.tar.xz
local_webhooks-cb6d5c7e13c0eee799b0e9fcb42432eaad674117.zip
Added sort fields
Signed-off-by: Valentin Popov <info@valentineus.link>
Diffstat (limited to 'tests/api_test.php')
-rw-r--r--tests/api_test.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/api_test.php b/tests/api_test.php
index 461ddc6..955c284 100644
--- a/tests/api_test.php
+++ b/tests/api_test.php
@@ -291,12 +291,19 @@ final class local_webhooks_api_testcase extends advanced_testcase {
api::create_service($record);
}
+ // Testing condition fields.
self::assertCount(1, api::get_services([
'point' => 'http://example.org/test_' . random_int(1, 5),
]));
+ // Testing limit fields.
$limit = intdiv($total, 2);
- self::assertCount($limit, api::get_services([], 1, $limit));
+ self::assertCount($limit, api::get_services([], null, 1, $limit));
+
+ // Testing sort fields.
+ $service1 = api::get_services(null, 'id asc')[0];
+ $service2 = api::get_services(null, 'id desc')[0];
+ self::assertNotEquals($service1->id, $service2->id);
}
/**