Ejemplo n.º 1
0
 public function testTaxonomies()
 {
     $post = Post::find(1);
     $taxonomy = $post->taxonomies()->first();
     $this->assertEquals($taxonomy->taxonomy, 'category');
     $post = Post::taxonomy('category', 'php')->first();
     $this->assertEquals($post->ID, 1);
     $post = Post::taxonomy('category', 'php')->first();
     $this->assertEquals($post->post_type, 'post');
 }
Ejemplo n.º 2
0
 public function testTaxonomies()
 {
     $post = Post::find(1);
     $taxonomy = $post->taxonomies()->first();
     $this->assertEquals($taxonomy->taxonomy, 'category');
     $post = Post::taxonomy('category', 'php')->first();
     $this->assertEquals($post->ID, 1);
     $post = Post::taxonomy('category', 'php')->first();
     $this->assertEquals($post->post_type, 'post');
     $this->assertEquals(true, $post->hasTerm('category', 'php'));
     $this->assertEquals(false, $post->hasTerm('category', 'not-term'));
     $this->assertEquals(false, $post->hasTerm('no-category', 'php'));
     $this->assertEquals(false, $post->hasTerm('no-category', 'no-term'));
     $this->assertEquals('php', $post->main_category);
     $this->assertEquals(['php'], $post->keywords);
     $this->assertEquals('php', $post->keywords_str);
 }