MDL-67673 phpunit: Remove deprecated assertEquals() params
The optional parameters of assertEquals() and assertNotEquals() are deprecated in PHPUnit 8 (to be removed in PHPUnit 9): - delta => use assertEqualsWithDelta() - canonicalize => use assertEqualsCanonicalizing() - ignoreCase => use assertEqualsIgnoringCase - maxDepth => removed without replacement. More info @ https://github.com/sebastianbergmann/phpunit/issues/3341 Initial search done with: ag 'assert(Not)?Equals\(.*,.*,' --php Then, running tests and fixing remaining cases.
This commit is contained in:
+13
-15
@@ -98,7 +98,7 @@ class core_blocklib_testcase extends advanced_testcase {
|
||||
// Exercise SUT.
|
||||
$this->blockmanager->add_regions($regions, false);
|
||||
// Validate.
|
||||
$this->assertEquals($regions, $this->blockmanager->get_regions(), '', 0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($regions, $this->blockmanager->get_regions());
|
||||
}
|
||||
|
||||
public function test_add_region_twice() {
|
||||
@@ -106,7 +106,7 @@ class core_blocklib_testcase extends advanced_testcase {
|
||||
$this->blockmanager->add_region('a-region-name', false);
|
||||
$this->blockmanager->add_region('another-region', false);
|
||||
// Validate.
|
||||
$this->assertEquals(array('a-region-name', 'another-region'), $this->blockmanager->get_regions(), '', 0, 10, true);
|
||||
$this->assertEqualsCanonicalizing(array('a-region-name', 'another-region'), $this->blockmanager->get_regions());
|
||||
}
|
||||
|
||||
public function test_cannot_add_region_after_loaded() {
|
||||
@@ -142,7 +142,7 @@ class core_blocklib_testcase extends advanced_testcase {
|
||||
// Exercise SUT.
|
||||
$this->blockmanager->add_regions($regions);
|
||||
// Validate.
|
||||
$this->assertEquals($regions, $this->blockmanager->get_regions(), '', 0, 10, true);
|
||||
$this->assertEqualsCanonicalizing($regions, $this->blockmanager->get_regions());
|
||||
$this->assertTrue(isset($SESSION->custom_block_regions));
|
||||
$this->assertArrayHasKey('phpunit-block-test', $SESSION->custom_block_regions);
|
||||
$this->assertTrue(in_array('another-custom-region', $SESSION->custom_block_regions['phpunit-block-test']));
|
||||
@@ -156,11 +156,9 @@ class core_blocklib_testcase extends advanced_testcase {
|
||||
$this->blockmanager->add_region('a-custom-region-name');
|
||||
$this->blockmanager->add_region('another-custom-region');
|
||||
// Validate.
|
||||
$this->assertEquals(
|
||||
$this->assertEqualsCanonicalizing(
|
||||
array('a-custom-region-name', 'another-custom-region'),
|
||||
$this->blockmanager->get_regions(),
|
||||
'', 0, 10, true
|
||||
);
|
||||
$this->blockmanager->get_regions());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,17 +196,17 @@ class core_blocklib_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
public function test_matching_page_type_patterns() {
|
||||
$this->assertEquals(array('site-index', 'site-index-*', 'site-*', '*'),
|
||||
matching_page_type_patterns('site-index'), '', 0, 10, true);
|
||||
$this->assertEqualsCanonicalizing(array('site-index', 'site-index-*', 'site-*', '*'),
|
||||
matching_page_type_patterns('site-index'));
|
||||
|
||||
$this->assertEquals(array('mod-quiz-report-overview', 'mod-quiz-report-overview-*', 'mod-quiz-report-*', 'mod-quiz-*', 'mod-*', '*'),
|
||||
matching_page_type_patterns('mod-quiz-report-overview'), '', 0, 10, true);
|
||||
$this->assertEqualsCanonicalizing(array('mod-quiz-report-overview', 'mod-quiz-report-overview-*', 'mod-quiz-report-*', 'mod-quiz-*', 'mod-*', '*'),
|
||||
matching_page_type_patterns('mod-quiz-report-overview'));
|
||||
|
||||
$this->assertEquals(array('mod-forum-view', 'mod-*-view', 'mod-forum-view-*', 'mod-forum-*', 'mod-*', '*'),
|
||||
matching_page_type_patterns('mod-forum-view'), '', 0, 10, true);
|
||||
$this->assertEqualsCanonicalizing(array('mod-forum-view', 'mod-*-view', 'mod-forum-view-*', 'mod-forum-*', 'mod-*', '*'),
|
||||
matching_page_type_patterns('mod-forum-view'));
|
||||
|
||||
$this->assertEquals(array('mod-forum-index', 'mod-*-index', 'mod-forum-index-*', 'mod-forum-*', 'mod-*', '*'),
|
||||
matching_page_type_patterns('mod-forum-index'), '', 0, 10, true);
|
||||
$this->assertEqualsCanonicalizing(array('mod-forum-index', 'mod-*-index', 'mod-forum-index-*', 'mod-forum-*', 'mod-*', '*'),
|
||||
matching_page_type_patterns('mod-forum-index'));
|
||||
}
|
||||
|
||||
protected function get_a_page_and_block_manager($regions, $context, $pagetype, $subpage = '') {
|
||||
|
||||
Reference in New Issue
Block a user