Differences Between: [Versions 310 and 403] [Versions 39 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 namespace mod_lti\event; 18 19 /** 20 * Unknown service API called event tests 21 * 22 * @package mod_lti 23 * @copyright Copyright (c) 2012 Moodlerooms Inc. (http://www.moodlerooms.com) 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 class unknown_service_api_called_test extends \advanced_testcase { 27 /* 28 * Ensure create event works. 29 */ 30 public function test_create_event() { 31 $event = unknown_service_api_called::create(); 32 $this->assertInstanceOf('\mod_lti\event\unknown_service_api_called', $event); 33 } 34 35 /* 36 * Ensure event context works. 37 */ 38 public function test_event_context() { 39 $event = unknown_service_api_called::create(); 40 $this->assertEquals(\context_system::instance(), $event->get_context()); 41 } 42 43 /* 44 * Ensure we can trigger the event. 45 */ 46 public function test_trigger_event() { 47 $event = unknown_service_api_called::create(); 48 49 $sink = $this->redirectEvents(); 50 $event->trigger(); 51 $events = $sink->get_events(); 52 $this->assertCount(1, $events); 53 } 54 55 /* 56 * Ensure get/set message data is functioning as expected. 57 */ 58 public function test_get_message_data() { 59 $data = (object) array( 60 'foo' => 'bar', 61 'bat' => 'baz', 62 ); 63 64 /* 65 * @var unknown_service_api_called $event 66 */ 67 $event = unknown_service_api_called::create(); 68 $event->set_message_data($data); 69 $this->assertSame($data, $event->get_message_data()); 70 } 71 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body