From cb6d5c7e13c0eee799b0e9fcb42432eaad674117 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 9 May 2019 19:09:36 +0400 Subject: Added sort fields Signed-off-by: Valentin Popov --- tests/api_test.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/api_test.php') 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); } /** -- cgit v1.2.3