/** * @covers ::bbp_reply_post_type * @covers ::bbp_get_reply_post_type */ public function test_bbp_reply_post_type() { $t = $this->factory->topic->create(); $r = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('topic_id' => $t))); $robj = get_post_type_object('reply'); $this->assertInstanceOf('stdClass', $robj); $this->assertEquals('reply', $robj->name); // Test some defaults $this->assertFalse(is_post_type_hierarchical('topic')); $reply_type = bbp_reply_post_type($r); $this->expectOutputString('reply', $reply_type); $reply_type = bbp_get_reply_post_type($r); $this->assertSame('reply', $reply_type); }
/** * @covers ::bbp_reply_post_type * @covers ::bbp_get_reply_post_type */ public function test_bbp_reply_post_type() { $t = $this->factory->topic->create(); $r = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('topic_id' => $t))); $robj = get_post_type_object('reply'); // WordPress 4.6 introduced `WP_Post_Type` class if (bbp_get_major_wp_version() < 4.6) { $this->assertInstanceOf('stdClass', $robj); } else { $this->assertInstanceOf('WP_Post_Type', $robj); } $this->assertEquals('reply', $robj->name); // Test some defaults $this->assertFalse(is_post_type_hierarchical('topic')); $reply_type = bbp_reply_post_type($r); $this->expectOutputString('reply', $reply_type); $reply_type = bbp_get_reply_post_type($r); $this->assertSame('reply', $reply_type); }