/** * @test * it should show a nothing to control text if there are not idlikethis comments associated to the post */ public function it_should_show_a_nothing_to_control_text_if_there_are_not_idlikethis_comments_associated_to_the_post() { $post = $this->factory()->post->create_and_get(); $this->comments_repository->get_votes_for_post($post)->willReturn([]); $this->texts_provider->get_empty_comments_text()->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); }