Example #1
0
 public function getWantedPropertiesSpecial($requestoptions = null)
 {
     $wantedPropertiesCollector = new WantedPropertiesCollector($this, wfGetDB(DB_SLAVE), Settings::newFromGlobals());
     return $wantedPropertiesCollector->setRequestOptions($requestoptions);
 }
 public function testUnknownPredefinedPropertyThrowsExceptionToReturnErrorDataItem()
 {
     $tableDefinition = $this->getMockBuilder('\\stdClass')->setMethods(array('isFixedPropertyTable', 'getName'))->getMock();
     $tableDefinition->expects($this->once())->method('isFixedPropertyTable')->will($this->returnValue(false));
     $tableDefinition->expects($this->once())->method('getName')->will($this->returnValue('Bar'));
     $store = $this->getMockBuilder('\\SMWSQLStore3')->setMethods(array('getPropertyTables', 'findTypeTableId'))->getMock();
     $store->expects($this->once())->method('getPropertyTables')->will($this->returnValue(array('Foo' => $tableDefinition)));
     $store->expects($this->atLeastOnce())->method('findTypeTableId')->will($this->returnValue('Foo'));
     $row = new \stdClass();
     $row->smw_title = '_UnknownPredefinedProperty';
     $row->count = 0;
     $dbConnection = $this->getMockBuilder('\\DatabaseBase')->disableOriginalConstructor()->setMethods(array('select'))->getMockForAbstractClass();
     $dbConnection->expects($this->once())->method('select')->will($this->returnValue(array($row)));
     $settings = Settings::newFromArray(array('smwgPDefaultType' => 'Foo'));
     $instance = new WantedPropertiesCollector($store, $dbConnection, $settings);
     $results = $instance->runCollector();
     $this->assertInternalType('array', $results);
     $this->assertInstanceOf('SMWDIError', $results[0][0]);
 }