Issue #41 - Changed assertNotFalse (not available in older phpunit) to assertTrue(is_object()) to check if events are not false (not found).

This commit is contained in:
Daniel Thee Roperto
2016-09-21 12:24:29 +10:00
parent e6a2231ba1
commit 19b66629a8
2 changed files with 12 additions and 14 deletions

View File

@@ -22,18 +22,18 @@ defined('MOODLE_INTERNAL') || die();
/**
* Tests performed on outage class.
*
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\event\outage_created
* @covers \auth_outage\event\outage_updated
* @covers \auth_outage\event\outage_deleted
* @package auth_outage
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\event\outage_created
* @covers \auth_outage\event\outage_updated
* @covers \auth_outage\event\outage_deleted
*/
class events_test extends advanced_testcase {
public function test_save() {
global $DB;
$this->setAdminUser();
self::setAdminUser();
$this->resetAfterTest(false);
// Save new outage.
@@ -54,7 +54,7 @@ class events_test extends advanced_testcase {
'id',
IGNORE_MISSING
);
self::assertNotFalse($event);
self::assertTrue(is_object($event));
// Another test will use it.
return [$id, $event->id];
@@ -67,7 +67,7 @@ class events_test extends advanced_testcase {
public function test_update($ids) {
global $DB;
$this->setAdminUser();
self::setAdminUser();
$this->resetAfterTest(false);
list($idoutage, $idevent) = $ids;
@@ -83,7 +83,7 @@ class events_test extends advanced_testcase {
'id',
IGNORE_MISSING
);
self::assertNotFalse($event);
self::assertTrue(is_object($event));
self::assertSame($idevent, $event->id);
return $ids;
@@ -96,7 +96,7 @@ class events_test extends advanced_testcase {
public function test_delete($ids) {
global $DB;
$this->setAdminUser();
self::setAdminUser();
$this->resetAfterTest(true);
list($idoutage, $idevent) = $ids;

View File

@@ -16,7 +16,6 @@
use auth_outage\infopage_controller;
use auth_outage\models\outage;
use auth_outage\outagelib;
defined('MOODLE_INTERNAL') || die();
@@ -53,7 +52,6 @@ class infopagecontroller_test extends advanced_testcase {
$this->resetAfterTest(true);
$PAGE->set_context(context_system::instance());
$renderer = outagelib::get_renderer();
$now = time();
$outage = new outage([
'id' => 1,