From b7490a205f69a97ae823c6fc4a33909ec6a748d2 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Wed, 25 Nov 2020 14:54:50 +0000 Subject: [PATCH] MDL-70102 PHPunit: Core test fails with weird added modules Specifically it fails if the modules have unusual default capabilities so that editingteacher doesn't have addinstance. --- course/tests/services_content_item_service_test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/course/tests/services_content_item_service_test.php b/course/tests/services_content_item_service_test.php index f1924fbf8ad..f838265fd19 100644 --- a/course/tests/services_content_item_service_test.php +++ b/course/tests/services_content_item_service_test.php @@ -121,7 +121,8 @@ class services_content_item_service_testcase extends \advanced_testcase { // The call to get_all_content_items() should return the same items as for the course, // given the user in an editing teacher and can add manual lti instances. - $this->assertEquals(array_column($allcontentitems, 'name'), array_column($coursecontentitems, 'name')); + $this->assertContains('lti', array_column($coursecontentitems, 'name')); + $this->assertContains('lti', array_column($allcontentitems, 'name')); // Now removing the cap 'mod/lti:addinstance'. This will restrict those items returned by the course-specific method. $teacherrole = $DB->get_record('role', array('shortname' => 'editingteacher'));