/** * Test we can delete a competency framework with manage permissions. */ public function test_delete_competency_frameworks_with_manage_permissions_in_category() { $this->setUser($this->creator); $insystem = $this->create_competency_framework(1, true); $incat = $this->create_competency_framework(2, false); $this->setUser($this->catcreator); $id = $incat->id; $result = external::delete_competency_framework($id); $result = external_api::clean_returnvalue(external::delete_competency_framework_returns(), $result); $this->assertTrue($result); try { $id = $insystem->id; $result = external::delete_competency_framework($id); $result = external_api::clean_returnvalue(external::delete_competency_framework_returns(), $result); $this->fail('Current user cannot should not be able to delete the framework.'); } catch (required_capability_exception $e) { // All good. } }