public function testGetErrorContainerFromDataValue()
 {
     $instance = new ProcessingErrorMsgHandler(DIWikiPage::newFromText(__METHOD__));
     $dataValue = $this->getMockBuilder('\\SMWDataValue')->disableOriginalConstructor()->setMethods(array('getErrors', 'getProperty'))->getMockForAbstractClass();
     $dataValue->expects($this->atLeastOnce())->method('getErrors')->will($this->returnValue(array('Foo')));
     $dataValue->expects($this->atLeastOnce())->method('getProperty')->will($this->returnValue($this->dataItemFactory->newDIProperty('Bar')));
     $container = $instance->getErrorContainerFromDataValue($dataValue);
     $this->assertInstanceOf('\\SMWDIContainer', $container);
     $expected = array('propertyCount' => 2, 'propertyKeys' => array('_ERRP', '_ERRT'));
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $container->getSemanticData());
 }
Exemplo n.º 2
0
 /**
  * @since 1.9
  *
  * @param SMWDataValue $dataValue
  */
 public function addDataValue(SMWDataValue $dataValue)
 {
     if (!$dataValue->getProperty() instanceof DIProperty || !$dataValue->isValid()) {
         $processingErrorMsgHandler = new ProcessingErrorMsgHandler($this->getSubject());
         $processingErrorMsgHandler->pushTo($this, $processingErrorMsgHandler->getErrorContainerFromDataValue($dataValue));
         return $this->addError($dataValue->getErrors());
     }
     $this->addPropertyObjectValue($dataValue->getProperty(), $dataValue->getDataItem());
 }