diff --git a/lib/tests/accesslib_test.php b/lib/tests/accesslib_test.php index 49966c7e0ce..3edbda04189 100644 --- a/lib/tests/accesslib_test.php +++ b/lib/tests/accesslib_test.php @@ -665,7 +665,7 @@ class core_accesslib_testcase extends advanced_testcase { $this->resetAfterTest(); $allroles = get_all_roles(); - $this->assertEquals('array', gettype($allroles)); + $this->assertInternalType('array', $allroles); $this->assertCount(8, $allroles); // There are 8 roles is standard install. $role = reset($allroles); @@ -688,7 +688,7 @@ class core_accesslib_testcase extends advanced_testcase { $renames = $DB->get_records_menu('role_names', array('contextid'=>$coursecontext->id), '', 'roleid, name'); $allroles = get_all_roles($coursecontext); - $this->assertEquals('array', gettype($allroles)); + $this->assertInternalType('array', $allroles); $this->assertCount(9, $allroles); $role = reset($allroles); $role = (array)$role; @@ -848,13 +848,13 @@ class core_accesslib_testcase extends advanced_testcase { foreach ($archetypes as $archetype) { $result = get_default_role_archetype_allows('assign', $archetype); - $this->assertEquals('array', gettype($result)); + $this->assertInternalType('array', $result); $result = get_default_role_archetype_allows('override', $archetype); - $this->assertEquals('array', gettype($result)); + $this->assertInternalType('array', $result); $result = get_default_role_archetype_allows('switch', $archetype); - $this->assertEquals('array', gettype($result)); + $this->assertInternalType('array', $result); } $result = get_default_role_archetype_allows('assign', ''); @@ -1193,7 +1193,7 @@ class core_accesslib_testcase extends advanced_testcase { $alllevels = context_helper::get_all_levels(); foreach ($archetypes as $archetype) { $defaults = get_default_contextlevels($archetype); - $this->assertEquals('array', gettype($defaults)); + $this->assertInternalType('array', $defaults); foreach ($defaults as $level) { $this->assertTrue(isset($alllevels[$level])); } diff --git a/lib/tests/moodlelib_test.php b/lib/tests/moodlelib_test.php index 996a45f26f4..405958d1295 100644 --- a/lib/tests/moodlelib_test.php +++ b/lib/tests/moodlelib_test.php @@ -1898,37 +1898,37 @@ class core_moodlelib_testcase extends advanced_testcase { $yes = get_string('yes'); $yesexpected = 'Yes'; - $this->assertSame('string', gettype($yes)); + $this->assertInternalType('string', $yes); $this->assertSame($yesexpected, $yes); $yes = get_string('yes', 'moodle'); - $this->assertSame('string', gettype($yes)); + $this->assertInternalType('string', $yes); $this->assertSame($yesexpected, $yes); $yes = get_string('yes', 'core'); - $this->assertSame('string', gettype($yes)); + $this->assertInternalType('string', $yes); $this->assertSame($yesexpected, $yes); $yes = get_string('yes', ''); - $this->assertSame('string', gettype($yes)); + $this->assertInternalType('string', $yes); $this->assertSame($yesexpected, $yes); $yes = get_string('yes', null); - $this->assertSame('string', gettype($yes)); + $this->assertInternalType('string', $yes); $this->assertSame($yesexpected, $yes); $yes = get_string('yes', null, 1); - $this->assertSame('string', gettype($yes)); + $this->assertInternalType('string', $yes); $this->assertSame($yesexpected, $yes); $days = 1; $numdays = get_string('numdays', 'core', '1'); $numdaysexpected = $days.' days'; - $this->assertSame('string', gettype($numdays)); + $this->assertInternalType('string', $numdays); $this->assertSame($numdaysexpected, $numdays); $yes = get_string('yes', null, null, true); - $this->assertSame('lang_string', get_class($yes)); + $this->assertInstanceOf('lang_string', $yes); $this->assertSame($yesexpected, (string)$yes); // Test using a lang_string object as the $a argument for a normal @@ -1936,7 +1936,7 @@ class core_moodlelib_testcase extends advanced_testcase { $test = new lang_string('yes', null, null, true); $testexpected = get_string('numdays', 'core', get_string('yes')); $testresult = get_string('numdays', null, $test); - $this->assertSame('string', gettype($testresult)); + $this->assertInternalType('string', $testresult); $this->assertSame($testexpected, $testresult); // Test using a lang_string object as the $a argument for an object @@ -1944,7 +1944,7 @@ class core_moodlelib_testcase extends advanced_testcase { $test = new lang_string('yes', null, null, true); $testexpected = get_string('numdays', 'core', get_string('yes')); $testresult = get_string('numdays', null, $test, true); - $this->assertSame('lang_string', get_class($testresult)); + $this->assertInstanceOf('lang_string', $testresult); $this->assertSame($testexpected, "$testresult"); // Make sure that object properties that can't be converted don't cause diff --git a/lib/tests/pluginlib_test.php b/lib/tests/pluginlib_test.php index a6a793c03d4..d6f47d135fb 100644 --- a/lib/tests/pluginlib_test.php +++ b/lib/tests/pluginlib_test.php @@ -52,7 +52,7 @@ class core_plugin_manager_testcase extends advanced_testcase { public function test_get_plugins_of_type() { $pluginman = testable_plugin_manager::instance(); $mods = $pluginman->get_plugins_of_type('mod'); - $this->assertSame('array', gettype($mods)); + $this->assertInternalType('array', $mods); $this->assertCount(5, $mods); $this->assertInstanceOf('testable_plugininfo_mod', $mods['foo']); $this->assertInstanceOf('testable_plugininfo_mod', $mods['bar']); @@ -76,7 +76,7 @@ class core_plugin_manager_testcase extends advanced_testcase { public function test_get_plugins() { $pluginman = testable_plugin_manager::instance(); $plugins = $pluginman->get_plugins(); - $this->assertSame('array', gettype($plugins)); + $this->assertInternalType('array', $plugins); $this->assertTrue(isset($plugins['mod']['foo'])); $this->assertTrue(isset($plugins['mod']['bar'])); $this->assertTrue(isset($plugins['mod']['baz'])); @@ -98,16 +98,16 @@ class core_plugin_manager_testcase extends advanced_testcase { $this->assertSame(array(), $pluginman->get_subplugins_of_plugin('mod_missing')); $this->assertSame(array(), $pluginman->get_subplugins_of_plugin('mod_bar')); $foosubs = $pluginman->get_subplugins_of_plugin('mod_foo'); - $this->assertSame('array', gettype($foosubs)); + $this->assertInternalType('array', $foosubs); $this->assertCount(2, $foosubs); $this->assertInstanceOf('testable_pluginfo_foolish', $foosubs['foolish_frog']); $this->assertInstanceOf('testable_pluginfo_foolish', $foosubs['foolish_hippo']); $bazsubs = $pluginman->get_subplugins_of_plugin('mod_baz'); - $this->assertSame('array', gettype($bazsubs)); + $this->assertInternalType('array', $bazsubs); $this->assertCount(1, $bazsubs); $this->assertInstanceOf('testable_pluginfo_bazmeg', $bazsubs['bazmeg_one']); $quxsubs = $pluginman->get_subplugins_of_plugin('mod_qux'); - $this->assertSame('array', gettype($quxsubs)); + $this->assertInternalType('array', $quxsubs); $this->assertCount(1, $quxsubs); $this->assertInstanceOf('testable_pluginfo_quxcat', $quxsubs['quxcat_one']); } @@ -229,7 +229,7 @@ class core_plugin_manager_testcase extends advanced_testcase { $pluginman = testable_plugin_manager::instance(); $plugins = $pluginman->get_plugins(); $this->assertNull($plugins['mod']['bar']->available_updates()); - $this->assertSame('array', gettype($plugins['mod']['foo']->available_updates())); + $this->assertInternalType('array', $plugins['mod']['foo']->available_updates()); foreach ($plugins['mod']['foo']->available_updates() as $availableupdate) { $this->assertInstanceOf('available_update_info', $availableupdate); } @@ -377,7 +377,7 @@ class core_available_update_checker_testcase extends advanced_testcase { $old = array(); $new = array(); $cmp = $provider->compare_responses($old, $new); - $this->assertSame('array', gettype($cmp)); + $this->assertInternalType('array', $cmp); $this->assertEmpty($cmp); } @@ -394,7 +394,7 @@ class core_available_update_checker_testcase extends advanced_testcase { ) ); $cmp = $provider->compare_responses($old, $new); - $this->assertSame('array', gettype($cmp)); + $this->assertInternalType('array', $cmp); $this->assertNotEmpty($cmp); $this->assertTrue(isset($cmp['core'][0]['version'])); $this->assertEquals(2012060103, $cmp['core'][0]['version']); @@ -420,7 +420,7 @@ class core_available_update_checker_testcase extends advanced_testcase { ) ); $cmp = $provider->compare_responses($old, $new); - $this->assertSame('array', gettype($cmp)); + $this->assertInternalType('array', $cmp); $this->assertEmpty($cmp); } @@ -453,7 +453,7 @@ class core_available_update_checker_testcase extends advanced_testcase { ) ); $cmp = $provider->compare_responses($old, $new); - $this->assertSame('array', gettype($cmp)); + $this->assertInternalType('array', $cmp); $this->assertNotEmpty($cmp); $this->assertCount(1, $cmp); $this->assertCount(1, $cmp['core']); @@ -481,7 +481,7 @@ class core_available_update_checker_testcase extends advanced_testcase { ) ); $cmp = $provider->compare_responses($old, $new); - $this->assertSame('array', gettype($cmp)); + $this->assertInternalType('array', $cmp); $this->assertNotEmpty($cmp); $this->assertCount(1, $cmp); $this->assertCount(1, $cmp['mod_foo']);