Esempio n. 1
0
 /**
  * @dataProvider setParserProvider
  */
 public function testInstantiatedPropertyValues(array $params, array $expected)
 {
     $parserData = $this->applicationFactory->newParserData(Title::newFromText(__METHOD__), new ParserOutput());
     $messageFormatter = $this->getMockBuilder('\\SMW\\MessageFormatter')->disableOriginalConstructor()->getMock();
     $messageFormatter->expects($this->any())->method('addFromArray')->will($this->returnSelf());
     $instance = new SetParserFunction($parserData, $messageFormatter);
     $instance->parse(ParameterFormatterFactory::newFromArray($params));
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
 }
Esempio n. 2
0
 public function testTemplateSupport()
 {
     $params = array('Foo=bar', 'Foo=foobar', 'BarFoo=9001', 'template=FooTemplate');
     $expected = array('errors' => 0, 'propertyCount' => 2, 'propertyLabels' => array('Foo', 'BarFoo'), 'propertyValues' => array('Bar', '9001', 'Foobar'));
     $parserData = $this->applicationFactory->newParserData(Title::newFromText(__METHOD__), new ParserOutput());
     $messageFormatter = $this->getMockBuilder('\\SMW\\MessageFormatter')->disableOriginalConstructor()->getMock();
     $messageFormatter->expects($this->any())->method('addFromArray')->will($this->returnSelf());
     $templateRenderer = new WikitextTemplateRenderer();
     $instance = new SetParserFunction($parserData, $messageFormatter, $templateRenderer);
     $instance->parse(ParameterFormatterFactory::newFromArray($params));
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
 }