public function testConfiguration3() { $customersResourceSet = $this->_northWindMetadata->resolveResourceSet('Customers'); $this->assertNotNull($customersResourceSet); $this->assertEquals($this->_dataServiceConfiguration->getEntitySetPageSize($customersResourceSet), 0); $this->_dataServiceConfiguration->setEntitySetPageSize('Customers', 5); $this->assertEquals($this->_dataServiceConfiguration->getEntitySetPageSize($customersResourceSet), 5); $this->_dataServiceConfiguration->setEntitySetPageSize('*', 4); $ordersResourceSet = $this->_northWindMetadata->resolveResourceSet('Orders'); $this->assertNotNull($ordersResourceSet); $this->assertEquals($this->_dataServiceConfiguration->getEntitySetPageSize($ordersResourceSet), 4); $this->assertEquals($this->_dataServiceConfiguration->getEntitySetPageSize($customersResourceSet), 5); try { $this->_dataServiceConfiguration->setEntitySetPageSize('NonExistEntitySet', 7); $this->fail('An expected InvalidArgumentException for \'non-exist entity set name\' was not thrown for month'); } catch (\InvalidArgumentException $exception) { $this->AssertEquals('The given name \'NonExistEntitySet\' was not found in the entity sets', $exception->getMessage()); } try { $this->_dataServiceConfiguration->setMaxResultsPerCollection(5); $this->fail('An expected InvalidOperationException for \'page size and max result per collection mutual exclusion\' was not thrown for month'); } catch (InvalidOperationException $exception) { $this->assertStringEndsWith('mutually exclusive with the specification of \'maximum result per collection\' in configuration', $exception->getMessage()); } }
/** * Constructs a new instance of ResourceSetWrapper * * @param ResourceSet $resourceSet The resource set to wrap * @param ServiceConfiguration $configuration Configuration to take settings specific to wrapped resource set */ public function __construct(ResourceSet $resourceSet, ServiceConfiguration $configuration) { $this->_resourceSet = $resourceSet; $this->_resourceSetRights = $configuration->getEntitySetAccessRule($resourceSet); $this->_resourceSetPageSize = $configuration->getEntitySetPageSize($resourceSet); }