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;
 }
 public function testTryToGetConjunctiveCompoundDescriptionForNullCurrentDescription()
 {
     $instance = new DescriptionProcessor();
     $newDescription = $instance->getDescriptionForWikiPageValueChunk('bar');
     $this->assertInstanceOf('SMW\\Query\\Language\\ValueDescription', $instance->getConjunctiveCompoundDescriptionFrom(null, $newDescription));
 }
 public function testConstuctDescriptionWithContextPage()
 {
     $instance = new DescriptionProcessor();
     $instance->setContextPage(DIWikiPage::newFromText(__METHOD__));
     $currentDescription = new Disjunction();
     $newDescription = $instance->constructDescriptionForPropertyObjectValue(new DIProperty('Foo'), 'foobar');
     $this->assertInstanceOf('SMW\\Query\\Language\\Conjunction', $instance->constructConjunctiveCompoundDescriptionFrom($currentDescription, $newDescription));
 }