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.
This commit is contained in:
sam marshall 2020-11-25 14:54:50 +00:00
parent 56fd8c5125
commit b5568aad80

View File

@ -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'));