public function testQueryEndpointWithParameters()
 {
     $this->sparql = new EasyRdf_Sparql_Client('http://localhost:8080/sparql?a=b');
     $this->client->addMock('GET', '/sparql?a=b&query=SELECT+%2A+WHERE+%7B%3Fs+%3Fp+%3Fo%7D', readFixture('sparql_select_all.xml'), array('headers' => array('Content-Type' => 'application/sparql-results+xml')));
     $result = $this->sparql->query("SELECT * WHERE {?s ?p ?o}");
     $this->assertCount(14, $result);
     $this->assertEquals(new EasyRdf_Resource('_:genid1'), $result[0]->s);
     $this->assertEquals(new EasyRdf_Resource('http://xmlns.com/foaf/0.1/name'), $result[0]->p);
     $this->assertEquals(new EasyRdf_Literal("Joe's Current Project"), $result[0]->o);
 }
 public function testNewAndLoadError()
 {
     $this->client->addMockOnce('GET', 'http://www.example.com/missing', 'Error text', array('status' => 404));
     try {
         $graph = EasyRdf_Graph::newAndLoad('http://www.example.com/missing', 'turtle');
         $this->fail('404 should lead to exception');
     } catch (EasyRdf_Http_Exception $e) {
         $this->assertEquals(404, $e->getCode());
         $this->assertEquals('Error text', $e->getBody());
     }
 }
 public function testLoad()
 {
     EasyRdf_Http::setDefaultHttpClient($client = new EasyRdf_Http_MockClient());
     $client->addMock('GET', 'http://example.com/foaf.json', readFixture('foaf.json'));
     $graph = new EasyRdf_Graph('http://example.com/');
     $resource = $graph->resource('http://example.com/foaf.json');
     $resource->load();
     $this->assertStringEquals('Joe Bloggs', $graph->get('http://www.example.com/joe#me', 'foaf:name'));
 }