Changeset 7784
- Timestamp:
- 10/04/2026 08:01:48 AM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/replies/template/reply.php
r6802 r7784 37 37 /** 38 38 * @covers ::bbp_get_reply 39 * @todo Implement test_bbp_get_reply().40 39 */ 41 40 public function test_bbp_get_reply() { 42 // Remove the following lines when you implement this test. 43 $this->markTestIncomplete( 44 'This test has not been implemented yet.' 45 ); 41 $topic_id = $this->factory->topic->create(); 42 $reply_id = $this->factory->reply->create( array( 'post_parent' => $topic_id ) ); 43 $forum_id = $this->factory->forum->create(); 44 45 $this->assertSame( $reply_id, bbp_get_reply( $reply_id )->ID ); 46 $this->assertSame( $reply_id, bbp_get_reply( get_post( $reply_id ) )->ID ); 47 $this->assertSame( $reply_id, bbp_get_reply( $reply_id, ARRAY_A )['ID'] ); 48 $this->assertTrue( in_array( $reply_id, bbp_get_reply( $reply_id, ARRAY_N ), true ) ); 49 $this->assertNull( bbp_get_reply( $forum_id ) ); 46 50 } 47 51 … … 575 579 * @covers ::bbp_reply_class 576 580 * @covers ::bbp_get_reply_class 577 * @todo Implement test_bbp_get_reply_class().578 581 */ 579 582 public function test_bbp_get_reply_class() { 580 // Remove the following lines when you implement this test. 581 $this->markTestIncomplete( 582 'This test has not been implemented yet.' 583 ); 583 $forum_id = $this->factory->forum->create(); 584 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id ) ); 585 $reply_id = $this->factory->reply->create( array( 'post_parent' => $topic_id ) ); 586 $classes = bbp_get_reply_class( $reply_id, array( 'extra-reply-class' ) ); 587 588 $this->assertStringContainsString( 'bbp-parent-topic-' . $topic_id, $classes ); 589 $this->assertStringContainsString( 'bbp-parent-forum-' . $forum_id, $classes ); 590 $this->assertStringContainsString( 'bbp-reply-position-', $classes ); 591 $this->assertStringContainsString( 'extra-reply-class', $classes ); 592 $this->expectOutputString( $classes ); 593 bbp_reply_class( $reply_id, array( 'extra-reply-class' ) ); 584 594 } 585 595 … … 587 597 * @covers ::bbp_topic_pagination_count 588 598 * @covers ::bbp_get_topic_pagination_count 589 * @todo Implement test_bbp_get_topic_pagination_count().590 599 */ 591 600 public function test_bbp_get_topic_pagination_count() { 592 // Remove the following lines when you implement this test. 593 $this->markTestIncomplete( 594 'This test has not been implemented yet.' 595 ); 601 $topic_id = $this->factory->topic->create(); 602 $this->factory->reply->create_many( 2, array( 'post_parent' => $topic_id ) ); 603 bbp_has_replies( array( 'post_type' => bbp_get_reply_post_type(), 'post_parent' => $topic_id ) ); 604 $count = bbp_get_topic_pagination_count(); 605 606 $this->assertStringContainsString( 'Viewing', $count ); 607 $this->assertStringContainsString( '2 total', $count ); 608 $this->expectOutputString( $count ); 609 bbp_topic_pagination_count(); 596 610 } 597 611 }
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)