Example #1
0
 /**
  * @covers ::bbp_forum_topic_count_hidden
  * @covers ::bbp_get_forum_topic_count_hidden
  */
 public function test_bbp_get_forum_topic_count_hidden()
 {
     $c = $this->factory->forum->create(array('forum_meta' => array('forum_type' => 'category')));
     $f = $this->factory->forum->create(array('post_parent' => $c, 'forum_meta' => array('forum_id' => $c)));
     $int_value = 3;
     $formatted_value = bbp_number_format($int_value);
     $this->factory->topic->create_many($int_value, array('post_parent' => $f, 'post_status' => bbp_get_spam_status_id()));
     bbp_update_forum_topic_count_hidden($c);
     bbp_update_forum_topic_count_hidden($f);
     // Forum output.
     $count = bbp_get_forum_topic_count_hidden($f, false);
     $this->expectOutputString($formatted_value);
     bbp_forum_topic_count_hidden($f);
     // Forum formatted string.
     $count = bbp_get_forum_topic_count_hidden($f, false);
     $this->assertSame($formatted_value, $count);
     // Forum integer.
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame($int_value, $count);
     // Category topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($c, true);
     $this->assertSame(0, $count);
     // Category total topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($c, true);
     $this->assertSame(0, $count);
 }
Example #2
0
 /**
  * @covers ::bbp_forum_topic_count_hidden
  * @covers ::bbp_get_forum_topic_count_hidden
  */
 public function test_bbp_get_forum_topic_count_hidden()
 {
     $f = $this->factory->forum->create();
     $int_value = 3;
     $formatted_value = bbp_number_format($int_value);
     $this->factory->topic->create_many($int_value, array('post_parent' => $f, 'post_status' => bbp_get_spam_status_id()));
     bbp_update_forum_topic_count_hidden($f);
     // Output
     $count = bbp_get_forum_topic_count_hidden($f, false);
     $this->expectOutputString($formatted_value);
     bbp_forum_topic_count_hidden($f);
     // Formatted string
     $count = bbp_get_forum_topic_count_hidden($f, false);
     $this->assertSame($formatted_value, $count);
     // Integer
     $count = bbp_get_forum_topic_count_hidden($f, true, true);
     $this->assertSame($int_value, $count);
 }