Changeset 5879
- Timestamp:
- 07/24/2015 09:46:21 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/topics/template/topic.php
r5811 r5879 23 23 * @covers ::bbp_topic_id 24 24 * @covers ::bbp_get_topic_id 25 * @todo Implement test_bbp_get_topic_id().26 25 */ 27 26 public function test_bbp_get_topic_id() { 28 // Remove the following lines when you implement this test. 29 $this->markTestIncomplete( 30 'This test has not been implemented yet.' 31 ); 27 $f = $this->factory->forum->create(); 28 $t = $this->factory->topic->create( array( 29 'post_parent' => $f, 30 'topic_meta' => array( 31 'forum_id' => $f, 32 ), 33 ) ); 34 35 $topic_id = bbp_get_topic_id( $t ); 36 $this->assertSame( $t, $topic_id ); 32 37 } 33 38 … … 46 51 * @covers ::bbp_topic_permalink 47 52 * @covers ::bbp_get_topic_permalink 48 * @todo Implement test_bbp_get_topic_permalink().49 53 */ 50 54 public function test_bbp_get_topic_permalink() { 51 // Remove the following lines when you implement this test. 52 $this->markTestIncomplete( 53 'This test has not been implemented yet.' 54 ); 55 if ( is_multisite() ) { 56 $this->markTestSkipped( 'Skipping URL tests in multiste for now.' ); 57 } 58 $f = $this->factory->forum->create(); 59 $t = $this->factory->topic->create( array( 60 'post_parent' => $f, 61 'topic_meta' => array( 62 'forum_id' => $f, 63 ), 64 ) ); 65 66 $topic_permalink = bbp_get_topic_permalink( $t ); 67 68 $this->expectOutputString( $topic_permalink ); 69 bbp_topic_permalink( $t ); 70 71 $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/?topic=topic-1', $topic_permalink ); 55 72 } 56 73 … … 58 75 * @covers ::bbp_topic_title 59 76 * @covers ::bbp_get_topic_title 60 * @todo Implement test_bbp_get_topic_title().61 77 */ 62 78 public function test_bbp_get_topic_title() { 63 // Remove the following lines when you implement this test. 64 $this->markTestIncomplete( 65 'This test has not been implemented yet.' 66 ); 79 $f = $this->factory->forum->create(); 80 $t = $this->factory->topic->create( array( 81 'post_parent' => $f, 82 'topic_meta' => array( 83 'forum_id' => $f, 84 ), 85 ) ); 86 87 $topic_title = bbp_get_topic_title( $t ); 88 $this->assertSame( 'Topic 1', $topic_title ); 67 89 } 68 90 … … 82 104 * @covers ::bbp_topic_content 83 105 * @covers ::bbp_get_topic_content 84 * @todo Implement test_bbp_get_topic_content().85 106 */ 86 107 public function test_bbp_get_topic_content() { 87 // Remove the following lines when you implement this test. 88 $this->markTestIncomplete( 89 'This test has not been implemented yet.' 90 ); 108 $f = $this->factory->forum->create(); 109 $t = $this->factory->topic->create( array( 110 'post_parent' => $f, 111 'topic_meta' => array( 112 'forum_id' => $f, 113 ), 114 ) ); 115 116 remove_all_filters( 'bbp_get_topic_content' ); 117 $topic_content = bbp_get_topic_content( $t ); 118 $this->assertSame( 'Content of Topic 1', $topic_content ); 91 119 } 92 120 … … 94 122 * @covers ::bbp_topic_excerpt 95 123 * @covers ::bbp_get_topic_excerpt 96 * @todo Implement test_bbp_get_topic_excerpt().97 124 */ 98 125 public function test_bbp_get_topic_excerpt() { 99 // Remove the following lines when you implement this test. 100 $this->markTestIncomplete( 101 'This test has not been implemented yet.' 102 ); 126 $f = $this->factory->forum->create(); 127 $t = $this->factory->topic->create( array( 128 'post_parent' => $f, 129 'post_content' => 'Talk about telekinetic activity, look at this mess!', 130 'topic_meta' => array( 131 'forum_id' => $f, 132 ), 133 ) ); 134 135 remove_all_filters( 'bbp_get_topic_content' ); 136 $topic_excerpt = bbp_get_topic_excerpt( $t, 23 ); 137 $this->assertSame( 'Talk about telekinetic…', $topic_excerpt ); 103 138 } 104 139 … … 159 194 * @covers ::bbp_topic_forum_title 160 195 * @covers ::bbp_get_topic_forum_title 161 * @todo Implement test_bbp_get_topic_forum_title().162 196 */ 163 197 public function test_bbp_get_topic_forum_title() { 164 // Remove the following lines when you implement this test. 165 $this->markTestIncomplete( 166 'This test has not been implemented yet.' 167 ); 198 $f = $this->factory->forum->create(); 199 $t = $this->factory->topic->create( array( 200 'post_parent' => $f, 201 'topic_meta' => array( 202 'forum_id' => $f, 203 ), 204 ) ); 205 206 $topic_forum_title = bbp_get_topic_forum_title( $t ); 207 $this->assertSame( bbp_get_forum_title( $f ), $topic_forum_title ); 168 208 } 169 209 … … 171 211 * @covers ::bbp_topic_forum_id 172 212 * @covers ::bbp_get_topic_forum_id 173 * @todo Implement test_bbp_get_topic_forum_id().174 213 */ 175 214 public function test_bbp_get_topic_forum_id() { 176 // Remove the following lines when you implement this test. 177 $this->markTestIncomplete( 178 'This test has not been implemented yet.' 179 ); 215 $f = $this->factory->forum->create(); 216 $t = $this->factory->topic->create( array( 217 'post_parent' => $f, 218 'topic_meta' => array( 219 'forum_id' => $f, 220 ), 221 ) ); 222 223 $topic_forum_id = bbp_get_topic_forum_id( $t ); 224 $this->assertSame( $f, $topic_forum_id ); 180 225 } 181 226
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)