aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2019-05-10 21:12:01 +0300
committerValentin Popov <info@valentineus.link>2019-05-10 21:12:01 +0300
commitae2f31261d8aa6019adcd618dc214c90d7b818bb (patch)
tree4a890a5178d856d0459d7daf5102fe4f5e698955 /tests
parent46711c9942ebdcf6bbb8472f6893050e48f35f7d (diff)
downloadlocal_webhooks-ae2f31261d8aa6019adcd618dc214c90d7b818bb.tar.xz
local_webhooks-ae2f31261d8aa6019adcd618dc214c90d7b818bb.zip
Added exact test get record by an event
Signed-off-by: Valentin Popov <info@valentineus.link>
Diffstat (limited to 'tests')
-rw-r--r--tests/api_test.php8
1 files changed, 4 insertions, 4 deletions
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);