コード例 #1
0
ファイル: WPTaxonomyTest.php プロジェクト: comodojo/wpapi
 /**
  * @depends testWPTermModify 
  */
 public function testWPTermParent()
 {
     if (self::$wp->isLogged()) {
         $taxonomy = new \Comodojo\WPAPI\WPTaxonomy(self::$blog, "category");
         $terms = $taxonomy->getTerms("WPTerm test");
         $this->assertSame(1, count($terms));
         $term = $terms[0];
         $child = new \Comodojo\WPAPI\WPTerm($taxonomy);
         $child->setName("WPTerm test child")->setParent($term)->save();
         $this->assertSame($child->getName(), "WPTerm test child");
         $this->assertSame($child->getParent()->getID(), $term->getID());
     }
 }
コード例 #2
0
ファイル: WPBlogTest.php プロジェクト: comodojo/wpapi
 /**
  * @depends testWPBlogTags 
  */
 public function testWPBlogCategories()
 {
     // Add at least one category
     $taxonomy = self::$blog->getTaxonomy("category");
     $new_term = new \Comodojo\WPAPI\WPTerm($taxonomy);
     $new_term->setName("Test category")->save();
     self::$blog->addCategory($new_term);
     // Check the categories
     $categories = self::$blog->getCategories();
     $this->assertGreaterThan(0, count($categories));
     foreach ($categories as $category) {
         $c = self::$blog->getCategory($category->getName());
         $this->assertSame($c->getName(), $category->getName());
         $this->assertTrue(self::$blog->hasCategory($c->getName()));
     }
 }