function setUp() { $this->mockRequest = $this->getMockRequest(); $config = new ConfigGraph(file_get_contents('../documents/config.ttl'), $this->mockRequest); $config->init(); $this->SW = new SparqlWriter($config, $this->mockRequest); }
function setup() { $mockRequest = $this->getMock('LinkedDataApiRequest'); $mockRequest->expects($this->any())->method('getParams')->will($this->returnValue(array('localAuthority.code' => '00BX', '_view' => 'detailed'))); $mockRequest->expects($this->any())->method('getUnreservedParams')->will($this->returnValue(array('localAuthority.code' => '00BX'))); $mockRequest->expects($this->any())->method('getBase')->will($this->returnValue("http://example.com")); $mockRequest->expects($this->any())->method('getPath')->will($this->returnValue("/doc/school/12345")); $mockRequest->expects($this->any())->method('getPathWithoutExtension')->will($this->returnValue("/doc/school/12345")); $mockRequest->expects($this->any())->method('getUri')->will($this->returnValue("http://example.com/doc/school/12345")); $ConfigGraph = new ConfigGraph(file_get_contents('../documents/config.ttl'), $mockRequest); $ConfigGraph->add_rdf(file_get_contents('../documents/test-data.ttl')); $ConfigGraph->init(); $this->Graph = new LinkedDataApiGraph(file_get_contents('../documents/test-data.ttl'), $ConfigGraph); $this->Graph->_current_page_uri = "http://localhost/Things?_page=1"; }
} else { if (isset($Request->ifModifiedSince) && $cachedResponse->generatedTime <= $Request->ifModifiedSince) { logDebug("Last modified date matched, returning 304"); $Response = new Response304($cachedResponse); } else { logDebug("Re-Serving cached response"); $Response = $cachedResponse; } } } else { logDebug("Generating fresh response"); $files = glob('api-config-files/*.ttl'); /* keep the config graph that matches the request, and keep a 'complete' configgraph to serve if none match */ $CompleteConfigGraph = new ConfigGraph(null, $Request, $HttpRequestFactory); foreach ($files as $file) { logDebug("Iterating over files in /api-config: {$file}"); if ($ConfigGraph = LinkedDataApiCache::hasCachedConfig($file)) { logDebug("Found Cached Config"); $CompleteConfigGraph->add_graph($ConfigGraph); $ConfigGraph->setRequest($Request); } else { logDebug("Checking Config file: {$file}"); $rdf = file_get_contents($file); $CompleteConfigGraph->add_rdf($rdf); $ConfigGraph = new ConfigGraph(null, $Request, $HttpRequestFactory); $ConfigGraph->add_rdf($rdf); $errors = $ConfigGraph->get_parser_errors(); if (!empty($errors)) { foreach ($ConfigGraph->get_parser_errors() as $errorList) {
function test_getInheritedSelectorFiltersDoesntThrowException() { $mockRequest = $this->getMockRequest('/Climbing/Routes/byGrade/HVS', 'http://localhost'); $Config = new ConfigGraph(file_get_contents('../documents/config.ttl'), $mockRequest); $Config->init(); try { $filters = $Config->getInheritedSelectFilters(); } catch (ConfigGraphException $e) { $this->fail("an exception shouldn't be thrown if the parent selector uses api:filter "); } $this->assertEquals(array('type={Route}'), $filters); }