public function testError() { $instance = new DescriptionProcessor(); $instance->addError('abc'); $this->assertEquals(array('abc'), $instance->getErrors()); $instance->addErrorWithMsgKey('Foo'); $this->assertCount(2, $instance->getErrors()); }
private function finishLinkDescription($chunk, $hasNamespaces, $result, &$setNS) { if (is_null($result)) { // no useful information or concrete error found $this->descriptionProcessor->addErrorWithMsgKey('smw_unexpectedpart', $chunk); // was smw_badqueryatom } elseif (!$hasNamespaces && $setNS && !is_null($this->defaultNamespace)) { $result = $this->descriptionProcessor->constructConjunctiveCompoundDescriptionFrom($result, $this->defaultNamespace); $hasNamespaces = true; } $setNS = $hasNamespaces; if ($chunk == '|') { // skip content after single |, but report a warning // Note: Using "|label" in query atoms used to be a way to set the mainlabel in SMW <1.0; no longer supported now $chunk = $this->readChunk('\\]\\]'); $labelpart = '|'; if ($chunk != ']]') { $labelpart .= $chunk; $chunk = $this->readChunk('\\]\\]'); } $this->descriptionProcessor->addErrorWithMsgKey('smw_unexpectedpart', $labelpart); } if ($chunk != ']]') { // What happended? We found some chunk that could not be processed as // link content (as in [[Category:Test<q>]]), or the closing ]] are // just missing entirely. if ($chunk !== '') { $this->descriptionProcessor->addErrorWithMsgKey('smw_misplacedsymbol', $chunk); // try to find a later closing ]] to finish this misshaped subpart $chunk = $this->readChunk('\\]\\]'); if ($chunk != ']]') { $chunk = $this->readChunk('\\]\\]'); } } if ($chunk === '') { $this->descriptionProcessor->addErrorWithMsgKey('smw_noclosingbrackets'); } } return $result; }