예제 #1
0
 public function testGetResourceSetReturnsArrayWhenQueryTypeIsEntitiesWithCount()
 {
     $orderBy = null;
     $top = 10;
     $skip = 10;
     $fakeQueryResult = new QueryResult();
     $fakeQueryResult->count = 4;
     $fakeQueryResult->results = null;
     //null is not an array
     Phockito::when($this->mockQueryProvider->getResourceSet(QueryType::ENTITIES_WITH_COUNT(), $this->mockResourceSet, $this->mockFilterInfo, $orderBy, $top, $skip))->return($fakeQueryResult);
     $wrapper = $this->getMockedWrapper();
     try {
         $wrapper->getResourceSet(QueryType::ENTITIES_WITH_COUNT(), $this->mockResourceSet, $this->mockFilterInfo, $orderBy, $top, $skip);
         $this->fail("expected exception not thrown");
     } catch (ODataException $ex) {
         $this->assertEquals(Messages::queryProviderResultsMissing("IQueryProvider::getResourceSet", QueryType::ENTITIES_WITH_COUNT()), $ex->getMessage());
         $this->assertEquals(500, $ex->getStatusCode());
     }
 }
예제 #2
0
 /**
  * Gets collection of entities belongs to an entity set
  *
  * @param QueryType $queryType indicates if this is a query for a count, entities, or entities with a count
  * @param ResourceSet $resourceSet The entity set containing the entities that need to be fetched
  * @param FilterInfo $filterInfo represents the $filter parameter of the OData query.  NULL if no $filter specified
  * @param InternalOrderByInfo $orderBy The orderBy information
  * @param int $top The top count
  * @param int $skip The skip count
  * 
  * @return QueryResult
  */
 public function getResourceSet(QueryType $queryType, ResourceSet $resourceSet, $filterInfo, $orderBy, $top, $skip)
 {
     $queryResult = $this->queryProvider->getResourceSet($queryType, $resourceSet, $filterInfo, $orderBy, $top, $skip);
     $this->validateQueryResult($queryResult, $queryType, 'IQueryProvider::getResourceSet');
     return $queryResult;
 }