server/src/tests/libraries/Sparql/SparqlClientTest.php
changeset 109 d22ed5792f8e
parent 4 f55970e41793
--- a/server/src/tests/libraries/Sparql/SparqlClientTest.php	Tue Jan 19 19:16:23 2016 +0100
+++ b/server/src/tests/libraries/Sparql/SparqlClientTest.php	Tue Jan 19 19:18:34 2016 +0100
@@ -86,7 +86,7 @@
 
         $this->assertCount(1, $container, 'One request');
         $req = $container[0]['request'];
-        $this->assertEquals("$this->sesameRepository/transactions", (string)$req->getUri(), "url must be ok");
+        $this->assertEquals("$this->sesameRepository/transactions?isolation-level=http%3A%2F%2Fwww.openrdf.org%2Fschema%2Fsesame%23SNAPSHOT_READ", (string)$req->getUri(), "url must be ok");
         $this->assertEquals('POST', $container[0]['request']->getMethod(), "methos is POST");
     }
 
@@ -180,16 +180,14 @@
 
         $this->assertEquals($this->transactionUrl."?action=UPDATE", (string)$req->getUri(), "uri must be the transaction url");
         $this->assertEquals('PUT', $req->getMethod(), "Method must be PUT");
-        $this->assertEquals(['application/x-www-form-urlencoded'], $req->getHeader('Content-type'), "content type must be form urlencoded");
+        $this->assertEquals(['application/sparql-update; charset=utf-8'], $req->getHeader('Content-type'), "content type must be form urlencoded");
 
-        $data = [];
-        parse_str($req->getBody(), $data);
+        $body = (string)$req->getBody();
 
-        $this->assertArrayHasKey('update', $data, "Submitted data must have updarte parameter");
-        $this->assertContains('INSERT DATA {', $data['update'], 'update parameter must contain INSERT');
-        $this->assertContains('GRAPH <'.$this->addGraph->getUri().'> {', $data['update'], 'update parameter must contain GRAPH id');
-        $this->assertContains('<http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/type> "dialogue"^^<http://www.language-archives.org/OLAC/1.1/discourse-type>', $data['update'], 'update parameter must contain dialogue');
-        $this->assertContains('<http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/type> "drama"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> .', $data['update'], 'update parameter must contain drama');
+        $this->assertContains('INSERT DATA {', $body, 'update parameter must contain INSERT');
+        $this->assertContains('GRAPH <'.$this->addGraph->getUri().'> {', $body, 'update parameter must contain GRAPH id');
+        $this->assertContains('<http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/type> "dialogue"^^<http://www.language-archives.org/OLAC/1.1/discourse-type>', $body, 'update parameter must contain dialogue');
+        $this->assertContains('<http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/type> "drama"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> .', $body, 'update parameter must contain drama');
     }
 
     public function testDelete() {
@@ -213,15 +211,13 @@
 
         $this->assertEquals($this->transactionUrl."?action=UPDATE", (string)$req->getUri(), "uri must be the transaction url");
         $this->assertEquals('PUT', $req->getMethod(), "Method must be PUT");
-        $this->assertEquals(['application/x-www-form-urlencoded'], $req->getHeader('Content-type'), "content type must be form urlencoded");
+        $this->assertEquals(['application/sparql-update; charset=utf-8'], $req->getHeader('Content-type'), "content type must be form urlencoded");
 
-        $data = [];
-        parse_str($req->getBody(), $data);
+        $body = (string)$req->getBody();
 
-        $this->assertArrayHasKey('update', $data, "Submitted data must have updarte parameter");
-        $this->assertContains('DELETE DATA {', $data['update'], 'update parameter must contain DELETE');
-        $this->assertContains('GRAPH <'.$this->addGraph->getUri().'> {', $data['update'], 'update parameter must contain GRAPH id');
-        $this->assertContains('<http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/type> "dialogue"^^<http://www.language-archives.org/OLAC/1.1/discourse-type>', $data['update'], 'update parameter must contain GRAPH id');
+        $this->assertContains('DELETE DATA {', $body, 'update parameter must contain DELETE');
+        $this->assertContains('GRAPH <'.$this->addGraph->getUri().'> {', $body, 'update parameter must contain GRAPH id');
+        $this->assertContains('<http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/type> "dialogue"^^<http://www.language-archives.org/OLAC/1.1/discourse-type>', $body, 'update parameter must contain GRAPH id');
 
     }