Changeset 7779
- Timestamp:
- 10/04/2026 07:31:31 AM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/topics/functions/status.php
r7475 r7779 12 12 /** 13 13 * @covers ::bbp_get_topic_statuses 14 * @todo Implement test_bbp_get_topic_statuses().15 14 */ 16 15 public function test_bbp_get_topic_statuses() { 17 // Remove the following lines when you implement this test. 18 $this->markTestIncomplete( 19 'This test has not been implemented yet.' 20 ); 16 $statuses = bbp_get_topic_statuses(); 17 18 $this->assertSame( array( 19 bbp_get_public_status_id(), 20 bbp_get_closed_status_id(), 21 bbp_get_spam_status_id(), 22 bbp_get_trash_status_id(), 23 bbp_get_pending_status_id(), 24 ), array_keys( $statuses ) ); 25 $this->assertSame( array( 'Open', 'Closed', 'Spam', 'Trash', 'Pending' ), array_values( $statuses ) ); 21 26 } 22 27 23 28 /** 24 29 * @covers ::bbp_get_topic_types 25 * @todo Implement test_bbp_get_topic_types().26 30 */ 27 31 public function test_bbp_get_topic_types() { 28 // Remove the following lines when you implement this test. 29 $this->markTestIncomplete( 30 'This test has not been implemented yet.' 31 ); 32 $types = bbp_get_topic_types(); 33 34 $this->assertSame( array( 'unstick', 'stick', 'super' ), array_keys( $types ) ); 35 $this->assertSame( array( 'Normal', 'Sticky', 'Super Sticky' ), array_values( $types ) ); 36 } 37 38 /** 39 * @covers ::bbp_get_topic_toggles 40 */ 41 public function test_bbp_get_topic_toggles() { 42 $this->assertSame( array( 43 'bbp_toggle_topic_close', 44 'bbp_toggle_topic_stick', 45 'bbp_toggle_topic_spam', 46 'bbp_toggle_topic_trash', 47 'bbp_toggle_topic_approve', 48 ), bbp_get_topic_toggles() ); 49 } 50 51 /** 52 * @covers ::bbp_get_public_topic_statuses 53 * @covers ::bbp_get_non_public_topic_statuses 54 */ 55 public function test_bbp_get_topic_visibility_statuses() { 56 $this->assertSame( array( 57 bbp_get_public_status_id(), 58 bbp_get_closed_status_id(), 59 ), bbp_get_public_topic_statuses() ); 60 $this->assertSame( array( 61 bbp_get_trash_status_id(), 62 bbp_get_spam_status_id(), 63 bbp_get_pending_status_id(), 64 ), bbp_get_non_public_topic_statuses() ); 32 65 } 33 66 34 67 /** 35 68 * @covers ::bbp_get_stickies 36 * @todo Implement test_bbp_get_stickies().37 69 */ 38 70 public function test_bbp_get_stickies() { 39 // Remove the following lines when you implement this test. 40 $this->markTestIncomplete( 41 'This test has not been implemented yet.' 42 ); 71 $forum_id = $this->factory->forum->create(); 72 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id ) ); 73 74 $this->assertSame( array(), bbp_get_stickies( $forum_id ) ); 75 $this->assertTrue( bbp_stick_topic( $topic_id ) ); 76 $this->assertSame( array( $topic_id ), bbp_get_stickies( $forum_id ) ); 77 $this->assertSame( array(), bbp_get_stickies() ); 43 78 } 44 79 45 80 /** 46 81 * @covers ::bbp_get_super_stickies 47 * @todo Implement test_bbp_get_super_stickies().48 82 */ 49 83 public function test_bbp_get_super_stickies() { 50 // Remove the following lines when you implement this test. 51 $this->markTestIncomplete( 52 'This test has not been implemented yet.' 53 ); 84 $forum_id = $this->factory->forum->create(); 85 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id ) ); 86 87 $this->assertSame( array(), bbp_get_super_stickies() ); 88 $this->assertTrue( bbp_stick_topic( $topic_id, true ) ); 89 $this->assertSame( array( $topic_id ), bbp_get_super_stickies() ); 90 $this->assertSame( array( $topic_id ), bbp_get_stickies() ); 54 91 } 55 92 56 93 /** 57 94 * @covers ::bbp_close_topic 58 * @todo Implement test_bbp_close_topic().59 95 */ 60 96 public function test_bbp_close_topic() { 61 // Remove the following lines when you implement this test. 62 $this->markTestIncomplete( 63 'This test has not been implemented yet.' 64 ); 97 $topic_id = $this->factory->topic->create(); 98 99 $this->assertSame( $topic_id, bbp_close_topic( $topic_id ) ); 100 $this->assertSame( bbp_get_closed_status_id(), get_post_status( $topic_id ) ); 101 $this->assertSame( bbp_get_public_status_id(), get_post_meta( $topic_id, '_bbp_status', true ) ); 102 $this->assertFalse( bbp_close_topic( $topic_id ) ); 65 103 } 66 104 67 105 /** 68 106 * @covers ::bbp_open_topic 69 * @todo Implement test_bbp_open_topic().70 107 */ 71 108 public function test_bbp_open_topic() { 72 // Remove the following lines when you implement this test. 73 $this->markTestIncomplete( 74 'This test has not been implemented yet.' 75 ); 109 $topic_id = $this->factory->topic->create(); 110 111 $this->assertFalse( bbp_open_topic( $topic_id ) ); 112 bbp_close_topic( $topic_id ); 113 $this->assertSame( $topic_id, bbp_open_topic( $topic_id ) ); 114 $this->assertSame( bbp_get_public_status_id(), get_post_status( $topic_id ) ); 115 $this->assertSame( '', get_post_meta( $topic_id, '_bbp_status', true ) ); 116 } 117 118 /** 119 * @covers ::bbp_close_topic 120 * @covers ::bbp_open_topic 121 */ 122 public function test_bbp_open_topic_restores_previous_pending_status() { 123 $topic_id = $this->factory->topic->create( array( 'post_status' => bbp_get_pending_status_id() ) ); 124 125 $this->assertSame( $topic_id, bbp_close_topic( $topic_id ) ); 126 $this->assertSame( bbp_get_pending_status_id(), get_post_meta( $topic_id, '_bbp_status', true ) ); 127 $this->assertSame( $topic_id, bbp_open_topic( $topic_id ) ); 128 $this->assertSame( bbp_get_pending_status_id(), get_post_status( $topic_id ) ); 76 129 } 77 130 … … 544 597 /** 545 598 * @covers ::bbp_stick_topic 546 * @todo Implement test_bbp_stick_topic().547 599 */ 548 600 public function test_bbp_stick_topic() { 549 // Remove the following lines when you implement this test. 550 $this->markTestIncomplete( 551 'This test has not been implemented yet.' 552 ); 601 $forum_id = $this->factory->forum->create(); 602 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id ) ); 603 604 $this->assertFalse( bbp_stick_topic( $forum_id ) ); 605 $this->assertTrue( bbp_stick_topic( $topic_id ) ); 606 $this->assertSame( array( $topic_id ), bbp_get_stickies( $forum_id ) ); 607 $this->assertTrue( bbp_stick_topic( $topic_id, true ) ); 608 $this->assertSame( array( $topic_id ), bbp_get_super_stickies() ); 553 609 } 554 610 555 611 /** 556 612 * @covers ::bbp_approve_topic 557 * @todo Implement test_bbp_approve_topic().558 613 */ 559 614 public function test_bbp_approve_topic() { 560 // Remove the following lines when you implement this test. 561 $this->markTestIncomplete( 562 'This test has not been implemented yet.' 563 ); 615 $topic_id = $this->factory->topic->create( array( 'post_status' => bbp_get_pending_status_id() ) ); 616 617 $this->assertSame( bbp_get_pending_status_id(), get_post_status( $topic_id ) ); 618 $this->assertSame( $topic_id, bbp_approve_topic( $topic_id ) ); 619 $this->assertSame( bbp_get_public_status_id(), get_post_status( $topic_id ) ); 620 $this->assertFalse( bbp_approve_topic( $topic_id ) ); 564 621 } 565 622 566 623 /** 567 624 * @covers ::bbp_unapprove_topic 568 * @todo Implement test_bbp_unapprove_topic().569 625 */ 570 626 public function test_bbp_unapprove_topic() { 571 // Remove the following lines when you implement this test. 572 $this->markTestIncomplete( 573 'This test has not been implemented yet.' 574 ); 627 $topic_id = $this->factory->topic->create(); 628 629 $this->assertSame( $topic_id, bbp_unapprove_topic( $topic_id ) ); 630 $this->assertSame( bbp_get_pending_status_id(), get_post_status( $topic_id ) ); 631 $this->assertFalse( bbp_unapprove_topic( $topic_id ) ); 575 632 } 576 633 577 634 /** 578 635 * @covers ::bbp_unstick_topic 579 * @todo Implement test_bbp_unstick_topic().580 636 */ 581 637 public function test_bbp_unstick_topic() { 582 // Remove the following lines when you implement this test. 583 $this->markTestIncomplete( 584 'This test has not been implemented yet.' 585 ); 638 $forum_id = $this->factory->forum->create(); 639 $topic_id = $this->factory->topic->create( array( 'post_parent' => $forum_id ) ); 640 641 $this->assertTrue( bbp_unstick_topic( $topic_id ) ); 642 bbp_stick_topic( $topic_id ); 643 $this->assertTrue( bbp_unstick_topic( $topic_id ) ); 644 $this->assertSame( array(), bbp_get_stickies( $forum_id ) ); 645 bbp_stick_topic( $topic_id, true ); 646 $this->assertTrue( bbp_unstick_topic( $topic_id ) ); 647 $this->assertSame( array(), bbp_get_super_stickies() ); 586 648 } 587 649 }
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)