diff options
author | Valentin Popov <info@valentineus.link> | 2019-05-09 19:35:59 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2019-05-09 19:35:59 +0300 |
commit | d441f44698a1ed0bf6cf33c74f910f05ab7d6a08 (patch) | |
tree | 1ad55cf66e27ed9c2ba18aaa1f1eaf5f6b675f71 /tests/api_test.php | |
parent | cb6d5c7e13c0eee799b0e9fcb42432eaad674117 (diff) | |
download | local_webhooks-d441f44698a1ed0bf6cf33c74f910f05ab7d6a08.tar.xz local_webhooks-d441f44698a1ed0bf6cf33c74f910f05ab7d6a08.zip |
Added get a total count records
Signed-off-by: Valentin Popov <info@valentineus.link>
Diffstat (limited to 'tests/api_test.php')
-rw-r--r-- | tests/api_test.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/api_test.php b/tests/api_test.php index 955c284..648c7e8 100644 --- a/tests/api_test.php +++ b/tests/api_test.php @@ -307,6 +307,36 @@ final class local_webhooks_api_testcase extends advanced_testcase { } /** + * Testing get a total count of existing records. + * + * @throws \coding_exception + * @throws \dml_exception + */ + public function test_total() { + $this->resetAfterTest(); + + $record = new record(); + $record->header = 'application/json'; + $record->status = true; + $record->token = '967b2286-0874-4938-b088-efdbcf8a79bc'; + $record->events = [ + '\core\event\course_created', + '\core\event\course_deleted', + '\core\event\course_updated', + '\core\event\course_viewed', + ]; + + $total = random_int(5, 20); + for ($i = 0; $i < $total; $i++) { + $record->name = 'Example name #' . $i; + $record->point = 'http://example.org/test_' . $i; + api::create_service($record); + } + + self::assertEquals($total, api::get_total_count()); + } + + /** * Testing of the service update. * * @group local_webhooks |