示例#1
0
 /**
  * Test category::node_add().
  */
 public function test_add_node()
 {
     $tree = new \core_user\output\myprofile\tree();
     $category = new \core_user\output\myprofile\category('category', 'categorytitle');
     $node = new \core_user\output\myprofile\node('category', 'nodename', 'nodetitle', null, 'www.iAmaZombie.com', 'description');
     $category->add_node($node);
     $this->assertCount(1, $category->nodes);
     $node = new \core_user\output\myprofile\node('category', 'nodename2', 'nodetitle', null, 'www.WorldisGonnaEnd.com', 'description');
     $category->add_node($node);
     $this->assertCount(2, $category->nodes);
     $node = new \core_user\output\myprofile\node('category', 'nodename3', 'nodetitle', null, 'www.TeamBeardsFTW.com', 'description');
     $tree->add_node($node);
     $tree->add_category($category);
     $tree->sort_categories();
     $category = $tree->categories['category'];
     $this->assertCount(3, $category->nodes);
 }