/** * @test */ public function testEscapesNodeOverriddenWithAddChildNode() { $string1 = '<strong>escape me</strong>'; $string2 = '<strong>no, escape me!</strong>'; $node = new EscapingNode(new TextNode($string1)); $node->addChildNode(new TextNode($string2)); $renderingContext = new RenderingContextFixture(); $this->assertEquals($node->evaluate($renderingContext), htmlspecialchars($string2, ENT_QUOTES)); }
/** * @param EscapingNode $node * @return array */ protected function convertEscapingNode(EscapingNode $node) { $configuration = $this->convert($node->getNode()); $configuration['execution'] = sprintf('htmlspecialchars(%s, ENT_QUOTES)', $configuration['execution']); return $configuration; }