/** * @test * it should return the escaped content if provided */ public function it_should_return_the_escaped_content_if_provided() { $sut = $this->make_instance(); $this->context->get_post_id()->willReturn(23); $this->context->get_comment_text()->willReturn('default text'); $content = 'some&content$$<>'; $this->render_engine->render(Argument::any(), Argument::withEntry('comment_text', esc_attr($content)))->shouldBeCalled(); $out = $sut->render([], $content); }
/** * @test * it should call the render engine with data when rendering */ public function it_should_call_the_render_engine_with_data_when_rendering() { $sut = $this->make_instance(); $this->context->get_comment_text()->willReturn('some text'); $this->context->get_post_id()->willReturn(23); $data = array('some' => 'value', 'some_other' => 'value', 'comment_text' => 'some text', 'post_id' => 23); $sut->set_template_slug('some/slug'); $sut->set_template_data($data); $this->render_engine->render('some/slug', $data)->shouldBeCalled(); $sut->render(); }