/** * @dataProvider provideMutateParserOutput */ public function testMutateParserOutput($references, $expectedItems) { list($workflow, $revision, $title) = $this->getBlandTestObjects(); /* * Because the data provider is static, we can't access $this->workflow * in there. Once of the things being tested is a subpage link. * Thus, we would have to provide the correct namespace & title for * $this->workflow->getArticleTitle(), under which the subpage will be * created. * Let's work around this by overwriting $workflow->title to a "known" * value, so that we can hardcode that into the expected return value in * the static provider. */ $title = static::getTestTitle(); $reflectionWorkflow = new \ReflectionObject($workflow); $reflectionProperty = $reflectionWorkflow->getProperty('title'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($workflow, $title); $references = $this->expandReferences($workflow, $revision, $references); $parserOutput = new \ParserOutput(); // Clear the LinksUpdate to allow clean testing foreach (array_keys($expectedItems) as $fieldName) { $parserOutput->{$fieldName} = array(); } $this->updater->mutateParserOutput($title, $parserOutput, $references); foreach ($expectedItems as $method => $content) { $this->assertEquals($content, $parserOutput->{$method}(), $method); } }