Changeset 5880 for trunk/tests/phpunit/testcases/topics/template/links.php
- Timestamp:
- 07/24/2015 11:21:28 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/topics/template/links.php
r5878 r5880 59 59 60 60 $link = bbp_get_topic_freshness_link( $t ); 61 $this->assertSame( '<a href="http:// example.org/?topic=topic-1" title="">4 days, 4 hours ago</a>', $link );61 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1" title="">4 days, 4 hours ago</a>', $link ); 62 62 63 63 $r1 = $this->factory->reply->create( array( … … 71 71 72 72 $link = bbp_get_topic_freshness_link( $t ); 73 $this->assertSame( '<a href="http:// example.org/?topic=topic-1/#post-' . bbp_get_reply_id( $r1 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">3 days, 8 hours ago</a>', $link );73 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r1 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">3 days, 8 hours ago</a>', $link ); 74 74 75 75 $r2 = $this->factory->reply->create( array( … … 83 83 84 84 $link = bbp_get_topic_freshness_link( $t ); 85 $this->assertSame( '<a href="http://example.org/?topic=topic-1/#post-' . bbp_get_reply_id( $r2 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">2 days, 12 hours ago</a>', $link ); 85 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r2 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">2 days, 12 hours ago</a>', $link ); 86 87 // Retore the user 88 $this->set_current_user( $this->old_current_user ); 89 } 90 91 /** 92 * @covers ::bbp_get_topic_freshness_link 93 */ 94 public function test_bbp_get_topic_freshness_link_with_unpublished_replies() { 95 96 if ( is_multisite() ) { 97 $this->markTestSkipped( 'Skipping URL tests in multiste for now.' ); 98 } 99 100 $now = time(); 101 $post_date = date( 'Y-m-d H:i:s', $now - 60 * 60 * 20 ); // 2o hours ago 102 $post_date_r1 = date( 'Y-m-d H:i:s', $now - 60 * 60 * 18 ); // 18 hours ago 103 $post_date_r2 = date( 'Y-m-d H:i:s', $now - 60 * 60 * 16 ); // 16 hours ago 104 $post_date_r3 = date( 'Y-m-d H:i:s', $now - 60 * 60 * 14 ); // 14 hours ago 105 $post_date_r4 = date( 'Y-m-d H:i:s', $now - 60 * 60 * 12 ); // 12 hours ago 106 $post_date_r5 = date( 'Y-m-d H:i:s', $now - 60 * 60 * 10 ); // 1o hours ago 107 108 $f = $this->factory->forum->create(); 109 $t = $this->factory->topic->create( array( 110 'post_parent' => $f, 111 'post_date' => $post_date, 112 'topic_meta' => array( 113 'forum_id' => $f, 114 ), 115 ) ); 116 117 $link = bbp_get_topic_freshness_link( $t ); 118 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1" title="">20 hours ago</a>', $link ); 119 120 $r1 = $this->factory->reply->create( array( 121 'post_parent' => $t, 122 'post_date' => $post_date_r1, 123 'reply_meta' => array( 124 'forum_id' => $f, 125 'topic_id' => $t, 126 ), 127 ) ); 128 129 $link = bbp_get_topic_freshness_link( $t ); 130 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r1 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">18 hours ago</a>', $link ); 131 132 $r2 = $this->factory->reply->create( array( 133 'post_parent' => $t, 134 'post_date' => $post_date_r2, 135 'reply_meta' => array( 136 'forum_id' => $f, 137 'topic_id' => $t, 138 ), 139 ) ); 140 141 $link = bbp_get_topic_freshness_link( $t ); 142 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r2 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">16 hours ago</a>', $link ); 143 144 bbp_spam_reply( $r2 ); 145 146 $link = bbp_get_topic_freshness_link( $t ); 147 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r1 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">18 hours ago</a>', $link ); 148 149 $r3 = $this->factory->reply->create( array( 150 'post_parent' => $t, 151 'post_date' => $post_date_r3, 152 'reply_meta' => array( 153 'forum_id' => $f, 154 'topic_id' => $t, 155 ), 156 ) ); 157 158 $link = bbp_get_topic_freshness_link( $t ); 159 $this->assertSame( '<a href="http://example.org/?topic=topic-1/#post-' . bbp_get_reply_id( $r3 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">14 hours ago</a>', $link ); 160 161 // Todo: Use bbp_trash_reply() and not wp_trash_post() 162 wp_trash_post( $r3 ); 163 164 $link = bbp_get_topic_freshness_link( $t ); 165 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r1 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">18 hours ago</a>', $link ); 166 167 $r4 = $this->factory->reply->create( array( 168 'post_parent' => $t, 169 'post_date' => $post_date_r4, 170 'reply_meta' => array( 171 'forum_id' => $f, 172 'topic_id' => $t, 173 ), 174 ) ); 175 176 $link = bbp_get_topic_freshness_link( $t ); 177 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r4 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">12 hours ago</a>', $link ); 178 179 bbp_unapprove_reply( $r4 ); 180 181 $link = bbp_get_topic_freshness_link( $t ); 182 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r1 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">18 hours ago</a>', $link ); 183 184 bbp_unspam_reply( $r2 ); 185 186 $link = bbp_get_topic_freshness_link( $t ); 187 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r2 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">16 hours ago</a>', $link ); 188 189 // Todo: Use bbp_untrash_reply() and not wp_untrash_post() 190 wp_untrash_post( $r3 ); 191 192 $link = bbp_get_topic_freshness_link( $t ); 193 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r3 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">14 hours ago</a>', $link ); 194 195 bbp_approve_reply( $r4 ); 196 197 $link = bbp_get_topic_freshness_link( $t ); 198 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r4 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">12 hours ago</a>', $link ); 199 200 $r5 = $this->factory->reply->create( array( 201 'post_parent' => $t, 202 'post_date' => $post_date_r5, 203 'reply_meta' => array( 204 'forum_id' => $f, 205 'topic_id' => $t, 206 ), 207 ) ); 208 209 $link = bbp_get_topic_freshness_link( $t ); 210 $this->assertSame( '<a href="http://' . WP_TESTS_DOMAIN . '/?topic=topic-1/#post-' . bbp_get_reply_id( $r5 ) . '" title="Reply To: ' . bbp_get_topic_title( $t ) . '">10 hours ago</a>', $link ); 86 211 } 87 212
Note: See TracChangeset
for help on using the changeset viewer.