コード例 #1
0
 public function descriptionProvider()
 {
     $descriptionFactory = new DescriptionFactory();
     $dataItemFactory = new DataItemFactory();
     #0 SMW_CMP_EQ
     $description = $descriptionFactory->newValueDescription($dataItemFactory->newDIWikiPage('Foo', NS_MAIN), null, SMW_CMP_EQ);
     $expected = new \stdClass();
     $expected->type = 2;
     $expected->alias = "t0";
     $expected->joinfield = array(42);
     $provider[] = array($description, $expected);
     #1 SMW_CMP_LEQ
     $description = $descriptionFactory->newValueDescription($dataItemFactory->newDIWikiPage('Foo', NS_MAIN), null, SMW_CMP_LEQ);
     $expected = new \stdClass();
     $expected->type = 1;
     $expected->alias = "t0";
     $expected->joinfield = "t0.smw_id";
     $expected->where = "t0.smw_sortkey<=Foo";
     $provider[] = array($description, $expected);
     #2 SMW_CMP_LIKE
     $description = $descriptionFactory->newValueDescription($dataItemFactory->newDIWikiPage('Foo', NS_MAIN), null, SMW_CMP_LIKE);
     $expected = new \stdClass();
     $expected->type = 1;
     $expected->alias = "t0";
     $expected->joinfield = "t0.smw_id";
     $expected->where = "t0.smw_sortkey LIKE Foo";
     $provider[] = array($description, $expected);
     #3 not a DIWikiPage
     $description = $descriptionFactory->newValueDescription($dataItemFactory->newDIBLob('Foo'));
     $expected = new \stdClass();
     $expected->type = 1;
     $expected->joinfield = "";
     $expected->where = "";
     $provider[] = array($description, $expected);
     return $provider;
 }