/**
  * @since since 2.2
  *
  * @return string
  */
 public function render()
 {
     $wikiText = $this->wikitextTemplateRenderer->render();
     if ($wikiText === '') {
         return '';
     }
     return $this->parser->recursiveTagParse($wikiText);
 }
 private function addFieldsToTemplate($template, $dataValue, $property, $value, $isLastElement, &$count)
 {
     if ($template === '' || !$dataValue->isValid()) {
         return '';
     }
     $this->templateRenderer->addField('property', $property);
     $this->templateRenderer->addField('value', $value);
     $this->templateRenderer->addField('last-element', $isLastElement);
     $this->templateRenderer->addField('#', $count++);
     $this->templateRenderer->packFieldsForTemplate($template);
 }
 public function testRenderTemplate()
 {
     $instance = new WikitextTemplateRenderer();
     $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');
     $this->assertEquals('{{Bar|property=Foo|value=42}}{{Foobaz|property=Bar|value=Foo}}', $instance->render());
     $this->assertEmpty($instance->render());
 }