mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-36411 make sure asserts in setUp() do not cause problems
This commit is contained in:
parent
a5ec499521
commit
6a8e467916
@ -35,6 +35,15 @@ defined('MOODLE_INTERNAL') || die();
|
|||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
class core_phpunit_basic_testcase extends basic_testcase {
|
class core_phpunit_basic_testcase extends basic_testcase {
|
||||||
|
protected $testassertexecuted = false;
|
||||||
|
|
||||||
|
public function setUp() {
|
||||||
|
if ($this->getName() === 'test_setup_assert') {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
$this->testassertexecuted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that bootstrapping has occurred correctly
|
* Tests that bootstrapping has occurred correctly
|
||||||
@ -113,6 +122,14 @@ class core_phpunit_basic_testcase extends basic_testcase {
|
|||||||
$this->assertNotEmpty(new stdClass());
|
$this->assertNotEmpty(new stdClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure asserts in setUp() do not create problems.
|
||||||
|
*/
|
||||||
|
public function test_setup_assert() {
|
||||||
|
$this->assertTrue($this->testassertexecuted);
|
||||||
|
$this->testassertexecuted = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Uncomment following tests to see logging of unexpected changes in global state and database
|
// Uncomment following tests to see logging of unexpected changes in global state and database
|
||||||
/*
|
/*
|
||||||
public function test_db_modification() {
|
public function test_db_modification() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user