public function descriptionProvider() { $descriptionFactory = new DescriptionFactory(); $dataItemFactory = new DataItemFactory(); #0 $pageId = 42; $description = $descriptionFactory->newClassDescription($dataItemFactory->newDIWikiPage('Foo', NS_CATEGORY)); $expected = new \stdClass(); $expected->type = 1; $expected->components = array(1 => "t0.o_id"); $expected->joinfield = "t0.s_id"; $provider[] = array($description, $pageId, $expected); #1 Empty $pageId = 0; $description = $descriptionFactory->newClassDescription($dataItemFactory->newDIWikiPage('Foo', NS_CATEGORY)); $expected = new \stdClass(); $expected->type = 2; $expected->components = array(); $expected->joinfield = ""; $provider[] = array($description, $pageId, $expected); return $provider; }
public function testCanConstructClassDescription() { $category = $this->getMockBuilder('\\SMW\\DIWikiPage')->disableOriginalConstructor()->getMock(); $instance = new DescriptionFactory(); $this->assertInstanceOf('SMW\\Query\\Language\\ClassDescription', $instance->newClassDescription($category)); }