Example #1
0
 function testGetPostsNew()
 {
     require_once 'php/timber-post-subclass.php';
     $term_id = $this->factory->term->create();
     $posts = array();
     $posts[] = $this->factory->post->create();
     $posts[] = $this->factory->post->create();
     $posts[] = $this->factory->post->create();
     foreach ($posts as $post_id) {
         set_post_type($post_id, 'page');
         wp_set_object_terms($post_id, $term_id, 'post_tag', true);
     }
     $term = new TimberTerm($term_id);
     $gotten_posts = $term->get_posts('post_type=page');
     $this->assertEquals(count($posts), count($gotten_posts));
     $gotten_posts = $term->get_posts('post_type=page', 'TimberPostSubclass');
     $this->assertEquals(count($posts), count($gotten_posts));
     $this->assertEquals($gotten_posts[0]->foo(), 'bar');
     $gotten_posts = $term->get_posts(array('post_type' => 'page'), 'TimberPostSubclass');
     $this->assertEquals($gotten_posts[0]->foo(), 'bar');
     $this->assertEquals(count($posts), count($gotten_posts));
 }
Example #2
0
 public function get_posts($numberposts = 10, $post_type = 'any', $PostClass = '')
 {
     return $this->term->get_posts($numberposts, $post_type, $PostClass);
 }