/** * @since 2.4 * * @param DIProperty $property * @param array|string $errorMsg * * @return DIContainer */ public function getContainerFor(DIProperty $property = null, $errorMsg = '') { if ($property !== null && $property->isInverse()) { $property = new DIProperty($property->getKey()); } $errorMsg = is_array($errorMsg) ? implode(' ', $errorMsg) : $errorMsg; $subject = new DIWikiPage($this->subject->getDBkey(), $this->subject->getNamespace(), $this->subject->getInterwiki(), '_ERR' . md5(($property !== null ? $property->getKey() : 'UNKNOWN') . $errorMsg)); // Encode brackets to avoid an annotion is created/included return $this->newDiContainer($subject, $property, InTextAnnotationParser::obscureAnnotation($errorMsg)); }
/** * @dataProvider stripTextWithAnnotationProvider */ public function testStrip($text, $expectedRemoval, $expectedObscuration) { $this->assertEquals($expectedRemoval, InTextAnnotationParser::removeAnnotation($text)); $this->assertEquals($expectedObscuration, InTextAnnotationParser::obscureAnnotation($text)); }