FMCorz
8/27/2015 - 3:16 AM

phpunit.php

<?php

        $roleprevent = create_role('Prevent', 'prevent', 'Prevent read');
        set_role_contextlevels($roleprevent, array(CONTEXT_SYSTEM, CONTEXT_COURSECAT));
        assign_capability('tool/lp:competencyread', CAP_PREVENT, $roleprevent, $sysctx->id);
        role_assign($roleprevent, $user->id, $cat2ctx->id);

        accesslib_clear_all_caches_for_unit_testing();
        $this->setUser($user);
        $this->assertFalse(has_capability('tool/lp:competencyread', $cat2ctx));