Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 31... Línea 31...
31
class block_test extends \advanced_testcase {
31
class block_test extends \advanced_testcase {
32
    /**
32
    /**
33
     * Tests legacy class name.
33
     * Tests legacy class name.
34
     * @covers \context_block
34
     * @covers \context_block
35
     */
35
     */
36
    public function test_legacy_classname() {
36
    public function test_legacy_classname(): void {
37
        $this->resetAfterTest();
37
        $this->resetAfterTest();
Línea 38... Línea 38...
38
 
38
 
39
        $block = $this->getDataGenerator()->create_block('online_users');
39
        $block = $this->getDataGenerator()->create_block('online_users');
Línea 46... Línea 46...
46
    /**
46
    /**
47
     * Tests covered methods.
47
     * Tests covered methods.
48
     * @covers ::instance
48
     * @covers ::instance
49
     * @covers \core\context::instance_by_id
49
     * @covers \core\context::instance_by_id
50
     */
50
     */
51
    public function test_factory_methods() {
51
    public function test_factory_methods(): void {
52
        $this->resetAfterTest();
52
        $this->resetAfterTest();
Línea 53... Línea 53...
53
 
53
 
54
        $block = $this->getDataGenerator()->create_block('online_users');
54
        $block = $this->getDataGenerator()->create_block('online_users');
Línea 64... Línea 64...
64
 
64
 
65
    /**
65
    /**
66
     * Tests covered method.
66
     * Tests covered method.
67
     * @covers ::get_short_name
67
     * @covers ::get_short_name
68
     */
68
     */
69
    public function test_get_short_name() {
69
    public function test_get_short_name(): void {
70
        $this->assertSame('block', block::get_short_name());
70
        $this->assertSame('block', block::get_short_name());
Línea 71... Línea 71...
71
    }
71
    }
72
 
72
 
73
    /**
73
    /**
74
     * Tests levels.
74
     * Tests levels.
75
     * @coversNothing
75
     * @coversNothing
76
     */
76
     */
77
    public function test_level() {
77
    public function test_level(): void {
78
        $this->assertSame(80, block::LEVEL);
78
        $this->assertSame(80, block::LEVEL);
Línea 79... Línea 79...
79
        $this->assertSame(CONTEXT_BLOCK, block::LEVEL);
79
        $this->assertSame(CONTEXT_BLOCK, block::LEVEL);
80
    }
80
    }
81
 
81
 
82
    /**
82
    /**
83
     * Tests covered method.
83
     * Tests covered method.
84
     * @covers ::get_level_name
84
     * @covers ::get_level_name
85
     */
85
     */
Línea 86... Línea 86...
86
    public function test_get_level_name() {
86
    public function test_get_level_name(): void {
87
        $this->assertSame('Block', block::get_level_name());
87
        $this->assertSame('Block', block::get_level_name());
88
    }
88
    }
89
 
89
 
90
    /**
90
    /**
91
     * Tests covered method.
91
     * Tests covered method.
Línea 92... Línea 92...
92
     * @covers ::get_context_name
92
     * @covers ::get_context_name
93
     */
93
     */
Línea 106... Línea 106...
106
 
106
 
107
    /**
107
    /**
108
     * Tests covered method.
108
     * Tests covered method.
109
     * @covers ::get_url
109
     * @covers ::get_url
110
     */
110
     */
111
    public function test_get_url() {
111
    public function test_get_url(): void {
Línea 112... Línea 112...
112
        $this->resetAfterTest();
112
        $this->resetAfterTest();
113
 
113
 
Línea 122... Línea 122...
122
 
122
 
123
    /**
123
    /**
124
     * Tests covered method.
124
     * Tests covered method.
125
     * @covers ::get_compatible_role_archetypes
125
     * @covers ::get_compatible_role_archetypes
126
     */
126
     */
127
    public function test_get_compatible_role_archetypes() {
127
    public function test_get_compatible_role_archetypes(): void {
Línea 128... Línea 128...
128
        global $DB;
128
        global $DB;
129
 
129
 
130
        $allarchetypes = $DB->get_fieldset_select('role', 'DISTINCT archetype', 'archetype IS NOT NULL');
130
        $allarchetypes = $DB->get_fieldset_select('role', 'DISTINCT archetype', 'archetype IS NOT NULL');
Línea 136... Línea 136...
136
 
136
 
137
    /**
137
    /**
138
     * Tests covered method.
138
     * Tests covered method.
139
     * @covers ::get_possible_parent_levels
139
     * @covers ::get_possible_parent_levels
140
     */
140
     */
141
    public function test_get_possible_parent_levels() {
141
    public function test_get_possible_parent_levels(): void {
142
        $result = block::get_possible_parent_levels();
142
        $result = block::get_possible_parent_levels();
143
        // All except itself.
143
        // All except itself.
144
        $this->assertContains(system::LEVEL, $result);
144
        $this->assertContains(system::LEVEL, $result);
145
        $this->assertContains(user::LEVEL, $result);
145
        $this->assertContains(user::LEVEL, $result);
Línea 155... Línea 155...
155
 
155
 
156
    /**
156
    /**
157
     * Tests covered method.
157
     * Tests covered method.
158
     * @covers ::get_capabilities
158
     * @covers ::get_capabilities
159
     */
159
     */
160
    public function test_get_capabilities() {
160
    public function test_get_capabilities(): void {
Línea 161... Línea 161...
161
        $this->resetAfterTest();
161
        $this->resetAfterTest();
162
 
162
 
Línea 176... Línea 176...
176
 
176
 
177
    /**
177
    /**
178
     * Tests covered method.
178
     * Tests covered method.
179
     * @covers ::create_level_instances
179
     * @covers ::create_level_instances
180
     */
180
     */
181
    public function test_create_level_instances() {
181
    public function test_create_level_instances(): void {
182
        global $DB;
182
        global $DB;
Línea 183... Línea 183...
183
        $this->resetAfterTest();
183
        $this->resetAfterTest();
184
 
184
 
Línea 192... Línea 192...
192
 
192
 
193
    /**
193
    /**
194
     * Tests covered method.
194
     * Tests covered method.
195
     * @covers ::get_child_contexts
195
     * @covers ::get_child_contexts
196
     */
196
     */
197
    public function test_get_child_contexts() {
197
    public function test_get_child_contexts(): void {
Línea 198... Línea 198...
198
        $this->resetAfterTest();
198
        $this->resetAfterTest();
199
 
199
 
Línea 206... Línea 206...
206
 
206
 
207
    /**
207
    /**
208
     * Tests covered method.
208
     * Tests covered method.
209
     * @covers ::get_cleanup_sql
209
     * @covers ::get_cleanup_sql
210
     */
210
     */
211
    public function test_get_cleanup_sql() {
211
    public function test_get_cleanup_sql(): void {
212
        global $DB;
212
        global $DB;
Línea 213... Línea 213...
213
        $this->resetAfterTest();
213
        $this->resetAfterTest();
214
 
214
 
Línea 223... Línea 223...
223
 
223
 
224
    /**
224
    /**
225
     * Tests covered method.
225
     * Tests covered method.
226
     * @covers ::build_paths
226
     * @covers ::build_paths
227
     */
227
     */
228
    public function test_build_paths() {
228
    public function test_build_paths(): void {
229
        global $DB;
229
        global $DB;
Línea 230... Línea 230...
230
        $this->resetAfterTest();
230
        $this->resetAfterTest();
231
 
231
 
Línea 245... Línea 245...
245
 
245
 
246
    /**
246
    /**
247
     * Tests covered method.
247
     * Tests covered method.
248
     * @covers ::set_locked
248
     * @covers ::set_locked
249
     */
249
     */
250
    public function test_set_locked() {
250
    public function test_set_locked(): void {
251
        global $DB;
251
        global $DB;
Línea 252... Línea 252...
252
        $this->resetAfterTest();
252
        $this->resetAfterTest();
253
 
253