private function addFieldsToTemplate($template, $dataValue, $property, $value, &$count) { if ($template === '' || !$dataValue->isValid()) { return ''; } $this->templateRenderer->addField('property', $property); $this->templateRenderer->addField('value', $value); $this->templateRenderer->addField('#', $count++); $this->templateRenderer->packFieldsForTemplate($template); }
public function testRenderTemplate() { $parser = $this->getMockBuilder('\\Parser')->disableOriginalConstructor()->getMock(); $parser->expects($this->once())->method('recursiveTagParse')->with($this->stringContains('{{Bar|property=Foo|value=42}}{{Foobaz|property=Bar|value=Foo}}')); $instance = new HtmlTemplateRenderer(new WikitextTemplateRenderer(), $parser); $this->assertEmpty($instance->render()); $instance->addField('property', 'Foo'); $instance->addField('value', 42); $instance->packFieldsForTemplate('Bar'); $instance->addField('property', 'Bar'); $instance->addField('value', 'Foo'); $instance->packFieldsForTemplate('Foobaz'); $instance->render(); $this->assertEmpty($instance->render()); }