Changeset 7809
- Timestamp:
- 10/04/2026 12:46:34 PM (5 weeks ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
CHANGELOG.md (modified) (1 diff)
-
src/includes/topics/template.php (modified) (2 diffs)
-
tests/phpunit/testcases/topics/template/topic-tag.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CHANGELOG.md
r7807 r7809 45 45 ### Fixed 46 46 47 - Used explicitly supplied topic tags in edit links and passed their slug to description filters. 47 48 - Prevented threaded reply ancestry from including an invalid parent and avoided redundant reply-position writes. 48 49 - Restored assigned moderator names in forum edit forms and corrected forum type and visibility dropdown behavior. -
trunk/src/includes/topics/template.php
r7731 r7809 3853 3853 // Pretty or ugly URL 3854 3854 $retval = bbp_use_pretty_urls() 3855 ? user_trailingslashit( trailingslashit( bbp_get_topic_tag_link( ) ) . bbp_get_edit_slug() )3856 : add_query_arg( array( bbp_get_edit_rewrite_id() => '1' ), bbp_get_topic_tag_link( ) );3855 ? user_trailingslashit( trailingslashit( bbp_get_topic_tag_link( $tag ) ) . bbp_get_edit_slug() ) 3856 : add_query_arg( array( bbp_get_edit_rewrite_id() => '1' ), bbp_get_topic_tag_link( $tag ) ); 3857 3857 3858 3858 // No link … … 3897 3897 3898 3898 // Get the term 3899 if ( ! empty( $r['tag'] ) ) { 3900 $term = get_term_by( 'slug', $r['tag'], bbp_get_topic_tag_tax_id() ); 3899 $tag = $r['tag']; 3900 if ( ! empty( $tag ) ) { 3901 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3901 3902 } else { 3902 $tag = $r['tag'] = get_query_var( 'term' );3903 $tag = $r['tag'] = get_query_var( 'term' ); 3903 3904 $term = get_queried_object(); 3904 3905 } -
trunk/tests/phpunit/testcases/topics/template/topic-tag.php
r7791 r7809 135 135 * @covers ::bbp_topic_tag_edit_link 136 136 * @covers ::bbp_get_topic_tag_edit_link 137 * @todo Implement test_bbp_get_topic_tag_edit_link().138 137 */ 139 138 public function test_bbp_get_topic_tag_edit_link() { 140 // Remove the following lines when you implement this test. 141 $this->markTestIncomplete( 142 'This test has not been implemented yet.' 143 ); 139 $term = wp_insert_term( 'Alpha', bbp_get_topic_tag_tax_id(), array( 'slug' => 'alpha' ) ); 140 $this->assertFalse( is_wp_error( $term ) ); 141 $link = bbp_get_topic_tag_link( 'alpha' ); 142 $this->assertSame( '', bbp_get_topic_tag_edit_link( 'missing-tag' ) ); 143 144 add_filter( 'bbp_pretty_urls', '__return_false' ); 145 try { 146 $edit_link = add_query_arg( array( bbp_get_edit_rewrite_id() => '1' ), $link ); 147 $this->assertSame( $edit_link, bbp_get_topic_tag_edit_link( 'alpha' ) ); 148 $this->expectOutputString( esc_url( $edit_link ) ); 149 bbp_topic_tag_edit_link( 'alpha' ); 150 remove_filter( 'bbp_pretty_urls', '__return_false' ); 151 add_filter( 'bbp_pretty_urls', '__return_true' ); 152 $this->assertSame( user_trailingslashit( trailingslashit( $link ) . bbp_get_edit_slug() ), bbp_get_topic_tag_edit_link( 'alpha' ) ); 153 } finally { 154 remove_filter( 'bbp_pretty_urls', '__return_false' ); 155 remove_filter( 'bbp_pretty_urls', '__return_true' ); 156 } 144 157 } 145 158 … … 147 160 * @covers ::bbp_topic_tag_description 148 161 * @covers ::bbp_get_topic_tag_description 149 * @todo Implement test_bbp_get_topic_tag_description().150 162 */ 151 163 public function test_bbp_get_topic_tag_description() { 152 // Remove the following lines when you implement this test. 153 $this->markTestIncomplete( 154 'This test has not been implemented yet.' 155 ); 164 $term = wp_insert_term( 'Alpha', bbp_get_topic_tag_tax_id(), array( 'slug' => 'alpha', 'description' => 'Alpha description' ) ); 165 $this->assertFalse( is_wp_error( $term ) ); 166 $args = array( 'tag' => 'alpha', 'before' => '<p>', 'after' => '</p>' ); 167 $seen = array(); 168 $filter = function ( $description, $parsed, $original, $tag, $term ) use ( &$seen ) { 169 $seen[] = array( $tag, $term->term_id ); 170 return $description; 171 }; 172 add_filter( 'bbp_get_topic_tag_description', $filter, 10, 5 ); 173 174 try { 175 $this->assertSame( '<p>Alpha description</p>', bbp_get_topic_tag_description( $args ) ); 176 $this->assertSame( array( array( 'alpha', $term['term_id'] ) ), $seen ); 177 $this->expectOutputString( '<p>Alpha description</p>' ); 178 bbp_topic_tag_description( $args ); 179 } finally { 180 remove_filter( 'bbp_get_topic_tag_description', $filter, 10 ); 181 } 156 182 } 157 183 }
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)