/** * @covers ::bbp_topic_post_type * @covers ::bbp_get_topic_post_type */ public function test_bbp_topic_post_type() { $t = $this->factory->topic->create(); $tobj = get_post_type_object('topic'); $this->assertInstanceOf('stdClass', $tobj); $this->assertEquals('topic', $tobj->name); // Test some defaults $this->assertFalse(is_post_type_hierarchical('topic')); $topic_type = bbp_topic_post_type($t); $this->expectOutputString('topic', $topic_type); $topic_type = bbp_get_topic_post_type($t); $this->assertSame('topic', $topic_type); }
/** * @covers ::bbp_topic_post_type * @covers ::bbp_get_topic_post_type */ public function test_bbp_topic_post_type() { $t = $this->factory->topic->create(); $tobj = get_post_type_object('topic'); // WordPress 4.6 introduced `WP_Post_Type` class if (bbp_get_major_wp_version() < 4.6) { $this->assertInstanceOf('stdClass', $tobj); } else { $this->assertInstanceOf('WP_Post_Type', $tobj); } $this->assertEquals('topic', $tobj->name); // Test some defaults $this->assertFalse(is_post_type_hierarchical('topic')); $topic_type = bbp_topic_post_type($t); $this->expectOutputString('topic', $topic_type); $topic_type = bbp_get_topic_post_type($t); $this->assertSame('topic', $topic_type); }