Added function get an event's list
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
		@@ -110,9 +110,34 @@ final class local_webhooks_api_testcase extends advanced_testcase {
 | 
			
		||||
        self::assertCount(0, $DB->get_records(LW_TABLE_SERVICES));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Testing get an event's list.
 | 
			
		||||
     *
 | 
			
		||||
     * @group local_webhooks
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \ReflectionException
 | 
			
		||||
     */
 | 
			
		||||
    public function test_get_events() {
 | 
			
		||||
        $this->resetAfterTest();
 | 
			
		||||
 | 
			
		||||
        $events = api::get_events();
 | 
			
		||||
 | 
			
		||||
        self::assertNotCount(0, $events);
 | 
			
		||||
 | 
			
		||||
        foreach ($events as $name => $event) {
 | 
			
		||||
            self::assertInternalType('array', $event);
 | 
			
		||||
 | 
			
		||||
            self::assertEquals([
 | 
			
		||||
                'eventname', 'component', 'target', 'action', 'crud', 'edulevel', 'objecttable',
 | 
			
		||||
            ], array_keys($event));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Testing get to a service.
 | 
			
		||||
     *
 | 
			
		||||
     * @group local_webhooks
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \dml_exception
 | 
			
		||||
     * @throws \moodle_exception
 | 
			
		||||
     */
 | 
			
		||||
@@ -152,6 +177,8 @@ final class local_webhooks_api_testcase extends advanced_testcase {
 | 
			
		||||
    /**
 | 
			
		||||
     * Testing get to the list services.
 | 
			
		||||
     *
 | 
			
		||||
     * @group local_webhooks
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \dml_exception
 | 
			
		||||
     * @throws \moodle_exception
 | 
			
		||||
     */
 | 
			
		||||
@@ -199,6 +226,8 @@ final class local_webhooks_api_testcase extends advanced_testcase {
 | 
			
		||||
    /**
 | 
			
		||||
     * Testing get to the list services by event name.
 | 
			
		||||
     *
 | 
			
		||||
     * @group local_webhooks
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \dml_exception
 | 
			
		||||
     * @throws \moodle_exception
 | 
			
		||||
     */
 | 
			
		||||
@@ -236,6 +265,8 @@ final class local_webhooks_api_testcase extends advanced_testcase {
 | 
			
		||||
    /**
 | 
			
		||||
     * Testing get to the list services with conditions.
 | 
			
		||||
     *
 | 
			
		||||
     * @group local_webhooks
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \dml_exception
 | 
			
		||||
     * @throws \moodle_exception
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user