server/src/tests/Repositories/DocumentRepositoryIntegrationTest.php
changeset 112 7a542145832c
parent 111 af85c436048f
child 113 faff38055a07
equal deleted inserted replaced
111:af85c436048f 112:7a542145832c
    43 
    43 
    44     _:genid-2267740936ad4d04a567e6787732f0dd-genid1 a <http://www.europeana.eu/schemas/edm/Place> ;
    44     _:genid-2267740936ad4d04a567e6787732f0dd-genid1 a <http://www.europeana.eu/schemas/edm/Place> ;
    45     	owl:sameAs <http://sws.geonames.org/3038033/> ;
    45     	owl:sameAs <http://sws.geonames.org/3038033/> ;
    46     	<http://www.w3.org/2004/02/skos/core#note> "northlimit=47.431892250000033; southlimit=49.053971250000046;westlimit=6.846186050000028; eastlimit=8.232571550000074;"^^<http://purl.org/dc/terms/Box> , "FR"^^<http://purl.org/dc/terms/ISO3166> , "France, Alsace"@fr .
    46     	<http://www.w3.org/2004/02/skos/core#note> "northlimit=47.431892250000033; southlimit=49.053971250000046;westlimit=6.846186050000028; eastlimit=8.232571550000074;"^^<http://purl.org/dc/terms/Box> , "FR"^^<http://purl.org/dc/terms/ISO3166> , "France, Alsace"@fr .
    47 
    47 
    48     <###h#ttp://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738> a <http://www.openarchives.org/ore/terms/Aggregation> ;
    48     <http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738> a <http://www.openarchives.org/ore/terms/Aggregation> ;
    49     	<http://www.europeana.eu/schemas/edm/aggregatedCHO> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_738> ;
    49     	<http://www.europeana.eu/schemas/edm/aggregatedCHO> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_738> ;
    50     	<http://www.europeana.eu/schemas/edm/dataProvider> "Atlas linguistiques, cultures et parlers régionaux de France" ;
    50     	<http://www.europeana.eu/schemas/edm/dataProvider> "Atlas linguistiques, cultures et parlers régionaux de France" ;
    51     	<http://www.europeana.eu/schemas/edm/hasView> <http://cocoon.huma-num.fr/data/ala/ALA_738.mp3> , <http://cocoon.huma-num.fr/data/ala/ALA_738_22km.wav> ;
    51     	<http://www.europeana.eu/schemas/edm/hasView> <http://cocoon.huma-num.fr/data/ala/ALA_738.mp3> , <http://cocoon.huma-num.fr/data/ala/ALA_738_22km.wav> ;
    52     	<http://www.europeana.eu/schemas/edm/isShownAt> <http://cocoon.huma-num.fr/exist/crdo/meta/crdo-ALA_738> ;
    52     	<http://www.europeana.eu/schemas/edm/isShownAt> <http://cocoon.huma-num.fr/exist/crdo/meta/crdo-ALA_738> ;
    53     	<http://www.europeana.eu/schemas/edm/isShownBy> <http://cocoon.huma-num.fr/data/ala/masters/ALA_738.wav> ;
    53     	<http://www.europeana.eu/schemas/edm/isShownBy> <http://cocoon.huma-num.fr/data/ala/masters/ALA_738.wav> ;
    95     	<http://www.language-archives.org/OLAC/1.1/interviewer> <http://viaf.org/viaf/61542329> , <http://viaf.org/viaf/9122216> .
    95     	<http://www.language-archives.org/OLAC/1.1/interviewer> <http://viaf.org/viaf/61542329> , <http://viaf.org/viaf/9122216> .
    96 EOT;
    96 EOT;
    97 
    97 
    98     function __construct(string $name = null) {
    98     function __construct(string $name = null) {
    99         parent::__construct($name);
    99         parent::__construct($name);
   100         $this->graph = new EasyRdf\Graph("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738", DocumentRepositoryIntegrationTest::TEST_DOC);
   100         $this->graph = new EasyRdf\Graph("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738", DocumentRepositoryIntegrationTest::TEST_DOC);
   101     }
   101     }
   102 
   102 
   103     public function setUp() {
   103     public function setUp() {
   104         parent::setUp();
   104         parent::setUp();
   105 
   105 
   117             'body' => $repoCreateStmt,
   117             'body' => $repoCreateStmt,
   118         ]);
   118         ]);
   119         $this->httpClient->put("repositories/$this->sesameRepository/statements", [
   119         $this->httpClient->put("repositories/$this->sesameRepository/statements", [
   120             'headers' => ['Content-type' => 'text/turtle;charset=UTF-8'],
   120             'headers' => ['Content-type' => 'text/turtle;charset=UTF-8'],
   121             'body' => DocumentRepositoryIntegrationTest::TEST_DOC,
   121             'body' => DocumentRepositoryIntegrationTest::TEST_DOC,
   122             'query' => ['context' => '<http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738>'],
   122             'query' => ['context' => '<http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738>'],
   123         ]);
   123         ]);
   124     }
   124     }
   125 
   125 
   126     public function tearDown() {
   126     public function tearDown() {
   127         //$this->httpClient->delete("repositories/$this->sesameRepository");
   127         //$this->httpClient->delete("repositories/$this->sesameRepository");
   150         $res = $this->documentRepository->get('crdo-ALA_738');
   150         $res = $this->documentRepository->get('crdo-ALA_738');
   151 
   151 
   152         $this->assertInstanceOf(Document::class, $res, "Result must be of type Document");
   152         $this->assertInstanceOf(Document::class, $res, "Result must be of type Document");
   153         $this->assertEquals('crdo-ALA_738', $res->getId(), 'id should be crdo-ALA_738' );
   153         $this->assertEquals('crdo-ALA_738', $res->getId(), 'id should be crdo-ALA_738' );
   154         $this->assertNotNull($res->getGraph(), "Graph shoul not be null");
   154         $this->assertNotNull($res->getGraph(), "Graph shoul not be null");
   155         $this->assertEquals("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738",$res->getGraph()->getUri(), "uri of graph must be http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738");
   155         $this->assertEquals("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738",$res->getGraph()->getUri(), "uri of graph must be http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738");
   156         $this->assertTrue(EasyRdf\Isomorphic::isomorphic($res->getGraph(),$returnedGraph));
   156         $this->assertTrue(EasyRdf\Isomorphic::isomorphic($res->getGraph(),$returnedGraph));
   157     }
   157     }
   158 
   158 
   159     public function testSave() {
   159     public function testSave() {
   160 
   160 
   161         $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738", $this->graph);
   161         $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-ALA_738", $this->graph);
   162         $doc->updateDiscourseTypes(['oratory','drama','narrative']);
   162         $doc->updateDiscourseTypes(['oratory','drama','narrative']);
   163 
   163 
   164         $res = $this->documentRepository->save($doc);
   164         $res = $this->documentRepository->save($doc);
   165 
   165 
   166         $this->assertTrue($res, 'Has started a transaction');
   166         $this->assertTrue($res, 'Has started a transaction');