/**
  * @param string $input
  * @param string $expected
  * @dataProvider getRenderStaticData
  * @test
  */
 public function testRender($input, $expected)
 {
     $instance = new SpacelessViewHelper();
     $instance->setRenderChildrenClosure(function () use($input) {
         return $input;
     });
     $instance->setRenderingContext($this->getMock(RenderingContextInterface::class));
     $instance->setArguments(array());
     $this->assertEquals($expected, $instance->render());
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function renderWithEmptyChildNodesReturnsNoOutput()
 {
     $instance = new SpacelessViewHelper();
     $viewHelperNodeProphecy = $this->prophesize(ViewHelperNode::class);
     $instance->setViewHelperNode($viewHelperNodeProphecy->reveal());
     $renderingContextInterfaceProphecy = $this->prophesize(RenderingContextInterface::class);
     $instance->setRenderingContext($renderingContextInterfaceProphecy->reveal());
     $instance->setArguments([]);
     // the render method would not return an empty string in a real usage. The render method just
     // calls renderStatic, which does the actual work. The tests for this are done in the
     // renderStatic test directly. The render method test only makes sure the method call
     // raises no fatal error.
     $this->assertEquals('', $instance->render());
 }