Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 30... Línea 30...
30
 */
30
 */
31
class myprofile_test extends \advanced_testcase {
31
class myprofile_test extends \advanced_testcase {
32
    /**
32
    /**
33
     * Test node::__construct().
33
     * Test node::__construct().
34
     */
34
     */
35
    public function test_node__construct() {
35
    public function test_node__construct(): void {
36
        $node = new \core_user\output\myprofile\node('parentcat', 'nodename',
36
        $node = new \core_user\output\myprofile\node('parentcat', 'nodename',
37
                'nodetitle', 'after', 'www.google.com', 'description', new \pix_icon('i/course', ''), 'class1 class2');
37
                'nodetitle', 'after', 'www.google.com', 'description', new \pix_icon('i/course', ''), 'class1 class2');
38
        $this->assertSame('parentcat', $node->parentcat);
38
        $this->assertSame('parentcat', $node->parentcat);
39
        $this->assertSame('nodename', $node->name);
39
        $this->assertSame('nodename', $node->name);
40
        $this->assertSame('nodetitle', $node->title);
40
        $this->assertSame('nodetitle', $node->title);
Línea 46... Línea 46...
46
    }
46
    }
Línea 47... Línea 47...
47
 
47
 
48
    /**
48
    /**
49
     * Test category::node_add().
49
     * Test category::node_add().
50
     */
50
     */
51
    public function test_add_node() {
51
    public function test_add_node(): void {
52
        $tree = new \core_user\output\myprofile\tree();
52
        $tree = new \core_user\output\myprofile\tree();
Línea 53... Línea 53...
53
        $category = new \core_user\output\myprofile\category('category', 'categorytitle');
53
        $category = new \core_user\output\myprofile\category('category', 'categorytitle');
54
 
54
 
Línea 71... Línea 71...
71
    }
71
    }
Línea 72... Línea 72...
72
 
72
 
73
    /**
73
    /**
74
     * Test category::__construct().
74
     * Test category::__construct().
75
     */
75
     */
76
    public function test_category__construct() {
76
    public function test_category__construct(): void {
77
        $category = new \core_user\output\myprofile\category('categoryname', 'title', 'after', 'class1 class2');
77
        $category = new \core_user\output\myprofile\category('categoryname', 'title', 'after', 'class1 class2');
78
        $this->assertSame('categoryname', $category->name);
78
        $this->assertSame('categoryname', $category->name);
79
        $this->assertSame('title', $category->title);
79
        $this->assertSame('title', $category->title);
80
        $this->assertSame('after', $category->after);
80
        $this->assertSame('after', $category->after);
81
        $this->assertSame('class1 class2', $category->classes);
81
        $this->assertSame('class1 class2', $category->classes);
Línea 82... Línea 82...
82
    }
82
    }
83
 
83
 
Línea 84... Línea 84...
84
    public function test_validate_after_order1() {
84
    public function test_validate_after_order1(): void {
85
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
85
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
86
 
86
 
Línea 96... Línea 96...
96
        $this->expectException(\coding_exception::class);
96
        $this->expectException(\coding_exception::class);
97
        $category->validate_after_order();
97
        $category->validate_after_order();
Línea 98... Línea 98...
98
 
98
 
Línea 99... Línea 99...
99
    }
99
    }
100
 
100
 
Línea 101... Línea 101...
101
    public function test_validate_after_order2() {
101
    public function test_validate_after_order2(): void {
102
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
102
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
103
 
103
 
Línea 116... Línea 116...
116
    }
116
    }
Línea 117... Línea 117...
117
 
117
 
118
    /**
118
    /**
119
     * Test category::find_nodes_after().
119
     * Test category::find_nodes_after().
120
     */
120
     */
121
    public function test_find_nodes_after() {
121
    public function test_find_nodes_after(): void {
Línea 122... Línea 122...
122
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
122
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
123
 
123
 
124
        // Create nodes.
124
        // Create nodes.
Línea 159... Línea 159...
159
    }
159
    }
Línea 160... Línea 160...
160
 
160
 
161
    /**
161
    /**
162
     * Test category::sort_nodes().
162
     * Test category::sort_nodes().
163
     */
163
     */
164
    public function test_sort_nodes1() {
164
    public function test_sort_nodes1(): void {
Línea 165... Línea 165...
165
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
165
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
166
 
166
 
167
        // Create nodes.
167
        // Create nodes.
Línea 211... Línea 211...
211
    }
211
    }
Línea 212... Línea 212...
212
 
212
 
213
    /**
213
    /**
214
     * Test category::sort_nodes() with a mix of content and non content nodes.
214
     * Test category::sort_nodes() with a mix of content and non content nodes.
215
     */
215
     */
216
    public function test_sort_nodes2() {
216
    public function test_sort_nodes2(): void {
Línea 217... Línea 217...
217
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
217
        $category = new \phpunit_fixture_myprofile_category('category', 'title', null);
218
 
218
 
219
        // Create nodes.
219
        // Create nodes.
Línea 251... Línea 251...
251
    }
251
    }
Línea 252... Línea 252...
252
 
252
 
253
    /**
253
    /**
254
     * Test tree::add_node().
254
     * Test tree::add_node().
255
     */
255
     */
256
    public function test_tree_add_node() {
256
    public function test_tree_add_node(): void {
257
        $tree = new \phpunit_fixture_myprofile_tree();
257
        $tree = new \phpunit_fixture_myprofile_tree();
258
        $node1 = new \core_user\output\myprofile\node('category', 'node1', 'nodetitle');
258
        $node1 = new \core_user\output\myprofile\node('category', 'node1', 'nodetitle');
259
        $tree->add_node($node1);
259
        $tree->add_node($node1);
260
        $nodes = $tree->nodes;
260
        $nodes = $tree->nodes;
Línea 267... Línea 267...
267
    }
267
    }
Línea 268... Línea 268...
268
 
268
 
269
    /**
269
    /**
270
     * Test tree::add_category().
270
     * Test tree::add_category().
271
     */
271
     */
272
    public function test_tree_add_category() {
272
    public function test_tree_add_category(): void {
273
        $tree = new \phpunit_fixture_myprofile_tree();
273
        $tree = new \phpunit_fixture_myprofile_tree();
274
        $category1 = new \core_user\output\myprofile\category('category', 'title');
274
        $category1 = new \core_user\output\myprofile\category('category', 'title');
275
        $tree->add_category($category1);
275
        $tree->add_category($category1);
276
        $categories = $tree->categories;
276
        $categories = $tree->categories;
Línea 283... Línea 283...
283
    }
283
    }
Línea 284... Línea 284...
284
 
284
 
285
    /**
285
    /**
286
     * Test tree::find_categories_after().
286
     * Test tree::find_categories_after().
287
     */
287
     */
288
    public function test_find_categories_after() {
288
    public function test_find_categories_after(): void {
Línea 289... Línea 289...
289
        $tree = new \phpunit_fixture_myprofile_tree('category', 'title', null);
289
        $tree = new \phpunit_fixture_myprofile_tree('category', 'title', null);
290
 
290
 
291
        // Create categories.
291
        // Create categories.
Línea 326... Línea 326...
326
    }
326
    }
Línea 327... Línea 327...
327
 
327
 
328
    /**
328
    /**
329
     * Test tree::sort_categories().
329
     * Test tree::sort_categories().
330
     */
330
     */
331
    public function test_sort_categories() {
331
    public function test_sort_categories(): void {
Línea 332... Línea 332...
332
        $tree = new \phpunit_fixture_myprofile_tree('category', 'title', null);
332
        $tree = new \phpunit_fixture_myprofile_tree('category', 'title', null);
333
 
333
 
334
        // Create categories.
334
        // Create categories.