public function sortExpressionProvider() { $argLists = array(); $p1337 = new StringValue('1337prop'); $argLists[] = array(new PropertyValueSortExpression($p1337, SortExpression::DIRECTION_ASCENDING), array('objectType' => 'sortExpression', 'sortExpressionType' => 'propertyValue', 'value' => array('property' => $p1337->toArray(), 'direction' => SortExpression::DIRECTION_ASCENDING))); $argLists[] = array(new PropertyValueSortExpression($p1337, SortExpression::DIRECTION_DESCENDING), array('objectType' => 'sortExpression', 'sortExpressionType' => 'propertyValue', 'value' => array('property' => $p1337->toArray(), 'direction' => SortExpression::DIRECTION_DESCENDING))); return $argLists; }
public function descriptionProvider() { $argLists = array(); $p1337 = new StringValue('1337prop'); $argLists[] = array(new AnyValue(), array('objectType' => 'description', 'descriptionType' => 'anyValue', 'value' => array())); $argLists[] = array(new SomeProperty($p1337, new AnyValue()), array('objectType' => 'description', 'descriptionType' => 'someProperty', 'value' => array('property' => $p1337->toArray(), 'description' => array('objectType' => 'description', 'descriptionType' => 'anyValue', 'value' => array()), 'isSubProperty' => false))); return $argLists; }
public function selectionRequestProvider() { $argLists = array(); $argLists[] = array(new SubjectSelection(), array('objectType' => 'selectionRequest', 'selectionRequestType' => 'subject', 'value' => array())); $stringValue = new StringValue('foo'); $argLists[] = array(new PropertySelection($stringValue), array('objectType' => 'selectionRequest', 'selectionRequestType' => 'property', 'value' => array('property' => $stringValue->toArray()))); return $argLists; }
/** * @see ApiBase::getExamplesMessages */ protected function getExamplesMessages() { $query = 'action=' . $this->getModuleName(); $hello = new StringValue('hello'); $acme = new StringValue('http://acme.org'); return array($query . '&' . wfArrayToCgi(array('datavalue' => json_encode($hello->toArray()))) => 'apihelp-wbformatvalue-example-1', $query . '&' . wfArrayToCgi(array('datavalue' => json_encode($acme->toArray()), 'datatype' => 'url', 'generate' => 'text/html')) => 'apihelp-wbformatvalue-example-2'); }
public function propertyExpressionWithInvalidAttributeProvider() { $argLists = array(); $p1337 = new StringValue('1337prop'); $argLists[] = array(array('property' => $p1337->toArray(), 'direction' => 'hax')); $argLists[] = array(array('property' => null, 'direction' => SortExpression::DIRECTION_DESCENDING)); return $argLists; }
public function dataValueSerializationProvider() { $string = new StringValue('foo bar baz'); $number = new NumberValue(42); return array(array($string->toArray(), 'string'), array($number->toArray(), 'number')); }
protected function getExpectedSerialization(StringValue $p42, StringValue $p9001, StringValue $foo) { return array('objectType' => 'query', 'description' => array('objectType' => 'description', 'descriptionType' => 'conjunction', 'value' => array('descriptions' => array(array('objectType' => 'description', 'descriptionType' => 'someProperty', 'value' => array('property' => $p42->toArray(), 'description' => array('objectType' => 'description', 'descriptionType' => 'anyValue', 'value' => array()), 'isSubProperty' => false)), array('objectType' => 'description', 'descriptionType' => 'someProperty', 'value' => array('property' => $p9001->toArray(), 'description' => array('objectType' => 'description', 'descriptionType' => 'valueDescription', 'value' => array('value' => $foo->toArray(), 'comparator' => 'equal')), 'isSubProperty' => false))))), 'options' => array('objectType' => 'queryOptions', 'limit' => 100, 'offset' => 42, 'sort' => array('expressions' => array(array('objectType' => 'sortExpression', 'sortExpressionType' => 'propertyValue', 'value' => array('direction' => SortExpression::DIRECTION_ASCENDING, 'property' => $p42->toArray()))))), 'selectionRequests' => array(array('objectType' => 'selectionRequest', 'selectionRequestType' => 'subject', 'value' => array()), array('objectType' => 'selectionRequest', 'selectionRequestType' => 'property', 'value' => array('property' => $p42->toArray())), array('objectType' => 'selectionRequest', 'selectionRequestType' => 'property', 'value' => array('property' => $p9001->toArray())))); }