From ae2f31261d8aa6019adcd618dc214c90d7b818bb Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Fri, 10 May 2019 22:12:01 +0400 Subject: Added exact test get record by an event Signed-off-by: Valentin Popov --- tests/api_test.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/api_test.php b/tests/api_test.php index a2900e4..5f7b8e2 100644 --- a/tests/api_test.php +++ b/tests/api_test.php @@ -234,8 +234,6 @@ final class local_webhooks_api_testcase extends advanced_testcase { /** * Testing get to the list services by event name. * - * @todo It's no testing all conditional. - * * @group local_webhooks * * @throws \dml_exception @@ -246,18 +244,20 @@ final class local_webhooks_api_testcase extends advanced_testcase { $this->resetAfterTest(); $eventname = generate_uuid(); + $limit = random_int(1, 5); $total = random_int(5, 20); $ids = []; for ($i = 0; $i < $total; $i++) { $record = self::get_random_record(); - $record->events[] = $eventname; + $record->events[] = $i < $limit ? $eventname : ''; $ids[] = api::add_service($record); } + self::assertEquals(count($ids), api::get_total_count()); $services = api::get_services_by_event($eventname); - self::assertCount(count($ids), $services); + self::assertCount($limit, $services); foreach ($services as $service) { self::assertContains($service->id, $ids); -- cgit v1.2.3