Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 28... Línea 28...
28
/**
28
/**
29
 * Functional test for accesslib.php
29
 * Functional test for accesslib.php
30
 *
30
 *
31
 * Note: execution may take many minutes especially on slower servers.
31
 * Note: execution may take many minutes especially on slower servers.
32
 */
32
 */
33
class accesslib_test extends advanced_testcase {
33
final class accesslib_test extends advanced_testcase {
Línea 34... Línea 34...
34
 
34
 
35
    /**
35
    /**
36
     * Setup.
36
     * Setup.
37
     */
37
     */
Línea 1996... Línea 1996...
1996
        $user = $this->getDataGenerator()->create_and_enrol($course);
1996
        $user = $this->getDataGenerator()->create_and_enrol($course);
1997
        $this->setup_fake_plugin('access');
1997
        $this->setup_fake_plugin('access');
Línea 1998... Línea 1998...
1998
 
1998
 
1999
        // For now we have deprecated fake/access:fakecapability.
1999
        // For now we have deprecated fake/access:fakecapability.
-
 
2000
        $capinfo = get_deprecated_capability_info('fake/access:fakecapability');
2000
        $capinfo = get_deprecated_capability_info('fake/access:fakecapability');
2001
        $this->assertNotNull(get_capability_info('fake/access:existingcapability'));
2001
        $this->assertNotEmpty($capinfo);
2002
        $this->assertNotEmpty($capinfo);
2002
        $this->assertEquals("The capability 'fake/access:fakecapability' is"
2003
        $this->assertEquals("The capability 'fake/access:fakecapability' is"
2003
            . " deprecated.This capability should not be used anymore.", $capinfo['fullmessage']);
2004
            . " deprecated.This capability should not be used anymore.", $capinfo['fullmessage']);
Línea 2068... Línea 2069...
2068
    /**
2069
    /**
2069
     * Specific use case for deprecated capabilities
2070
     * Specific use case for deprecated capabilities
2070
     *
2071
     *
2071
     * @return array
2072
     * @return array
2072
     */
2073
     */
2073
    public function deprecated_capabilities_use_cases() {
2074
    public static function deprecated_capabilities_use_cases(): array {
2074
        return [
2075
        return [
2075
            'capability missing' => [
2076
            'capability missing' => [
2076
                'fake/access:missingcapability',
2077
                'fake/access:missingcapability',
2077
                [
2078
                [
2078
                    "Capability \"fake/access:missingcapability\" was not found! This has to be fixed in code."
2079
                    "Capability \"fake/access:missingcapability\" was not found! This has to be fixed in code."
Línea 2113... Línea 2114...
2113
            ],
2114
            ],
2114
        ];
2115
        ];
2115
    }
2116
    }
Línea 2116... Línea 2117...
2116
 
2117
 
-
 
2118
    /**
-
 
2119
     * Test get_deprecated_capability_info() with an invalid component.
-
 
2120
     *
-
 
2121
     * @covers get_deprecated_capability_info
-
 
2122
     */
-
 
2123
    public function test_get_deprecated_capability_info_invalid_component(): void {
-
 
2124
        global $DB;
-
 
2125
 
-
 
2126
        $this->resetAfterTest();
-
 
2127
 
-
 
2128
        // Set up a fake plugin.
-
 
2129
        $this->setup_fake_plugin('access');
-
 
2130
 
-
 
2131
        // Add a plugin for an unrelated fake component.
-
 
2132
        $DB->insert_record('capabilities', [
-
 
2133
            'name' => 'mod/fake:addinstance',
-
 
2134
            'captype' => 'write',
-
 
2135
            'contextlevel' => CONTEXT_COURSE,
-
 
2136
            'component' => 'mod_fake',
-
 
2137
            'riskbitmask' => 4,
-
 
2138
        ]);
-
 
2139
 
-
 
2140
        // Purge the cache.
-
 
2141
        cache::make('core', 'capabilities')->purge();
-
 
2142
 
-
 
2143
        // For now we have deprecated fake/access:fakecapability.
-
 
2144
        $this->assertNotEmpty($DB->get_record('capabilities', ['component' => 'mod_fake']));
-
 
2145
        $info = get_deprecated_capability_info('fake/access:fakecapability');
-
 
2146
        $this->assertIsArray($info);
-
 
2147
        $this->assertDebuggingNotCalled();
-
 
2148
    }
-
 
2149
 
2117
    /**
2150
    /**
2118
     * Test that assigning a fake cap does not return.
2151
     * Test that assigning a fake cap does not return.
2119
     *
2152
     *
2120
     * @covers ::get_users_by_capability
2153
     * @covers ::get_users_by_capability
2121
     * @covers ::get_with_capability_join
2154
     * @covers ::get_with_capability_join
Línea 2213... Línea 2246...
2213
        role_assign($teacherrole->id, $teacher->id, $coursecontext);
2246
        role_assign($teacherrole->id, $teacher->id, $coursecontext);
2214
        $admin = $DB->get_record('user', array('username' => 'admin'));
2247
        $admin = $DB->get_record('user', array('username' => 'admin'));
Línea 2215... Línea 2248...
2215
 
2248
 
2216
        $this->expectException('coding_exception');
2249
        $this->expectException('coding_exception');
2217
        $this->expectExceptionMessage("Capability '{$capability}' was not found! This has to be fixed in code.");
2250
        $this->expectExceptionMessage("Capability '{$capability}' was not found! This has to be fixed in code.");
2218
        unassign_capability($capability, CAP_ALLOW, $teacherrole->id, $coursecontext);
2251
        unassign_capability($capability, $teacherrole->id, $coursecontext);
Línea 2219... Línea 2252...
2219
    }
2252
    }
2220
 
2253
 
2221
    /**
2254
    /**
Línea 3042... Línea 3075...
3042
        $this->assertCount(1, $user4groupusers);
3075
        $this->assertCount(1, $user4groupusers);
3043
        $this->assertArrayHasKey($user1->id, $user4groupusers);
3076
        $this->assertArrayHasKey($user1->id, $user4groupusers);
3044
        $this->assertEquals(1, count_enrolled_users($coursecontext, '', $groupids));
3077
        $this->assertEquals(1, count_enrolled_users($coursecontext, '', $groupids));
3045
    }
3078
    }
Línea 3046... Línea 3079...
3046
 
3079
 
3047
    public function get_enrolled_sql_provider() {
3080
    public static function get_enrolled_sql_provider(): array {
3048
        return array(
3081
        return array(
3049
            array(
3082
            array(
3050
                // Two users who are enrolled.
3083
                // Two users who are enrolled.
3051
                'users' => array(
3084
                'users' => array(
Línea 3562... Línea 3595...
3562
 
3595
 
3563
        assign_capability('moodle/site:accessallgroups', CAP_INHERIT, $allroles['teacher'], $frontpagecontext);
3596
        assign_capability('moodle/site:accessallgroups', CAP_INHERIT, $allroles['teacher'], $frontpagecontext);
3564
        $rc = $DB->get_record('role_capabilities', array('contextid'=>$frontpagecontext->id, 'roleid'=>$allroles['teacher'], 'capability'=>'moodle/site:accessallgroups'));
3597
        $rc = $DB->get_record('role_capabilities', array('contextid'=>$frontpagecontext->id, 'roleid'=>$allroles['teacher'], 'capability'=>'moodle/site:accessallgroups'));
3565
        $this->assertFalse($rc);
3598
        $this->assertFalse($rc);
3566
        assign_capability('moodle/site:accessallgroups', CAP_ALLOW, $allroles['teacher'], $frontpagecontext);
3599
        assign_capability('moodle/site:accessallgroups', CAP_ALLOW, $allroles['teacher'], $frontpagecontext);
3567
        unassign_capability('moodle/site:accessallgroups', $allroles['teacher'], $frontpagecontext, true);
3600
        unassign_capability('moodle/site:accessallgroups', $allroles['teacher'], $frontpagecontext);
3568
        $rc = $DB->get_record('role_capabilities', array('contextid'=>$frontpagecontext->id, 'roleid'=>$allroles['teacher'], 'capability'=>'moodle/site:accessallgroups'));
3601
        $rc = $DB->get_record('role_capabilities', array('contextid'=>$frontpagecontext->id, 'roleid'=>$allroles['teacher'], 'capability'=>'moodle/site:accessallgroups'));
3569
        $this->assertFalse($rc);
3602
        $this->assertFalse($rc);
3570
        unassign_capability('moodle/site:accessallgroups', $allroles['teacher'], $frontpagecontext->id, true);
3603
        unassign_capability('moodle/site:accessallgroups', $allroles['teacher'], $frontpagecontext->id);
Línea 3571... Línea 3604...
3571
        unset($rc);
3604
        unset($rc);
Línea 4043... Línea 4076...
4043
            $this->assertEquals($prevsize, context_inspection::check_context_cache_size());
4076
            $this->assertEquals($prevsize, context_inspection::check_context_cache_size());
4044
        }
4077
        }
4045
        context_user::instance($testusers[102]);
4078
        context_user::instance($testusers[102]);
4046
        $this->assertEquals($prevsize + 1, context_inspection::check_context_cache_size());
4079
        $this->assertEquals($prevsize + 1, context_inspection::check_context_cache_size());
4047
        unset($testusers);
4080
        unset($testusers);
4048
 
-
 
4049
 
-
 
4050
 
-
 
4051
        // Test basic test of legacy functions.
-
 
4052
        // Note: watch out, the fake site might be pretty borked already.
-
 
4053
 
-
 
4054
        $this->assertEquals(get_system_context(), context_system::instance());
-
 
4055
        $this->assertDebuggingCalled('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER);
-
 
4056
 
-
 
4057
        foreach ($DB->get_records('context') as $contextid => $record) {
-
 
4058
            $context = context::instance_by_id($contextid);
-
 
4059
            $this->assertEquals($context, get_context_instance($record->contextlevel, $record->instanceid));
-
 
4060
            $this->assertDebuggingCalled('get_context_instance() is deprecated, please use context_xxxx::instance() instead.', DEBUG_DEVELOPER);
-
 
4061
        }
-
 
4062
 
-
 
4063
        // Make sure a debugging is thrown.
-
 
4064
        get_context_instance($record->contextlevel, $record->instanceid);
-
 
4065
        $this->assertDebuggingCalled('get_context_instance() is deprecated, please use context_xxxx::instance() instead.', DEBUG_DEVELOPER);
-
 
4066
        get_system_context();
-
 
4067
        $this->assertDebuggingCalled('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER);
-
 
4068
    }
4081
    }
Línea 4069... Línea 4082...
4069
 
4082
 
4070
    /**
4083
    /**
4071
     * Helper that verifies a list of capabilities, as returned by
4084
     * Helper that verifies a list of capabilities, as returned by
Línea 4093... Línea 4106...
4093
    public function test_context_module_caps_returned_by_get_capabilities_in_sys_context(): void {
4106
    public function test_context_module_caps_returned_by_get_capabilities_in_sys_context(): void {
4094
        $actual = context_system::instance()->get_capabilities();
4107
        $actual = context_system::instance()->get_capabilities();
Línea 4095... Línea 4108...
4095
 
4108
 
4096
        // Just test a few representative capabilities.
4109
        // Just test a few representative capabilities.
4097
        $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames',
4110
        $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames',
Línea 4098... Línea 4111...
4098
                'repository/upload:view', 'atto/recordrtc:recordaudio'];
4111
                'repository/upload:view', 'tiny/recordrtc:recordaudio'];
4099
 
4112
 
Línea 4100... Línea 4113...
4100
        $this->assert_capability_list_contains($expectedcapabilities, $actual);
4113
        $this->assert_capability_list_contains($expectedcapabilities, $actual);
Línea 4112... Línea 4125...
4112
 
4125
 
Línea 4113... Línea 4126...
4113
        $actual = context_coursecat::instance($cat->id)->get_capabilities();
4126
        $actual = context_coursecat::instance($cat->id)->get_capabilities();
4114
 
4127
 
4115
        // Just test a few representative capabilities.
4128
        // Just test a few representative capabilities.
Línea 4116... Línea 4129...
4116
        $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames',
4129
        $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames',
4117
                'repository/upload:view', 'atto/recordrtc:recordaudio'];
4130
                'repository/upload:view', 'tiny/recordrtc:recordaudio'];
Línea 4118... Línea 4131...
4118
 
4131
 
Línea 4132... Línea 4145...
4132
 
4145
 
Línea 4133... Línea 4146...
4133
        $actual = context_course::instance($course->id)->get_capabilities();
4146
        $actual = context_course::instance($course->id)->get_capabilities();
4134
 
4147
 
4135
        // Just test a few representative capabilities.
4148
        // Just test a few representative capabilities.
Línea 4136... Línea 4149...
4136
        $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames',
4149
        $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames',
4137
                'repository/upload:view', 'atto/recordrtc:recordaudio'];
4150
                'repository/upload:view', 'tiny/recordrtc:recordaudio'];
Línea 4138... Línea 4151...
4138
 
4151
 
Línea 4153... Línea 4166...
4153
 
4166
 
Línea 4154... Línea 4167...
4154
        $actual = context_module::instance($page->cmid)->get_capabilities();
4167
        $actual = context_module::instance($page->cmid)->get_capabilities();
4155
 
4168
 
4156
        // Just test a few representative capabilities.
4169
        // Just test a few representative capabilities.
Línea 4157... Línea 4170...
4157
        $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames',
4170
        $expectedcapabilities = ['moodle/site:accessallgroups', 'moodle/site:viewfullnames',
4158
                'repository/upload:view', 'atto/recordrtc:recordaudio'];
4171
                'repository/upload:view', 'tiny/recordrtc:recordaudio'];
Línea 4159... Línea 4172...
4159
 
4172
 
Línea 4303... Línea 4316...
4303
        }
4316
        }
4304
        $this->assertEquals($perms1, $perms2);
4317
        $this->assertEquals($perms1, $perms2);
4305
    }
4318
    }
Línea 4306... Línea 4319...
4306
 
4319
 
4307
    /**
-
 
4308
     * Checks install performance in update_capabilities.
-
 
4309
     *
-
 
4310
     * @covers ::update_capabilities()
-
 
4311
     */
-
 
4312
    public function test_update_capabilities_install_performance(): void {
-
 
4313
        global $DB;
-
 
4314
 
-
 
4315
        $this->resetAfterTest();
-
 
4316
 
-
 
4317
        // Get rid of all the capabilities for forum.
-
 
4318
        $testmodule = 'forum';
-
 
4319
        $DB->delete_records_select('capabilities', 'name LIKE ?', ['mod/' . $testmodule . ':%']);
-
 
4320
 
-
 
4321
        $beforeq = $DB->perf_get_queries();
-
 
4322
        update_capabilities('mod_' . $testmodule);
-
 
4323
        $afterq = $DB->perf_get_queries();
-
 
4324
 
-
 
4325
        // In my testing there are currently 237 queries; there were 373 before a performance
-
 
4326
        // fix. This test confirms performance doesn't degrade to near the previous level.
-
 
4327
        $this->assertLessThan(300, $afterq - $beforeq);
-
 
4328
    }
-
 
4329
 
-
 
4330
    /**
-
 
4331
     * Checks install performance in update_capabilities when a new capability is cloned.
-
 
4332
     *
-
 
4333
     * This only has impact if there are a significant number of overrides of the existing
-
 
4334
     * capability.
-
 
4335
     *
-
 
4336
     * @covers ::update_capabilities()
-
 
4337
     */
-
 
4338
    public function test_update_capabilities_clone_performance(): void {
-
 
4339
        global $DB;
-
 
4340
 
-
 
4341
        $this->resetAfterTest();
-
 
4342
 
-
 
4343
        // Create a bunch of activities in a course. In each one, override so manager doesn't have
-
 
4344
        // moodle/course:manageactivities.
-
 
4345
        $generator = $this->getDataGenerator();
-
 
4346
        $course = $generator->create_course();
-
 
4347
        $roleid = $DB->get_field('role', 'id', ['shortname' => 'manager']);
-
 
4348
        for ($i = 0; $i < 100; $i++) {
-
 
4349
            $page = $generator->create_module('page', ['course' => $course->id]);
-
 
4350
            $contextid = context_module::instance($page->cmid)->id;
-
 
4351
            assign_capability('moodle/course:manageactivities', CAP_PREVENT, $roleid, $contextid);
-
 
4352
        }
-
 
4353
 
-
 
4354
        // Get rid of one of the capabilities for forum, which clones moodle/course:manageactivities.
-
 
4355
        $DB->delete_records('capabilities', ['name' => 'mod/forum:addinstance']);
-
 
4356
 
-
 
4357
        // Clear the context cache to simulate a realistic situation where we don't already have
-
 
4358
        // all those contexts in the cache.
-
 
4359
        accesslib_clear_all_caches_for_unit_testing();
-
 
4360
 
-
 
4361
        $beforeq = $DB->perf_get_queries();
-
 
4362
        update_capabilities('mod_forum');
-
 
4363
        $afterq = $DB->perf_get_queries();
-
 
4364
 
-
 
4365
        // In my testing there are currently 214 queries after performance was improved for cloning,
-
 
4366
        // compared to 414 before. This test confirms performance doesn't degrade to near the
-
 
4367
        // previous level.
-
 
4368
        $this->assertLessThan(300, $afterq - $beforeq);
-
 
4369
    }
-
 
4370
 
-
 
4371
    /**
4320
    /**
4372
     * Tests update_capabilities when a capability is cloned, but there are existing settings
4321
     * Tests update_capabilities when a capability is cloned, but there are existing settings
4373
     * for that capability.
4322
     * for that capability.
4374
     *
4323
     *
4375
     * Under normal circumstances this shouldn't happen as it is only used for new capabilities,
4324
     * Under normal circumstances this shouldn't happen as it is only used for new capabilities,
Línea 4605... Línea 4554...
4605
     * that they are capabilities which the Student roles has by default, but the
4554
     * that they are capabilities which the Student roles has by default, but the
4606
     * authenticated suser role does not.
4555
     * authenticated suser role does not.
4607
     *
4556
     *
4608
     * @return array
4557
     * @return array
4609
     */
4558
     */
4610
    public function get_get_with_capability_join_override_cases() {
4559
    public static function get_get_with_capability_join_override_cases(): array {
4611
        return [
4560
        return [
4612
                'no overrides' => [true, []],
4561
                'no overrides' => [true, []],
4613
                'one override' => [true, ['moodle/course:viewscales']],
4562
                'one override' => [true, ['moodle/course:viewscales']],
4614
                'both overrides' => [false, ['moodle/course:viewscales', 'moodle/question:flag']],
4563
                'both overrides' => [false, ['moodle/course:viewscales', 'moodle/question:flag']],
4615
        ];
4564
        ];
Línea 4807... Línea 4756...
4807
    /**
4756
    /**
4808
     * Data provider for is_parent_of context checks.
4757
     * Data provider for is_parent_of context checks.
4809
     *
4758
     *
4810
     * @return  array
4759
     * @return  array
4811
     */
4760
     */
4812
    public function is_parent_of_provider(): array {
4761
    public static function is_parent_of_provider(): array {
4813
        $provideboth = function(string $desc, string $contextpath, string $testpath, bool $expected): array {
4762
        $provideboth = function(string $desc, string $contextpath, string $testpath, bool $expected): array {
4814
            return [
4763
            return [
4815
                "includeself: true; {$desc}" => [
4764
                "includeself: true; {$desc}" => [
4816
                    $contextpath,
4765
                    $contextpath,
4817
                    $testpath,
4766
                    $testpath,
Línea 4908... Línea 4857...
4908
    /**
4857
    /**
4909
     * Data provider for is_child_of context checks.
4858
     * Data provider for is_child_of context checks.
4910
     *
4859
     *
4911
     * @return  array
4860
     * @return  array
4912
     */
4861
     */
4913
    public function is_child_of_provider(): array {
4862
    public static function is_child_of_provider(): array {
4914
        $provideboth = function(string $desc, string $contextpath, string $testpath, bool $expected): array {
4863
        $provideboth = function(string $desc, string $contextpath, string $testpath, bool $expected): array {
4915
            return [
4864
            return [
4916
                "includeself: true; {$desc}" => [
4865
                "includeself: true; {$desc}" => [
4917
                    $contextpath,
4866
                    $contextpath,
4918
                    $testpath,
4867
                    $testpath,
Línea 5258... Línea 5207...
5258
    }
5207
    }
Línea 5259... Línea 5208...
5259
 
5208
 
5260
    /**
5209
    /**
5261
     * Test get_navigation_filter_context.
5210
     * Test get_navigation_filter_context.
5262
     *
5211
     *
5263
     * @covers ::get_navigation_filter_context
5212
     * @covers \core\context_helper::get_navigation_filter_context
5264
     */
5213
     */
5265
    public function test_get_navigation_filter_context(): void {
5214
    public function test_get_navigation_filter_context(): void {
5266
        $this->resetAfterTest();
5215
        $this->resetAfterTest();
5267
        $course = $this->getDataGenerator()->create_course();
5216
        $course = $this->getDataGenerator()->create_course();
Línea 5277... Línea 5226...
5277
        $filtercontext = context_helper::get_navigation_filter_context(null);
5226
        $filtercontext = context_helper::get_navigation_filter_context(null);
5278
        $this->assertInstanceOf('\context_system', $filtercontext);
5227
        $this->assertInstanceOf('\context_system', $filtercontext);
5279
        $filtercontext = context_helper::get_navigation_filter_context($coursecontext);
5228
        $filtercontext = context_helper::get_navigation_filter_context($coursecontext);
5280
        $this->assertInstanceOf('\context_system', $filtercontext);
5229
        $this->assertInstanceOf('\context_system', $filtercontext);
5281
    }
5230
    }
-
 
5231
 
-
 
5232
    /**
-
 
5233
     * Test access APIs when dealing with deprecated plugin types.
-
 
5234
     *
-
 
5235
     * Note: this injects a mocked plugin type into core_component and is a slow test that must be run in isolation.
-
 
5236
     *
-
 
5237
     * @covers ::has_capability
-
 
5238
     * @runInSeparateProcess
-
 
5239
     */
-
 
5240
    public function test_capabilities_deprecated_plugintype(): void {
-
 
5241
        $this->resetAfterTest();
-
 
5242
 
-
 
5243
        global $CFG;
-
 
5244
        $this->add_mocked_plugintype('fake', "{$CFG->dirroot}/lib/tests/fixtures/fakeplugins/fake", true);
-
 
5245
        $this->add_mocked_plugin('fake', 'fullfeatured', "{$CFG->dirroot}/lib/tests/fixtures/fakeplugins/fake/fullfeatured");
-
 
5246
        update_capabilities('fake_fullfeatured');
-
 
5247
 
-
 
5248
        $this->assertTrue(\core_component::is_deprecated_plugin_type('fake'));
-
 
5249
 
-
 
5250
        $user = $this->getDataGenerator()->create_user();
-
 
5251
        $this->assertNotEmpty(get_capability_info('fake/fullfeatured:fakecapability'));
-
 
5252
        $this->assertTrue(has_capability('fake/fullfeatured:fakecapability', \core\context\system::instance(), $user));
-
 
5253
        $this->assertEquals('Fullfeatured capability description', get_capability_string('fake/fullfeatured:fakecapability'));
-
 
5254
    }
-
 
5255
 
-
 
5256
    /**
-
 
5257
     * Test get_deprecated_capability_info() debugging messages.
-
 
5258
     *
-
 
5259
     * @covers ::get_deprecated_capability_info
-
 
5260
     */
-
 
5261
    public function test_get_deprecated_capability_info_debugging(): void {
-
 
5262
        $this->resetAfterTest();
-
 
5263
        $course = $this->getDataGenerator()->create_course();
-
 
5264
        $this->getDataGenerator()->create_and_enrol($course);
-
 
5265
        $this->setup_fake_plugin('access');
-
 
5266
        // Debugging messages should not be called with valid capability.
-
 
5267
        get_capability_info('fake/access:existingcapability');
-
 
5268
        $this->assertDebuggingNotCalled();
-
 
5269
        // Debugging messages should be called with invalid capability.
-
 
5270
        get_capability_info('fake/access:fakecapability');
-
 
5271
        $this->assertDebuggingCalled("The capability 'fake/access:fakecapability' is"
-
 
5272
            . " deprecated.This capability should not be used anymore.");
-
 
5273
        // Debugging messages should not be called with invalid capability with suppression param supplied.
-
 
5274
        get_capability_info('fake/access:fakecapability', false);
-
 
5275
        $this->assertDebuggingNotCalled();
-
 
5276
    }
5282
}
5277
}
Línea 5283... Línea 5278...
5283
 
5278
 
5284
/**
5279
/**
5285
 * Context caching fixture
5280
 * Context caching fixture