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')); }
/** * @return array|null */ private function tryToSplitByNamespaceSection($value) { if (strpos($value, ':') === false) { $this->errors[] = array('smw-datavalue-import-invalid-value', $value); return null; } list($namespace, $section) = explode(':', $value, 2); // Check that elements exists for the namespace if (!$this->controlledVocabularyImportContentFetcher->contains($namespace)) { $this->errors[] = array('smw-datavalue-import-unknown-namespace', $namespace); return null; } return array($namespace, $section); }