MDL-67673 phpunit: Remove deprecated assertInternalType()
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 2 Aug 2020 11:08:42 +0000 (13:08 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 21 Oct 2020 10:45:59 +0000 (12:45 +0200)
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

assertInternalType() is deprecated and will be removed in
PHPUnit 9. Refactor your test to use assertIsArray(), assertIsBool(),
assertIsFloat(), assertIsInt(), assertIsNumeric(), assertIsObject(),
assertIsResource(), assertIsString(), assertIsScalar(),
assertIsCallable(), or assertIsIterable() instead.

33 files changed:
admin/tool/installaddon/tests/installer_test.php
admin/tool/log/tests/manager_test.php
admin/tool/usertours/tests/cache_test.php
analytics/tests/model_test.php
badges/tests/badgeslib_test.php
cache/tests/administration_helper_test.php
cache/tests/cache_test.php
cache/tests/config_writer_test.php
cache/tests/fixtures/stores.php
course/tests/courselib_test.php
course/tests/management_helper_test.php
files/tests/conversion_test.php
iplookup/tests/geoip_test.php
lib/dml/tests/dml_test.php
lib/form/tests/external_test.php
lib/form/tests/filetypes_util_test.php
lib/phpunit/tests/advanced_test.php
lib/tests/accesslib_test.php
lib/tests/jquery_test.php
lib/tests/moodlelib_test.php
lib/tests/plugin_manager_test.php
lib/tests/scheduled_task_test.php
lib/tests/update_checker_test.php
lib/tests/update_code_manager_test.php
lib/tests/update_validator_test.php
mod/forum/tests/subscriptions_test.php
mod/wiki/tests/externallib_test.php
privacy/tests/manager_test.php
privacy/tests/provider_test.php
privacy/tests/request_transform_test.php
question/type/calculated/tests/formula_validation_test.php
repository/tests/repositorylib_test.php
user/tests/userlib_test.php

index 55a0608..cff9578 100644 (file)
@@ -44,7 +44,7 @@ class tool_installaddon_installer_testcase extends advanced_testcase {
         $this->assertEquals(1, preg_match('~^site=(.+)$~', $query, $matches));
         $site = rawurldecode($matches[1]);
         $site = json_decode(base64_decode($site), true);
-        $this->assertInternalType('array', $site);
+        $this->assertIsArray($site);
         $this->assertEquals(3, count($site));
         $this->assertSame('Nasty site', $site['fullname']);
         $this->assertSame('file:///etc/passwd', $site['url']);
index e9e3164..1cd1a92 100644 (file)
@@ -33,7 +33,7 @@ class tool_log_manager_testcase extends advanced_testcase {
         $this->assertInstanceOf('core\log\manager', $manager);
 
         $stores = $manager->get_readers();
-        $this->assertInternalType('array', $stores);
+        $this->assertIsArray($stores);
         $this->assertCount(0, $stores);
 
         $this->assertFileExists("$CFG->dirroot/$CFG->admin/tool/log/store/standard/version.php");
@@ -44,27 +44,27 @@ class tool_log_manager_testcase extends advanced_testcase {
         $this->assertInstanceOf('core\log\manager', $manager);
 
         $stores = $manager->get_readers();
-        $this->assertInternalType('array', $stores);
+        $this->assertIsArray($stores);
         $this->assertCount(2, $stores);
         foreach ($stores as $key => $store) {
-            $this->assertInternalType('string', $key);
+            $this->assertIsString($key);
             $this->assertInstanceOf('core\log\sql_reader', $store);
         }
 
         $stores = $manager->get_readers('core\log\sql_internal_table_reader');
-        $this->assertInternalType('array', $stores);
+        $this->assertIsArray($stores);
         $this->assertCount(1, $stores);
         foreach ($stores as $key => $store) {
-            $this->assertInternalType('string', $key);
+            $this->assertIsString($key);
             $this->assertSame('logstore_standard', $key);
             $this->assertInstanceOf('core\log\sql_internal_table_reader', $store);
         }
 
         $stores = $manager->get_readers('core\log\sql_reader');
-        $this->assertInternalType('array', $stores);
+        $this->assertIsArray($stores);
         $this->assertCount(2, $stores);
         foreach ($stores as $key => $store) {
-            $this->assertInternalType('string', $key);
+            $this->assertIsString($key);
             $this->assertInstanceOf('core\log\sql_reader', $store);
         }
     }
index 4e0c2b1..557e075 100644 (file)
@@ -248,7 +248,7 @@ class cache_testcase extends advanced_testcase {
         $tour = $this->helper_create_tour((object)['enabled' => false]);
 
         $data = \tool_usertours\cache::get_stepdata($tour->get_id());
-        $this->assertInternalType('array', $data);
+        $this->assertIsArray($data);
         $this->assertEmpty($data);
     }
 
@@ -265,11 +265,11 @@ class cache_testcase extends advanced_testcase {
         $tour2 = $this->helper_create_tour((object)['enabled' => false]);
 
         $data = \tool_usertours\cache::get_stepdata($tour1->get_id());
-        $this->assertInternalType('array', $data);
+        $this->assertIsArray($data);
         $this->assertCount(3, $data);
 
         $data = \tool_usertours\cache::get_stepdata($tour2->get_id());
-        $this->assertInternalType('array', $data);
+        $this->assertIsArray($data);
         $this->assertEmpty($data);
     }
 
@@ -292,7 +292,7 @@ class cache_testcase extends advanced_testcase {
         $steps[0]->set_sortorder(10)->persist();
 
         $data = \tool_usertours\cache::get_stepdata($tour->get_id());
-        $this->assertInternalType('array', $data);
+        $this->assertIsArray($data);
         $this->assertCount(4, $data);
 
         // Re-order the steps.
index a1004fb..c4a5c5c 100644 (file)
@@ -424,7 +424,7 @@ class analytics_model_testcase extends advanced_testcase {
         $modeldata = $method->invoke($modelconfig);
 
         $this->assertArrayHasKey('core', $modeldata->dependencies);
-        $this->assertInternalType('float', $modeldata->dependencies['core']);
+        $this->assertIsFloat($modeldata->dependencies['core']);
         $this->assertNotEmpty($modeldata->target);
         $this->assertNotEmpty($modeldata->timesplitting);
         $this->assertCount(3, $modeldata->indicators);
index 0dac8de..4c5c059 100644 (file)
@@ -385,7 +385,7 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
 
         // Make sure the first user has no badges.
         $result = badges_get_user_badges($user1->id);
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(0, $result);
 
         // Check that the second user has the expected 11 badges.
index b392114..3941871 100644 (file)
@@ -74,7 +74,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase {
         )));
 
         $storesummaries = core_cache\administration_helper::get_store_instance_summaries();
-        $this->assertInternalType('array', $storesummaries);
+        $this->assertIsArray($storesummaries);
         $this->assertArrayHasKey('summariesstore', $storesummaries);
         $summary = $storesummaries['summariesstore'];
         // Check the keys
@@ -100,7 +100,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase {
         $this->assertEquals($mappingcount, $summary['mappings']);
 
         $definitionsummaries = core_cache\administration_helper::get_definition_summaries();
-        $this->assertInternalType('array', $definitionsummaries);
+        $this->assertIsArray($definitionsummaries);
         $this->assertArrayHasKey('core/eventinvalidation', $definitionsummaries);
         $summary = $definitionsummaries['core/eventinvalidation'];
         // Check the keys
@@ -116,11 +116,11 @@ class core_cache_administration_helper_testcase extends advanced_testcase {
         $this->assertEquals(cache_store::MODE_APPLICATION, $summary['mode']);
         $this->assertEquals('core', $summary['component']);
         $this->assertEquals('eventinvalidation', $summary['area']);
-        $this->assertInternalType('array', $summary['mappings']);
+        $this->assertIsArray($summary['mappings']);
         $this->assertContains('summariesstore', $summary['mappings']);
 
         $pluginsummaries = core_cache\administration_helper::get_store_plugin_summaries();
-        $this->assertInternalType('array', $pluginsummaries);
+        $this->assertIsArray($pluginsummaries);
         $this->assertArrayHasKey('file', $pluginsummaries);
         $summary = $pluginsummaries['file'];
         // Check the keys
@@ -132,18 +132,18 @@ class core_cache_administration_helper_testcase extends advanced_testcase {
         $this->assertArrayHasKey('canaddinstance', $summary);
 
         $locksummaries = core_cache\administration_helper::get_lock_summaries();
-        $this->assertInternalType('array', $locksummaries);
+        $this->assertIsArray($locksummaries);
         $this->assertTrue(count($locksummaries) > 0);
 
         $mappings = core_cache\administration_helper::get_default_mode_stores();
-        $this->assertInternalType('array', $mappings);
+        $this->assertIsArray($mappings);
         $this->assertCount(3, $mappings);
         $this->assertArrayHasKey(cache_store::MODE_APPLICATION, $mappings);
-        $this->assertInternalType('array', $mappings[cache_store::MODE_APPLICATION]);
+        $this->assertIsArray($mappings[cache_store::MODE_APPLICATION]);
         $this->assertContains('summariesstore', $mappings[cache_store::MODE_APPLICATION]);
 
         $potentials = core_cache\administration_helper::get_definition_store_options('core', 'eventinvalidation');
-        $this->assertInternalType('array', $potentials); // Currently used, suitable, default
+        $this->assertIsArray($potentials); // Currently used, suitable, default
         $this->assertCount(3, $potentials);
         $this->assertArrayHasKey('summariesstore', $potentials[0]);
         $this->assertArrayHasKey('summariesstore', $potentials[1]);
index ffbb1df..7d9c52f 100644 (file)
@@ -122,7 +122,7 @@ class core_cache_testcase extends advanced_testcase {
         $this->assertCount(3, $stores);
         foreach ($stores as $name => $store) {
             // Check its an array.
-            $this->assertInternalType('array', $store);
+            $this->assertIsArray($store);
             // Check the name is the key.
             $this->assertEquals($name, $store['name']);
             // Check that it has been declared default.
@@ -370,11 +370,11 @@ class core_cache_testcase extends advanced_testcase {
             'key1' => array(1, 2, 3),
             'key2' => array(3, 2, 1),
         ));
-        $this->assertInternalType('array', $cache->get('key1'));
-        $this->assertInternalType('array', $cache->get('key2'));
+        $this->assertIsArray($cache->get('key1'));
+        $this->assertIsArray($cache->get('key2'));
         $this->assertCount(3, $cache->get('key1'));
         $this->assertCount(3, $cache->get('key2'));
-        $this->assertInternalType('array', $cache->get_many(array('key1', 'key2')));
+        $this->assertIsArray($cache->get_many(array('key1', 'key2')));
         $this->assertCount(2, $cache->get_many(array('key1', 'key2')));
         $this->assertEquals(2, $cache->delete_many(array('key1', 'key2')));
 
@@ -539,7 +539,7 @@ class core_cache_testcase extends advanced_testcase {
         $this->assertTrue($cache->purge());
         $this->assertTrue($cache->set('b', 'B'));
         $result = $cache->get_many(array('a', 'b', 'c'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('b', $result);
@@ -675,7 +675,7 @@ class core_cache_testcase extends advanced_testcase {
         // Test with multiple keys.
         $this->assertEquals(3, $cache->set_many(array('a' => 'A', 'b' => 'B', 'c' => 'C')));
         $result = $cache->get_many(array('a', 'b', 'c'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('b', $result);
@@ -686,7 +686,7 @@ class core_cache_testcase extends advanced_testcase {
 
         // Test with multiple keys including missing ones.
         $result = $cache->get_many(array('a', 'c', 'e'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('c', $result);
@@ -724,7 +724,7 @@ class core_cache_testcase extends advanced_testcase {
         // Test with multiple keys.
         $this->assertEquals(3, $cache->set_many(array('a' => 'A', 'b' => 'B', 'c' => 'C')));
         $result = $cache->get_many(array('a', 'b', 'c'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('b', $result);
@@ -735,7 +735,7 @@ class core_cache_testcase extends advanced_testcase {
 
         // Test with multiple keys including missing ones.
         $result = $cache->get_many(array('a', 'c', 'e'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('c', $result);
@@ -773,7 +773,7 @@ class core_cache_testcase extends advanced_testcase {
         // Test with multiple keys.
         $this->assertEquals(3, $cache->set_many(array('a' => 'A', 'b' => 'B', 'c' => 'C')));
         $result = $cache->get_many(array('a', 'b', 'c'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('b', $result);
@@ -784,7 +784,7 @@ class core_cache_testcase extends advanced_testcase {
 
         // Test with multiple keys including missing ones.
         $result = $cache->get_many(array('a', 'c', 'e'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('c', $result);
@@ -1401,7 +1401,7 @@ class core_cache_testcase extends advanced_testcase {
         // Test the many commands.
         $this->assertEquals(3, $cache->set_many(array('a' => 'A', 'b' => 'B', 'c' => 'C')));
         $result = $cache->get_many(array('a', 'b', 'c'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('b', $result);
@@ -1412,7 +1412,7 @@ class core_cache_testcase extends advanced_testcase {
         $this->assertEquals($result, $cache->get_many(array('a', 'b', 'c')));
         $this->assertEquals(2, $cache->delete_many(array('a', 'c')));
         $result = $cache->get_many(array('a', 'b', 'c'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('b', $result);
@@ -1470,7 +1470,7 @@ class core_cache_testcase extends advanced_testcase {
         // Test the many commands.
         $this->assertEquals(3, $cache->set_many(array('a' => 'A', 'b' => 'B', 'c' => 'C')));
         $result = $cache->get_many(array('a', 'b', 'c'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('b', $result);
@@ -1481,7 +1481,7 @@ class core_cache_testcase extends advanced_testcase {
         $this->assertEquals($result, $cache->get_many(array('a', 'b', 'c')));
         $this->assertEquals(2, $cache->delete_many(array('a', 'c')));
         $result = $cache->get_many(array('a', 'b', 'c'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(3, $result);
         $this->assertArrayHasKey('a', $result);
         $this->assertArrayHasKey('b', $result);
index 8fa28d7..a88aa10 100644 (file)
@@ -270,7 +270,7 @@ class core_cache_config_writer_testcase extends advanced_testcase {
 
         $config = cache_config_writer::instance();
         $this->assertTrue($config->add_store_instance('setdefinitiontest', 'file'));
-        $this->assertInternalType('array', $config->get_definition_by_id('phpunit/testdefinition'));
+        $this->assertIsArray($config->get_definition_by_id('phpunit/testdefinition'));
         $config->set_definition_mappings('phpunit/testdefinition', array('setdefinitiontest', 'default_application'));
 
         try {
index b266f4e..36329c4 100644 (file)
@@ -131,16 +131,16 @@ abstract class cachestore_tests extends advanced_testcase {
 
         // Test get with an int.
         $this->assertSame(1, $instance->get('test1'));
-        $this->assertInternalType('int', $instance->get('test1'));
+        $this->assertIsInt($instance->get('test1'));
         $this->assertSame(2, $instance->get('test2'));
-        $this->assertInternalType('int', $instance->get('test2'));
+        $this->assertIsInt($instance->get('test2'));
 
         // Test set with a bool.
         $this->assertTrue($instance->set('test1', true));
 
         // Test get with an bool.
         $this->assertSame(true, $instance->get('test1'));
-        $this->assertInternalType('boolean', $instance->get('test1'));
+        $this->assertIsBool($instance->get('test1'));
 
         // Test with an object.
         $this->assertTrue($instance->set('obj', $object));
@@ -177,7 +177,7 @@ abstract class cachestore_tests extends advanced_testcase {
 
         // Test get_many.
         $result = $instance->get_many(array('many1', 'many3', 'many5', 'many6'));
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertCount(4, $result);
         $this->assertSame(array(
             'many1' => 'many1',
index 8f00f15..3ba00bd 100644 (file)
@@ -2807,7 +2807,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         $caps = course_capability_assignment::allow('moodle/category:manage', $roleid, $context->id);
 
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -2815,7 +2815,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         // Test moving down.
         $this->assertTrue(course_change_sortorder_after_course($course1->id, $course3->id));
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course2->id, $course3->id, $course1->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -2823,7 +2823,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         // Test moving up.
         $this->assertTrue(course_change_sortorder_after_course($course1->id, $course2->id));
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course2->id, $course1->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -2831,7 +2831,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         // Test moving to the top.
         $this->assertTrue(course_change_sortorder_after_course($course1->id, 0));
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -2878,7 +2878,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         $course1 = $generator->create_course(array('category' => $category->id));
 
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -2887,7 +2887,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         $course1 = get_course($course1->id);
         $this->assertTrue(course_change_sortorder_by_one($course1, false));
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course2->id, $course1->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -2896,7 +2896,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         $course1 = get_course($course1->id);
         $this->assertTrue(course_change_sortorder_by_one($course1, true));
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -2906,7 +2906,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         $this->assertFalse(course_change_sortorder_by_one($course1, true));
         // Check nothing changed.
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -2916,7 +2916,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         $this->assertFalse(course_change_sortorder_by_one($course3, false));
         // Check nothing changed.
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
index 2af8193..ea3c2c2 100644 (file)
@@ -681,14 +681,14 @@ class core_course_management_helper_test extends advanced_testcase {
 
         // Check that sort order in the DB matches what we've got in the cache.
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
 
         // Resort by fullname.
         \core_course\management\helper::action_category_resort_courses($category, 'fullname');
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course3->id, $course1->id, $course2->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -696,7 +696,7 @@ class core_course_management_helper_test extends advanced_testcase {
         // Resort by shortname.
         \core_course\management\helper::action_category_resort_courses($category, 'shortname');
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course3->id, $course2->id, $course1->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -704,7 +704,7 @@ class core_course_management_helper_test extends advanced_testcase {
         // Resort by idnumber.
         \core_course\management\helper::action_category_resort_courses($category, 'idnumber');
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course1->id, $course3->id, $course2->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -716,7 +716,7 @@ class core_course_management_helper_test extends advanced_testcase {
         } catch (coding_exception $exception) {
             // Test things are as they were before.
             $courses = $category->get_courses();
-            $this->assertInternalType('array', $courses);
+            $this->assertIsArray($courses);
             $this->assertEquals(array($course1->id, $course3->id, $course2->id), array_keys($courses));
             $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder');
             $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -729,7 +729,7 @@ class core_course_management_helper_test extends advanced_testcase {
         } catch (coding_exception $exception) {
             // Test things are as they were before.
             $courses = $category->get_courses();
-            $this->assertInternalType('array', $courses);
+            $this->assertIsArray($courses);
             $this->assertEquals(array($course1->id, $course3->id, $course2->id), array_keys($courses));
             $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder');
             $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -749,7 +749,7 @@ class core_course_management_helper_test extends advanced_testcase {
             $this->assertEquals('core_course_category::can_resort', $exception->debuginfo);
             // Test things are as they were before.
             $courses = $category->get_courses();
-            $this->assertInternalType('array', $courses);
+            $this->assertIsArray($courses);
             $this->assertEquals(array($course1->id, $course3->id, $course2->id), array_keys($courses));
             $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder');
             $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -776,14 +776,14 @@ class core_course_management_helper_test extends advanced_testcase {
         $caps = course_capability_assignment::allow(self::CATEGORY_MANAGE, $roleid, $syscontext->id);
 
         $categories = $parent->get_children();
-        $this->assertInternalType('array', $categories);
+        $this->assertIsArray($categories);
         $dbcategories = $DB->get_records('course_categories', array('parent' => $parent->id), 'sortorder');
         $this->assertEquals(array_keys($dbcategories), array_keys($categories));
 
         // Test sorting by name.
         \core_course\management\helper::action_category_resort_subcategories($parent, 'name');
         $categories = $parent->get_children();
-        $this->assertInternalType('array', $categories);
+        $this->assertIsArray($categories);
         $this->assertEquals(array($cat3->id, $cat2->id, $cat1->id), array_keys($categories));
         $dbcategories = $DB->get_records('course_categories', array('parent' => $parent->id), 'sortorder');
         $this->assertEquals(array_keys($dbcategories), array_keys($categories));
@@ -791,7 +791,7 @@ class core_course_management_helper_test extends advanced_testcase {
         // Test sorting by idnumber.
         \core_course\management\helper::action_category_resort_subcategories($parent, 'idnumber');
         $categories = $parent->get_children();
-        $this->assertInternalType('array', $categories);
+        $this->assertIsArray($categories);
         $this->assertEquals(array($cat1->id, $cat3->id, $cat2->id), array_keys($categories));
         $dbcategories = $DB->get_records('course_categories', array('parent' => $parent->id), 'sortorder');
         $this->assertEquals(array_keys($dbcategories), array_keys($categories));
@@ -803,7 +803,7 @@ class core_course_management_helper_test extends advanced_testcase {
         } catch (coding_exception $exception) {
             // Check that nothing was changed.
             $categories = $parent->get_children();
-            $this->assertInternalType('array', $categories);
+            $this->assertIsArray($categories);
             $this->assertEquals(array($cat1->id, $cat3->id, $cat2->id), array_keys($categories));
             $dbcategories = $DB->get_records('course_categories', array('parent' => $parent->id), 'sortorder');
             $this->assertEquals(array_keys($dbcategories), array_keys($categories));
@@ -816,7 +816,7 @@ class core_course_management_helper_test extends advanced_testcase {
         } catch (coding_exception $exception) {
             // Check that nothing was changed.
             $categories = $parent->get_children();
-            $this->assertInternalType('array', $categories);
+            $this->assertIsArray($categories);
             $this->assertEquals(array($cat1->id, $cat3->id, $cat2->id), array_keys($categories));
             $dbcategories = $DB->get_records('course_categories', array('parent' => $parent->id), 'sortorder');
             $this->assertEquals(array_keys($dbcategories), array_keys($categories));
@@ -826,7 +826,7 @@ class core_course_management_helper_test extends advanced_testcase {
         $topcat = core_course_category::get(0);
         \core_course\management\helper::action_category_resort_subcategories($topcat, 'name');
         $categories = $topcat->get_children();
-        $this->assertInternalType('array', $categories);
+        $this->assertIsArray($categories);
         $dbcategories = $DB->get_records('course_categories', array('parent' => '0'), 'sortorder');
         $this->assertEquals(array_keys($dbcategories), array_keys($categories));
 
@@ -844,7 +844,7 @@ class core_course_management_helper_test extends advanced_testcase {
             $this->assertEquals('core_course_category::can_resort', $exception->debuginfo);
             // Test things are as they were before.
             $categories = $parent->get_children();
-            $this->assertInternalType('array', $categories);
+            $this->assertIsArray($categories);
             $this->assertEquals(array($cat1->id, $cat3->id, $cat2->id), array_keys($categories));
             $dbcategories = $DB->get_records('course_categories', array('parent' => $parent->id), 'sortorder');
             $this->assertEquals(array_keys($dbcategories), array_keys($categories));
@@ -1001,7 +1001,7 @@ class core_course_management_helper_test extends advanced_testcase {
         $caps = course_capability_assignment::allow(self::CATEGORY_MANAGE, $roleid, $context->id);
 
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -1012,7 +1012,7 @@ class core_course_management_helper_test extends advanced_testcase {
                 new core_course_list_element(get_course($course1->id)), $category)
         );
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course2->id, $course1->id, $course3->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -1023,7 +1023,7 @@ class core_course_management_helper_test extends advanced_testcase {
                 new core_course_list_element(get_course($course3->id)), $category)
         );
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course2->id, $course3->id, $course1->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -1033,7 +1033,7 @@ class core_course_management_helper_test extends advanced_testcase {
             \core_course\management\helper::action_course_change_sortorder_down_one_by_record(get_course($course2->id), $category)
         );
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course3->id, $course2->id, $course1->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -1043,7 +1043,7 @@ class core_course_management_helper_test extends advanced_testcase {
             \core_course\management\helper::action_course_change_sortorder_up_one_by_record(get_course($course2->id), $category)
         );
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course2->id, $course3->id, $course1->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -1054,7 +1054,7 @@ class core_course_management_helper_test extends advanced_testcase {
                 new core_course_list_element(get_course($course1->id)), $category)
         );
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course2->id, $course3->id, $course1->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -1065,7 +1065,7 @@ class core_course_management_helper_test extends advanced_testcase {
                 new core_course_list_element(get_course($course2->id)), $category)
         );
         $courses = $category->get_courses();
-        $this->assertInternalType('array', $courses);
+        $this->assertIsArray($courses);
         $this->assertEquals(array($course2->id, $course3->id, $course1->id), array_keys($courses));
         $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
         $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -1082,7 +1082,7 @@ class core_course_management_helper_test extends advanced_testcase {
         } catch (moodle_exception $exception) {
             // Check nothing has changed.
             $courses = $category->get_courses();
-            $this->assertInternalType('array', $courses);
+            $this->assertIsArray($courses);
             $this->assertEquals(array($course2->id, $course3->id, $course1->id), array_keys($courses));
             $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
             $this->assertEquals(array_keys($dbcourses), array_keys($courses));
@@ -1111,7 +1111,7 @@ class core_course_management_helper_test extends advanced_testcase {
         ), $roleid, $context->id);
 
         $actions = \core_course\management\helper::get_category_listitem_actions($category);
-        $this->assertInternalType('array', $actions);
+        $this->assertIsArray($actions);
         $this->assertArrayHasKey('edit', $actions);
         $this->assertArrayHasKey('hide', $actions);
         $this->assertArrayHasKey('show', $actions);
@@ -1147,7 +1147,7 @@ class core_course_management_helper_test extends advanced_testcase {
         ), $roleid, $context->id);
 
         $actions = \core_course\management\helper::get_course_detail_actions(new core_course_list_element($course));
-        $this->assertInternalType('array', $actions);
+        $this->assertIsArray($actions);
         $this->assertArrayHasKey('view', $actions);
         $this->assertArrayHasKey('edit', $actions);
         $this->assertArrayHasKey('enrolledusers', $actions);
@@ -1181,7 +1181,7 @@ class core_course_management_helper_test extends advanced_testcase {
         ), $roleid, $context->id);
 
         $details = \core_course\management\helper::get_course_detail_array(new core_course_list_element($course));
-        $this->assertInternalType('array', $details);
+        $this->assertIsArray($details);
         $this->assertArrayHasKey('format', $details);
         $this->assertArrayHasKey('fullname', $details);
         $this->assertArrayHasKey('shortname', $details);
index 3293bcc..c92ad0f 100644 (file)
@@ -342,7 +342,7 @@ class core_files_conversion_testcase extends advanced_testcase {
             'status' => (string) 1,
         ]);
 
-        $this->assertInternalType('integer', $conversion->get('status'));
+        $this->assertIsInt($conversion->get('status'));
     }
 
     /**
index f1a8a93..f4e2cfd 100644 (file)
@@ -62,14 +62,14 @@ class core_iplookup_geoip_testcase extends advanced_testcase {
 
         $result = iplookup_find_location($ip);
 
-        $this->assertInternalType('array', $result);
-        $this->assertInternalType('float', $result['latitude']);
-        $this->assertInternalType('float', $result['longitude']);
-        $this->assertInternalType('string', $result['city']);
-        $this->assertInternalType('string', $result['country']);
-        $this->assertInternalType('array', $result['title']);
-        $this->assertInternalType('string', $result['title'][0]);
-        $this->assertInternalType('string', $result['title'][1]);
+        $this->assertIsArray($result);
+        $this->assertIsFloat($result['latitude']);
+        $this->assertIsFloat($result['longitude']);
+        $this->assertIsString($result['city']);
+        $this->assertIsString($result['country']);
+        $this->assertIsArray($result['title']);
+        $this->assertIsString($result['title'][0]);
+        $this->assertIsString($result['title'][1]);
         $this->assertNull($result['error']);
     }
 
index d55c809..c2fc921 100644 (file)
@@ -73,7 +73,7 @@ class core_dml_testcase extends database_driver_testcase {
     public function test_get_server_info() {
         $DB = $this->tdb;
         $result = $DB->get_server_info();
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertArrayHasKey('description', $result);
         $this->assertArrayHasKey('version', $result);
     }
@@ -382,7 +382,7 @@ class core_dml_testcase extends database_driver_testcase {
         $params[] = 1;
         $params[] = time();
         $sqlarray = $DB->fix_sql_params($sql, $params);
-        $this->assertInternalType('array', $sqlarray);
+        $this->assertIsArray($sqlarray);
         $this->assertCount(3, $sqlarray[1]);
 
         // Named params missing from array.
@@ -410,7 +410,7 @@ class core_dml_testcase extends database_driver_testcase {
         $sql = "SELECT * FROM {{$tablename}} WHERE name = :name, course = :course";
         $params = array('name' => 'record1', 'course' => 1, 'extrastuff'=>'haha');
         $sqlarray = $DB->fix_sql_params($sql, $params);
-        $this->assertInternalType('array', $sqlarray);
+        $this->assertIsArray($sqlarray);
         $this->assertCount(2, $sqlarray[1]);
 
         // Params exceeding 30 chars length.
@@ -690,7 +690,7 @@ EOD;
         $dbman->create_table($table);
 
         $indices = $DB->get_indexes($tablename);
-        $this->assertInternalType('array', $indices);
+        $this->assertIsArray($indices);
         $this->assertCount(2, $indices);
         // We do not care about index names for now.
         $first = array_shift($indices);
@@ -744,7 +744,7 @@ EOD;
         $dbman->create_table($table);
 
         $columns = $DB->get_columns($tablename);
-        $this->assertInternalType('array', $columns);
+        $this->assertIsArray($columns);
 
         $fields = $table->getFields();
         $this->assertCount(count($columns), $fields);
@@ -1539,7 +1539,7 @@ EOD;
         $DB->insert_record($tablename, array('course' => 2));
 
         $records = $DB->get_records_list($tablename, 'course', array(3, 2));
-        $this->assertInternalType('array', $records);
+        $this->assertIsArray($records);
         $this->assertCount(3, $records);
         $this->assertEquals(1, reset($records)->id);
         $this->assertEquals(2, next($records)->id);
@@ -1688,7 +1688,7 @@ EOD;
         $DB->insert_record($tablename, array('course' => 2));
 
         $records = $DB->get_records_menu($tablename, array('course' => 3));
-        $this->assertInternalType('array', $records);
+        $this->assertIsArray($records);
         $this->assertCount(2, $records);
         $this->assertNotEmpty($records[1]);
         $this->assertNotEmpty($records[2]);
@@ -1716,7 +1716,7 @@ EOD;
         $DB->insert_record($tablename, array('course' => 5));
 
         $records = $DB->get_records_select_menu($tablename, "course > ?", array(2));
-        $this->assertInternalType('array', $records);
+        $this->assertIsArray($records);
 
         $this->assertCount(3, $records);
         $this->assertArrayHasKey(1, $records);
@@ -1748,7 +1748,7 @@ EOD;
         $DB->insert_record($tablename, array('course' => 5));
 
         $records = $DB->get_records_sql_menu("SELECT * FROM {{$tablename}} WHERE course > ?", array(2));
-        $this->assertInternalType('array', $records);
+        $this->assertIsArray($records);
 
         $this->assertCount(3, $records);
         $this->assertArrayHasKey(1, $records);
@@ -1964,7 +1964,7 @@ EOD;
         $DB->insert_record($tablename, array('course' => 6));
 
         $fieldset = $DB->get_fieldset_select($tablename, 'course', "course > ?", array(1));
-        $this->assertInternalType('array', $fieldset);
+        $this->assertIsArray($fieldset);
 
         $this->assertCount(3, $fieldset);
         $this->assertEquals(3, $fieldset[0]);
@@ -1993,7 +1993,7 @@ EOD;
         $DB->insert_record($tablename, array('course' => 6, 'onebinary' => $binarydata));
 
         $fieldset = $DB->get_fieldset_sql("SELECT * FROM {{$tablename}} WHERE course > ?", array(1));
-        $this->assertInternalType('array', $fieldset);
+        $this->assertIsArray($fieldset);
 
         $this->assertCount(3, $fieldset);
         $this->assertEquals(2, $fieldset[0]);
@@ -2001,7 +2001,7 @@ EOD;
         $this->assertEquals(4, $fieldset[2]);
 
         $fieldset = $DB->get_fieldset_sql("SELECT onebinary FROM {{$tablename}} WHERE course > ?", array(1));
-        $this->assertInternalType('array', $fieldset);
+        $this->assertIsArray($fieldset);
 
         $this->assertCount(3, $fieldset);
         $this->assertEquals($binarydata, $fieldset[0]);
index 46643e8..3b968a2 100644 (file)
@@ -51,7 +51,7 @@ class external_testcase extends advanced_testcase {
 
         // The actual data are tested in filetypes_util_test.php, here we just
         // make sure that the external function wrapper seems to work.
-        $this->assertInternalType('object', $data);
-        $this->assertInternalType('array', $data->groups);
+        $this->assertIsObject($data);
+        $this->assertIsArray($data->groups);
     }
 }
index 623ca69..f33e47b 100644 (file)
@@ -100,8 +100,8 @@ class filetypes_util_testcase extends advanced_testcase {
 
         $audio = $util->is_filetype_group('audio');
         $this->assertNotFalse($audio);
-        $this->assertInternalType('array', $audio->extensions);
-        $this->assertInternalType('array', $audio->mimetypes);
+        $this->assertIsArray($audio->extensions);
+        $this->assertIsArray($audio->mimetypes);
 
         $this->assertFalse($util->is_filetype_group('.gif'));
         $this->assertFalse($util->is_filetype_group('somethingveryunlikelytoeverexist'));
index 525325d..f1fd50d 100644 (file)
@@ -467,7 +467,7 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
         $this->assertGreaterThanOrEqual($mid1, $mid2);
 
         $messages = $sink->get_messages();
-        $this->assertInternalType('array', $messages);
+        $this->assertIsArray($messages);
         $this->assertCount(2, $messages);
         $this->assertEquals($mid1, $messages[0]->id);
         $this->assertEquals($message1->userto->id, $messages[0]->useridto);
@@ -481,18 +481,18 @@ class core_phpunit_advanced_testcase extends advanced_testcase {
         // Test resetting.
         $sink->clear();
         $messages = $sink->get_messages();
-        $this->assertInternalType('array', $messages);
+        $this->assertIsArray($messages);
         $this->assertCount(0, $messages);
 
         message_send($message1);
         $messages = $sink->get_messages();
-        $this->assertInternalType('array', $messages);
+        $this->assertIsArray($messages);
         $this->assertCount(1, $messages);
 
         // Test closing.
         $sink->close();
         $messages = $sink->get_messages();
-        $this->assertInternalType('array', $messages);
+        $this->assertIsArray($messages);
         $this->assertCount(1, $messages, 'Messages in sink are supposed to stay there after close');
 
         // Test debugging is enabled again.
index f5abbd1..568db66 100644 (file)
@@ -942,16 +942,16 @@ class core_accesslib_testcase extends advanced_testcase {
         foreach ($archetypes as $archetype) {
 
             $result = get_default_role_archetype_allows('assign', $archetype);
-            $this->assertInternalType('array', $result);
+            $this->assertIsArray($result);
 
             $result = get_default_role_archetype_allows('override', $archetype);
-            $this->assertInternalType('array', $result);
+            $this->assertIsArray($result);
 
             $result = get_default_role_archetype_allows('switch', $archetype);
-            $this->assertInternalType('array', $result);
+            $this->assertIsArray($result);
 
             $result = get_default_role_archetype_allows('view', $archetype);
-            $this->assertInternalType('array', $result);
+            $this->assertIsArray($result);
         }
 
         $result = get_default_role_archetype_allows('assign', '');
@@ -1482,7 +1482,7 @@ class core_accesslib_testcase extends advanced_testcase {
         $alllevels = context_helper::get_all_levels();
         foreach ($archetypes as $archetype) {
             $defaults = get_default_contextlevels($archetype);
-            $this->assertInternalType('array', $defaults);
+            $this->assertIsArray($defaults);
             foreach ($defaults as $level) {
                 $this->assertTrue(isset($alllevels[$level]));
             }
index aeed545..c436f35 100644 (file)
@@ -45,7 +45,7 @@ class core_jquery_testcase extends basic_testcase {
 
         $plugins = null;
         require($CFG->libdir . '/jquery/plugins.php');
-        $this->assertInternalType('array', $plugins);
+        $this->assertIsArray($plugins);
         $this->assertEquals(array('jquery', 'ui', 'ui-css'), array_keys($plugins));
 
         foreach ($plugins as $type => $files) {
index c1fba03..20366f6 100644 (file)
@@ -2099,33 +2099,33 @@ class core_moodlelib_testcase extends advanced_testcase {
 
         $yes = get_string('yes');
         $yesexpected = 'Yes';
-        $this->assertInternalType('string', $yes);
+        $this->assertIsString($yes);
         $this->assertSame($yesexpected, $yes);
 
         $yes = get_string('yes', 'moodle');
-        $this->assertInternalType('string', $yes);
+        $this->assertIsString($yes);
         $this->assertSame($yesexpected, $yes);
 
         $yes = get_string('yes', 'core');
-        $this->assertInternalType('string', $yes);
+        $this->assertIsString($yes);
         $this->assertSame($yesexpected, $yes);
 
         $yes = get_string('yes', '');
-        $this->assertInternalType('string', $yes);
+        $this->assertIsString($yes);
         $this->assertSame($yesexpected, $yes);
 
         $yes = get_string('yes', null);
-        $this->assertInternalType('string', $yes);
+        $this->assertIsString($yes);
         $this->assertSame($yesexpected, $yes);
 
         $yes = get_string('yes', null, 1);
-        $this->assertInternalType('string', $yes);
+        $this->assertIsString($yes);
         $this->assertSame($yesexpected, $yes);
 
         $days = 1;
         $numdays = get_string('numdays', 'core', '1');
         $numdaysexpected = $days.' days';
-        $this->assertInternalType('string', $numdays);
+        $this->assertIsString($numdays);
         $this->assertSame($numdaysexpected, $numdays);
 
         $yes = get_string('yes', null, null, true);
@@ -2137,7 +2137,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->assertInternalType('string', $testresult);
+        $this->assertIsString($testresult);
         $this->assertSame($testexpected, $testresult);
 
         // Test using a lang_string object as the $a argument for an object
@@ -2644,8 +2644,8 @@ class core_moodlelib_testcase extends advanced_testcase {
 
         // Test cache invalidation.
         $cache = cache::make('core', 'config');
-        $this->assertInternalType('array', $cache->get('core'));
-        $this->assertInternalType('array', $cache->get('mod_forum'));
+        $this->assertIsArray($cache->get('core'));
+        $this->assertIsArray($cache->get('mod_forum'));
         set_config('phpunit_test_get_config_1', 'test b');
         $this->assertFalse($cache->get('core'));
         set_config('phpunit_test_get_config_4', 'test c', 'mod_forum');
index 41a7957..d118b44 100644 (file)
@@ -81,7 +81,7 @@ class core_plugin_manager_testcase extends advanced_testcase {
     public function test_get_plugin_types() {
         // Make sure there are no warnings or errors.
         $types = core_plugin_manager::instance()->get_plugin_types();
-        $this->assertInternalType('array', $types);
+        $this->assertIsArray($types);
         foreach ($types as $type => $fulldir) {
             $this->assertFileExists($fulldir);
         }
@@ -120,7 +120,7 @@ class core_plugin_manager_testcase extends advanced_testcase {
             if (is_array($present)) {
                 foreach ($present as $plugin => $version) {
                     $this->assertRegExp('/^[a-z]+[a-z0-9_]*$/', $plugin, 'All plugins are supposed to have version.php file.');
-                    $this->assertInternalType('object', $version);
+                    $this->assertIsObject($version);
                     $this->assertTrue(is_numeric($version->version), 'All plugins should have a version, plugin '.$type.'_'.$plugin.' does not have version info.');
                 }
             } else {
@@ -189,7 +189,7 @@ class core_plugin_manager_testcase extends advanced_testcase {
     public function test_get_subplugins() {
         // Tested already indirectly from test_get_subplugins_of_plugin().
         $subplugins = core_plugin_manager::instance()->get_subplugins();
-        $this->assertInternalType('array', $subplugins);
+        $this->assertIsArray($subplugins);
     }
 
     public function test_get_parent_of_subplugin() {
index 6b46272..54eed4d 100644 (file)
@@ -396,8 +396,8 @@ class core_scheduled_task_testcase extends advanced_testcase {
         $testclass = new \core\task\scheduled_test_task();
 
         // The test task defaults to '*'.
-        $this->assertInternalType('string', $testclass->get_minute());
-        $this->assertInternalType('string', $testclass->get_hour());
+        $this->assertIsString($testclass->get_minute());
+        $this->assertIsString($testclass->get_hour());
 
         // Set a random value.
         $testclass->set_minute('R');
@@ -406,19 +406,19 @@ class core_scheduled_task_testcase extends advanced_testcase {
 
         // Verify the minute has changed within allowed bounds.
         $minute = $testclass->get_minute();
-        $this->assertInternalType('int', $minute);
+        $this->assertIsInt($minute);
         $this->assertGreaterThanOrEqual(0, $minute);
         $this->assertLessThanOrEqual(59, $minute);
 
         // Verify the hour has changed within allowed bounds.
         $hour = $testclass->get_hour();
-        $this->assertInternalType('int', $hour);
+        $this->assertIsInt($hour);
         $this->assertGreaterThanOrEqual(0, $hour);
         $this->assertLessThanOrEqual(23, $hour);
 
         // Verify the dayofweek has changed within allowed bounds.
         $dayofweek = $testclass->get_day_of_week();
-        $this->assertInternalType('int', $dayofweek);
+        $this->assertIsInt($dayofweek);
         $this->assertGreaterThanOrEqual(0, $dayofweek);
         $this->assertLessThanOrEqual(6, $dayofweek);
     }
index 08052c8..102a699 100644 (file)
@@ -148,7 +148,7 @@ class core_update_checker_testcase extends advanced_testcase {
         $old = array();
         $new = array();
         $cmp = $provider->compare_responses($old, $new);
-        $this->assertInternalType('array', $cmp);
+        $this->assertIsArray($cmp);
         $this->assertEmpty($cmp);
     }
 
@@ -165,7 +165,7 @@ class core_update_checker_testcase extends advanced_testcase {
             )
         );
         $cmp = $provider->compare_responses($old, $new);
-        $this->assertInternalType('array', $cmp);
+        $this->assertIsArray($cmp);
         $this->assertNotEmpty($cmp);
         $this->assertTrue(isset($cmp['core'][0]['version']));
         $this->assertEquals(2012060103, $cmp['core'][0]['version']);
@@ -191,7 +191,7 @@ class core_update_checker_testcase extends advanced_testcase {
             )
         );
         $cmp = $provider->compare_responses($old, $new);
-        $this->assertInternalType('array', $cmp);
+        $this->assertIsArray($cmp);
         $this->assertEmpty($cmp);
     }
 
@@ -224,7 +224,7 @@ class core_update_checker_testcase extends advanced_testcase {
             )
         );
         $cmp = $provider->compare_responses($old, $new);
-        $this->assertInternalType('array', $cmp);
+        $this->assertIsArray($cmp);
         $this->assertNotEmpty($cmp);
         $this->assertCount(1, $cmp);
         $this->assertCount(1, $cmp['core']);
@@ -252,7 +252,7 @@ class core_update_checker_testcase extends advanced_testcase {
             )
         );
         $cmp = $provider->compare_responses($old, $new);
-        $this->assertInternalType('array', $cmp);
+        $this->assertIsArray($cmp);
         $this->assertNotEmpty($cmp);
         $this->assertCount(1, $cmp);
         $this->assertCount(1, $cmp['mod_foo']);
index b127c71..872057f 100644 (file)
@@ -77,7 +77,7 @@ class core_update_code_manager_testcase extends advanced_testcase {
 
         $files = $codeman->unzip_plugin_file($zipfilepath, $targetdir);
 
-        $this->assertInternalType('array', $files);
+        $this->assertIsArray($files);
         $this->assertCount(4, $files);
         $this->assertSame(true, $files['invalid-root/']);
         $this->assertSame(true, $files['invalid-root/lang/']);
@@ -93,7 +93,7 @@ class core_update_code_manager_testcase extends advanced_testcase {
 
         $files = $codeman->unzip_plugin_file($zipfilepath, $targetdir, 'fixed_root');
 
-        $this->assertInternalType('array', $files);
+        $this->assertIsArray($files);
         $this->assertCount(4, $files);
         $this->assertSame(true, $files['fixed_root/']);
         $this->assertSame(true, $files['fixed_root/lang/']);
@@ -139,7 +139,7 @@ class core_update_code_manager_testcase extends advanced_testcase {
         $fixtures = __DIR__.'/fixtures/update_validator/plugindir';
         $codeman = new \core\update\testable_code_manager();
         $files = $codeman->list_plugin_folder_files($fixtures.'/foobar');
-        $this->assertInternalType('array', $files);
+        $this->assertIsArray($files);
         $this->assertEquals(6, count($files));
         $fixtures = str_replace(DIRECTORY_SEPARATOR, '/', $fixtures);
         $this->assertEquals($files['foobar/'], $fixtures.'/foobar');
index 99e7f03..840a245 100644 (file)
@@ -181,7 +181,7 @@ class core_update_validator_testcase extends advanced_testcase {
         $this->assertEquals('foobar', $validator->get_rootdir());
         $this->assertTrue($this->has_message($validator->get_messages(), $validator::INFO, 'rootdir', 'foobar'));
         $versionphpinfo = $validator->get_versionphp_info();
-        $this->assertInternalType('array', $versionphpinfo);
+        $this->assertIsArray($versionphpinfo);
         $this->assertCount(4, $versionphpinfo);
         $this->assertEquals(2013031900, $versionphpinfo['version']);
         $this->assertEquals(2013031200, $versionphpinfo['requires']);
@@ -318,7 +318,7 @@ class core_update_validator_testcase extends advanced_testcase {
         $this->assertEquals('testable_core_update_validator', get_class($validator));
 
         $info = $validator->testable_parse_version_php($fixtures.'/version1.php');
-        $this->assertInternalType('array', $info);
+        $this->assertIsArray($info);
         $this->assertCount(7, $info);
         $this->assertEquals('block_foobar', $info['plugin->component']);  // Later in the file.
         $this->assertEquals('2013010100', $info['plugin->version']);      // Numeric wins over strings.
index 4459563..ba0d8a5 100644 (file)
@@ -393,7 +393,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
 
         // Enrol the user in the forum.
         // If a subscription was added, we get the record ID.
-        $this->assertInternalType('int', \mod_forum\subscriptions::subscribe_user($author->id, $forum));
+        $this->assertIsInt(\mod_forum\subscriptions::subscribe_user($author->id, $forum));
 
         // If we already have a subscription when subscribing the user, we get a boolean (true).
         $this->assertTrue(\mod_forum\subscriptions::subscribe_user($author->id, $forum));
@@ -652,7 +652,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
 
         // And should have reset the discussion cache value.
         $result = \mod_forum\subscriptions::fetch_discussion_subscription($forum->id, $author->id);
-        $this->assertInternalType('array', $result);
+        $this->assertIsArray($result);
         $this->assertFalse(isset($result[$discussion->id]));
     }
 
@@ -1107,7 +1107,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
         // the cache and not perform additional queries.
         foreach ($users as $user) {
             $result = \mod_forum\subscriptions::fetch_discussion_subscription($forum->id, $user->id);
-            $this->assertInternalType('array', $result);
+            $this->assertIsArray($result);
         }
         $finalcount = $DB->perf_get_reads();
         $this->assertEquals(0, $finalcount - $postfillcount);
@@ -1165,7 +1165,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase {
         // the cache and not perform additional queries.
         foreach ($users as $user) {
             $result = \mod_forum\subscriptions::fetch_discussion_subscription($forum->id, $user->id);
-            $this->assertInternalType('array', $result);
+            $this->assertIsArray($result);
         }
         $finalcount = $DB->perf_get_reads();
         $this->assertNotEquals($finalcount, $startcount);
index c5303cf..6d54315 100644 (file)
@@ -1301,7 +1301,7 @@ class mod_wiki_external_testcase extends externallib_advanced_testcase {
         // Test on existing subwiki.
         $result = mod_wiki_external::new_page($pagetitle, $pagecontent, 'html', $this->fpsepg1indstu->subwikiid);
         $result = external_api::clean_returnvalue(mod_wiki_external::new_page_returns(), $result);
-        $this->assertInternalType('int', $result['pageid']);
+        $this->assertIsInt($result['pageid']);
 
         $version = wiki_get_current_version($result['pageid']);
         $this->assertEquals($pagecontent, $version->content);
@@ -1323,7 +1323,7 @@ class mod_wiki_external_testcase extends externallib_advanced_testcase {
         $result = mod_wiki_external::new_page($pagetitle, $pagecontent, 'html', null, $this->wikisepind->id, $this->student->id,
             $this->group2->id);
         $result = external_api::clean_returnvalue(mod_wiki_external::new_page_returns(), $result);
-        $this->assertInternalType('int', $result['pageid']);
+        $this->assertIsInt($result['pageid']);
 
         $version = wiki_get_current_version($result['pageid']);
         $this->assertEquals($pagecontent, $version->content);
@@ -1376,7 +1376,7 @@ class mod_wiki_external_testcase extends externallib_advanced_testcase {
 
         $result = mod_wiki_external::edit_page($newpage->id, $newpagecontent);
         $result = external_api::clean_returnvalue(mod_wiki_external::edit_page_returns(), $result);
-        $this->assertInternalType('int', $result['pageid']);
+        $this->assertIsInt($result['pageid']);
 
         $version = wiki_get_current_version($result['pageid']);
         $this->assertEquals($newpagecontent, $version->content);
@@ -1387,7 +1387,7 @@ class mod_wiki_external_testcase extends externallib_advanced_testcase {
 
         $result = mod_wiki_external::edit_page($newpage->id, $newsectioncontent, $section);
         $result = external_api::clean_returnvalue(mod_wiki_external::edit_page_returns(), $result);
-        $this->assertInternalType('int', $result['pageid']);
+        $this->assertIsInt($result['pageid']);
 
         $expected = $sectioncontent . $newsectioncontent;
 
index d395091..11a544f 100644 (file)
@@ -491,7 +491,7 @@ class privacy_manager_testcase extends advanced_testcase {
         $metadata = $mockman->get_metadata_for_components();
         $this->assertDebuggingCalled();
 
-        $this->assertInternalType('array', $metadata);
+        $this->assertIsArray($metadata);
         $this->assertCount(1, $metadata);
     }
 }
index ce6c443..900b9b1 100644 (file)
@@ -85,9 +85,9 @@ class provider_testcase extends advanced_testcase {
      */
     public function test_null_provider($component, $classname) {
         $reason = $classname::get_reason();
-        $this->assertInternalType('string', $reason);
+        $this->assertIsString($reason);
 
-        $this->assertInternalType('string', get_string($reason, $component));
+        $this->assertIsString(get_string($reason, $component));
         $this->assertDebuggingNotCalled();
     }
 
@@ -124,7 +124,7 @@ class provider_testcase extends advanced_testcase {
         foreach ($metadata->get_collection() as $item) {
             // All items must have a valid string name.
             // Note: This is not a string identifier.
-            $this->assertInternalType('string', $item->get_name());
+            $this->assertIsString($item->get_name());
 
             if ($item instanceof database_table) {
                 // Check that the table is valid.
@@ -145,21 +145,21 @@ class provider_testcase extends advanced_testcase {
 
             if ($summary = $item->get_summary()) {
                 // Summary is optional, but when provided must be a valid string identifier.
-                $this->assertInternalType('string', $summary);
+                $this->assertIsString($summary);
 
                 // Check that the string is also correctly defined.
-                $this->assertInternalType('string', get_string($summary, $component));
+                $this->assertIsString(get_string($summary, $component));
                 $this->assertDebuggingNotCalled();
             }
 
             if ($fields = $item->get_privacy_fields()) {
                 // Privacy fields are optional, but when provided must be a valid string identifier.
                 foreach ($fields as $field => $identifier) {
-                    $this->assertInternalType('string', $field);
-                    $this->assertInternalType('string', $identifier);
+                    $this->assertIsString($field);
+                    $this->assertIsString($identifier);
 
                     // Check that the string is also correctly defined.
-                    $this->assertInternalType('string', get_string($identifier, $component));
+                    $this->assertIsString(get_string($identifier, $component));
                     $this->assertDebuggingNotCalled();
                 }
             }
index 644b825..4182273 100644 (file)
@@ -63,7 +63,7 @@ class request_transform_test extends advanced_testcase {
         $datestr = transform::datetime($time);
 
         // Assert it is a string.
-        $this->assertInternalType('string', $datestr);
+        $this->assertIsString($datestr);
 
         // To prevent failures on MAC where we are returned with a lower-case 'am' we want to convert this to 'AM'.
         $datestr = str_replace('am', 'AM', $datestr);
@@ -85,7 +85,7 @@ class request_transform_test extends advanced_testcase {
         $datestr = transform::date($time);
 
         // Assert it is a string.
-        $this->assertInternalType('string', $datestr);
+        $this->assertIsString($datestr);
 
         // Assert the formatted date is correct.
         $dateobj = new DateTime();
index 4f6cb4e..3e87ccd 100644 (file)
@@ -37,7 +37,7 @@ require_once($CFG->dirroot . '/question/type/calculated/questiontype.php');
  */
 class qtype_calculated_formula_validation_testcase extends basic_testcase {
     protected function assert_nonempty_string($actual) {
-        $this->assertInternalType('string', $actual);
+        $this->assertIsString($actual);
         $this->assertNotEquals('', $actual);
     }
 
index d8885c8..bdaac85 100644 (file)
@@ -49,7 +49,7 @@ class core_repositorylib_testcase extends advanced_testcase {
 
         $plugintype = new repository_type($repositorypluginname);
         $pluginid = $plugintype->create(false);
-        $this->assertInternalType('int', $pluginid);
+        $this->assertIsInt($pluginid);
         $args = array();
         $args['type'] = $repositorypluginname;
         $repos = repository::get_instances($args);
index fcec1fe..51de4a6 100644 (file)
@@ -95,7 +95,7 @@ class core_userliblib_testcase extends advanced_testcase {
 
         $this->setUser($user1);
         $userdetails = user_get_user_details_courses($user2);
-        $this->assertInternalType('array', $userdetails);
+        $this->assertIsArray($userdetails);
         $this->assertEquals($user2->id, $userdetails['id']);
     }
 
@@ -133,7 +133,7 @@ class core_userliblib_testcase extends advanced_testcase {
 
         $this->setUser($user1);
         $userdetails = user_get_user_details_courses($user2);
-        $this->assertInternalType('array', $userdetails);
+        $this->assertIsArray($userdetails);
         $this->assertEquals($user2->id, $userdetails['id']);
     }