Example #1
0
 /**
  * Returns the shortcode rendered markup code.
  *
  * @param string|array $attributes An array of shortcode attributes.
  * @param string $content The shortcode content.
  *
  * @return string
  */
 public function render($attributes = array(), $content = '')
 {
     $data = $this->template_data;
     $data['comment_text'] = $this->get_comment_text($attributes, $content);
     $data['post_id'] = $this->context->get_post_id();
     return $this->render_engine->render($this->template_slug, $data);
 }
 /**
  * @test
  * it should render the comments count display if there are idlikethis comments associated with
  * the post
  */
 public function it_should_render_the_comments_count_display_if_there_are_idlikethis_comments_associated_with_the_post()
 {
     $post = $this->factory()->post->create_and_get();
     $comments = $this->factory()->comment->create_many(10);
     $this->commments_repository->get_votes_for_post($post)->willReturn(['first idea' => array_splice($comments, 0, 5), 'second idea' => $comments]);
     $this->texts_provider->get_comments_title_text()->shouldBeCalled();
     $this->render_engine->render(Argument::any(), Argument::any())->shouldBeCalled();
     $sut = $this->make_instance();
     $sut->render($post, []);
 }
 /**
  * Echoes the meta box markup to the page.
  *
  * @param string|WP_Post|array $object
  * @param array|mixed $box The meta box registration description.
  * @return void
  */
 public function render($object, $box)
 {
     $comments = $this->comments_repository->get_votes_for_post($object);
     if (empty($comments)) {
         $this->template_data['has_comments'] = false;
         $this->template_data['header_text'] = $this->texts->get_empty_comments_text();
     } else {
         $this->template_data['has_comments'] = true;
         $this->template_date['header_text'] = $this->texts->get_comments_title_text();
         $this->template_data['reset_all_text'] = $this->texts->get_reset_all_text();
         $this->template_data['consolidate_all_text'] = $this->texts->get_consolidate_all_text();
         $this->template_data['post_id'] = $this->context->get_post_id();
     }
     echo $this->render_engine->render($this->template_slug, $this->template_data);
 }
 /**
  * Echoes the meta box markup to the page.
  *
  * @param string|WP_Post|array $object
  * @param array|mixed $box The meta box registration description.
  * @return void
  */
 public function render($object, $box)
 {
     $comments = $this->comments_repository->get_votes_for_post($object);
     if (empty($comments)) {
         $this->template_data['has_comments'] = false;
         $this->template_data['header_text'] = $this->texts->get_empty_comments_text();
     } else {
         $this->template_data['has_comments'] = true;
         $this->template_data['header_text'] = $this->texts->get_comments_title_text();
         array_walk($comments, array($this, 'count_comments'));
         arsort($comments);
         $this->template_data['rows'] = $comments;
     }
     echo $this->render_engine->render($this->template_slug, $this->template_data);
 }
 private function make_instance()
 {
     return new PostControlMetaBox($this->comments_repository->reveal(), $this->rendering_engine->reveal(), $this->texts_provider->reveal(), $this->context->reveal());
 }