protected function parseUserValue($value) { $this->m_qname = $value; list($this->m_namespace, $this->m_section, $this->m_uri, $this->m_name, $this->termType) = $this->importValueParser->parse($value); if ($this->importValueParser->getErrors() !== array()) { $this->addError(call_user_func_array('wfMessage', $this->importValueParser->getErrors())->inContentLanguage()->text()); $this->m_dataitem = new DIBlob('ERROR'); return; } // Encoded string for DB storage $this->m_dataitem = new DIBlob($this->m_namespace . ' ' . $this->m_section . ' ' . $this->m_uri . ' ' . $this->termType); // check whether caption is set, otherwise assign link statement to caption if ($this->m_caption === false) { $this->m_caption = "[" . $this->m_uri . " " . $this->m_qname . "] " . $this->modifyToIncludeParentheses($this->m_name); } }
/** * @dataProvider validMatchTypeContent */ public function testParseForValidValueToMatchType($content, $parseValue, $expected) { $controlledVocabularyImportContentFetcher = $this->getMockBuilder('\\SMW\\ControlledVocabularyImportContentFetcher')->disableOriginalConstructor()->getMock(); $controlledVocabularyImportContentFetcher->expects($this->once())->method('contains')->will($this->returnValue(true)); $controlledVocabularyImportContentFetcher->expects($this->once())->method('fetchFor')->will($this->returnValue($content)); $instance = new ImportValueParser($controlledVocabularyImportContentFetcher); $result = $instance->parse($parseValue); $this->assertEmpty($instance->getErrors()); foreach ($result as $key => $value) { $this->assertEquals($expected[$key], $value); } }