Fixed errors from CI

Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
2019-05-08 01:17:40 +04:00
parent eb4b9b69f8
commit e2627eaf86
4 changed files with 48 additions and 22 deletions

View File

@ -36,6 +36,9 @@ final class local_webhooks_task_testcase extends advanced_testcase {
* Testing add a task to the queue.
*/
public function test_add_task() {
global $DB;
$DB->delete_records('task_adhoc');
$this->resetAfterTest();
manager::queue_adhoc_task(new notify());
@ -53,6 +56,9 @@ final class local_webhooks_task_testcase extends advanced_testcase {
* @throws \dml_exception
*/
public function test_execute_disabled() {
global $DB;
$DB->delete_records('task_adhoc');
curl::mock_response('{}');
$this->resetAfterTest();
@ -80,6 +86,9 @@ final class local_webhooks_task_testcase extends advanced_testcase {
* @throws \dml_exception
*/
public function test_execute_enabled() {
global $DB;
$DB->delete_records('task_adhoc');
curl::mock_response('{}');
$this->resetAfterTest();
@ -116,10 +125,14 @@ final class local_webhooks_task_testcase extends advanced_testcase {
* @throws \dml_exception
*/
public function test_observer_multiple() {
$generator = self::getDataGenerator();
global $DB;
$DB->delete_records('task_adhoc');
curl::mock_response('{}');
$this->resetAfterTest();
$generator = self::getDataGenerator();
$record = new record();
$record->events = ['\core\event\course_created'];
$record->header = 'application/json';
@ -159,10 +172,14 @@ final class local_webhooks_task_testcase extends advanced_testcase {
* @throws \dml_exception
*/
public function test_observer_single() {
$generator = self::getDataGenerator();
global $DB;
$DB->delete_records('task_adhoc');
curl::mock_response('{}');
$this->resetAfterTest();
$generator = self::getDataGenerator();
$record = new record();
$record->events = ['\core\event\course_created'];
$record->header = 'application/json';