/** * @since 2.2 * * @return array|null */ public function parse($value) { list($namespace, $section) = $this->tryToSplitByNamespaceSection($value); if ($this->errors !== array()) { return null; } list($uri, $name, $typelist) = $this->doParse($this->controlledVocabularyImportContentFetcher->fetchFor($namespace)); $type = $this->checkForValidType($namespace, $section, $uri, $typelist); if ($this->errors !== array()) { return null; } return array($namespace, $section, $uri, $name, $type); }
public function testForNotImportedNamespace() { $mediaWikiNsContentReader = $this->getMockBuilder('\\SMW\\MediaWiki\\MediaWikiNsContentReader')->disableOriginalConstructor()->getMock(); $mediaWikiNsContentReader->expects($this->atLeastOnce())->method('read')->will($this->returnValue('')); $instance = new ControlledVocabularyImportContentFetcher($mediaWikiNsContentReader); $this->assertFalse($instance->contains('Foo')); $this->assertEmpty($instance->fetchFor('Foo')); }