server/src/tests/Repositories/DocumentRepositoryIntegrationTest.php
changeset 19 eadaf0b8f02e
parent 4 f55970e41793
child 26 72f51a9386ff
equal deleted inserted replaced
18:f2a40bbc27f6 19:eadaf0b8f02e
    32             ]
    32             ]
    33         ].
    33         ].
    34 EOT;
    34 EOT;
    35 
    35 
    36     const TEST_DOC = <<<EOT
    36     const TEST_DOC = <<<EOT
    37     <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_608> <http://xmlns.com/foaf/0.1/primaryTopic> <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> .
    37     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    38     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Document> .
    38     @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    39     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/description> "Extrait des enqu\u00EAtes dialectologiques en vue de constituer un atlas linguistique de l'Alsace."@fr .
    39     @prefix sesame: <http://www.openrdf.org/schema/sesame#> .
    40     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/format> "audio/x-wav"^^<http://purl.org/dc/terms/IMT> .
    40     @prefix owl: <http://www.w3.org/2002/07/owl#> .
    41     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/type> <http://purl.org/dc/dcmitype/Sound> .
    41     @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
    42     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/type> "primary_text"^^<http://www.language-archives.org/OLAC/1.1/linguistic-type> .
    42     @prefix fn: <http://www.w3.org/2005/xpath-functions#> .
    43     <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> .
    43 
    44     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/subject> <http://lexvo.org/id/iso639-3/gsw> .
    44     _:genid-2267740936ad4d04a567e6787732f0dd-genid1 a <http://www.europeana.eu/schemas/edm/Place> ;
    45     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/subject> "lexicography"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> .
    45     	owl:sameAs <http://sws.geonames.org/3038033/> ;
    46     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/subject> "phonetics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> .
    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     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/subject> "anthropological_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> .
    47 
    48     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/gsw> .
    48     <http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738> a <http://www.openarchives.org/ore/terms/Aggregation> ;
    49     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/contributor> <http://viaf.org/viaf/9122216> .
    49     	<http://www.europeana.eu/schemas/edm/aggregatedCHO> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_738> ;
    50     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/contributor> _:genid2d5831d84541df446694586ac2006f96042dgenid1 .
    50     	<http://www.europeana.eu/schemas/edm/dataProvider> "Atlas linguistiques, cultures et parlers régionaux de France" ;
    51     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/contributor> _:genid2d5831d84541df446694586ac2006f96042dgenid2 .
    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://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/publisher> "Atlas linguistiques, cultures et parlers r\u00E9gionaux de France" .
    52     	<http://www.europeana.eu/schemas/edm/isShownAt> <http://cocoon.huma-num.fr/exist/crdo/meta/crdo-ALA_738> ;
    53     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/rights> "Copyright (c) D\u00E9partement de dialectologie alsacienne et mosellane de l'Universit\u00E9 de Strasbourg" .
    53     	<http://www.europeana.eu/schemas/edm/isShownBy> <http://cocoon.huma-num.fr/data/ala/masters/ALA_738.wav> ;
    54     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/elements/1.1/title> "Atlas Linguistique et ethnographique de l'Alsace - Enquetes sur la conscience linguistique - ALA_608"@fr .
    54     	<http://www.europeana.eu/schemas/edm/provider> "Corpus de la Parole"@fr ;
    55     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" .
    55     	<http://www.europeana.eu/schemas/edm/rights> <http://creativecommons.org/licenses/by-nc-nd/4.0/> .
    56     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-nd/2.5/> .
    56 
    57     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/isPartOf> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ALA_CL> .
    57     <http://cocoon.huma-num.fr/data/ala/ALA_738.mp3> a <http://www.europeana.eu/schemas/edm/WebResources> ;
    58     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/isPartOf> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE> .
    58     	<http://purl.org/dc/elements/1.1/format> "audio/mpeg"^^<http://purl.org/dc/terms/IMT> ;
    59     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/extent> "PT02H04M16S" .
    59     	<http://purl.org/dc/terms/created> "1996"^^<http://purl.org/dc/terms/Period> ;
    60     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/created> "start=1980; end=1989; name=ann\u00E9es 80"^^<http://purl.org/dc/terms/Period> .
    60     	<http://purl.org/dc/terms/extent> "PT01H11M29S" ;
    61     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/spatial> "France, Alsace"@fr .
    61     	<http://purl.org/dc/terms/issued> "2014-11-10T14:27:08+01:00"^^<http://purl.org/dc/terms/W3CDTF> ;
    62     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/spatial> "FR"^^<http://purl.org/dc/terms/ISO3166> .
    62     	<http://www.europeana.eu/schemas/edm/isDerivativeOf> <http://cocoon.huma-num.fr/data/ala/masters/ALA_738.wav> .
    63     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/isFormatOf> <http://cocoon.huma-num.fr/data/ala/ALA_608.mp3> .
    63 
    64     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/isFormatOf> <http://cocoon.huma-num.fr/data/ala/masters/ALA_608.wav> .
    64     <http://cocoon.huma-num.fr/data/ala/masters/ALA_738.wav> a <http://www.europeana.eu/schemas/edm/WebResources> ;
    65     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/available> "2004-07-03"^^<http://purl.org/dc/terms/W3CDTF> .
    65     	<http://purl.org/dc/elements/1.1/format> "audio/x-wav"^^<http://purl.org/dc/terms/IMT> ;
    66     <http://cocoon.huma-num.fr/data/ala/ALA_608_22km.wav> <http://purl.org/dc/terms/issued> "2014-11-04T16:25:54+01:00"^^<http://purl.org/dc/terms/W3CDTF> .
    66     	<http://purl.org/dc/terms/created> "1996"^^<http://purl.org/dc/terms/Period> ;
    67     <http://lexvo.org/id/iso639-3/gsw> <http://www.w3.org/2000/01/rdf-schema#label> "Alsacien"@fr .
    67     	<http://purl.org/dc/terms/extent> "PT01H11M29S" ;
    68     <http://viaf.org/viaf/9122216> <http://www.w3.org/2000/01/rdf-schema#label> "Huck, Dominique" .
    68     	<http://purl.org/dc/terms/issued> "2014-11-10T14:27:08+01:00"^^<http://purl.org/dc/terms/W3CDTF> .
    69     <http://viaf.org/viaf/9122216> <http://xmlns.com/foaf/0.1/status> "depositor"^^<http://www.language-archives.org/OLAC/1.1/role> .
    69 
    70     _:genid2d5831d84541df446694586ac2006f96042dgenid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Agent> .
    70     <http://cocoon.huma-num.fr/data/ala/ALA_738_22km.wav> a <http://www.europeana.eu/schemas/edm/WebResources> ;
    71     _:genid2d5831d84541df446694586ac2006f96042dgenid1 <http://xmlns.com/foaf/0.1/name> "Bothorel-Witz, Arlette" .
    71     	<http://purl.org/dc/elements/1.1/format> "audio/x-wav"^^<http://purl.org/dc/terms/IMT> ;
    72     _:genid2d5831d84541df446694586ac2006f96042dgenid1 <http://xmlns.com/foaf/0.1/status> "interviewer"^^<http://www.language-archives.org/OLAC/1.1/role> .
    72     	<http://purl.org/dc/terms/created> "1996"^^<http://purl.org/dc/terms/Period> ;
    73     _:genid2d5831d84541df446694586ac2006f96042dgenid2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Agent> .
    73     	<http://purl.org/dc/terms/extent> "PT01H11M29S" ;
    74     _:genid2d5831d84541df446694586ac2006f96042dgenid2 <http://xmlns.com/foaf/0.1/name> "Huck, Dominique" .
    74     	<http://purl.org/dc/terms/issued> "2014-11-10T14:27:08+01:00"^^<http://purl.org/dc/terms/W3CDTF> ;
    75     _:genid2d5831d84541df446694586ac2006f96042dgenid2 <http://xmlns.com/foaf/0.1/status> "interviewer"^^<http://www.language-archives.org/OLAC/1.1/role> .
    75     	<http://www.europeana.eu/schemas/edm/isDerivativeOf> <http://cocoon.huma-num.fr/data/ala/masters/ALA_738.wav> .
       
    76 
       
    77     <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_738> a <http://www.europeana.eu/schemas/edm/ProvidedCHO> ;
       
    78     	<http://purl.org/dc/terms/created> "1996"^^<http://purl.org/dc/terms/Period> ;
       
    79     	<http://purl.org/dc/terms/extent> "PT01H11M29S" ;
       
    80     	<http://purl.org/dc/terms/issued> "2014-11-10T14:27:08+01:00"^^<http://purl.org/dc/terms/W3CDTF> ;
       
    81     	<http://purl.org/dc/elements/1.1/contributor> <http://viaf.org/viaf/61542329> , <http://viaf.org/viaf/9122216> ;
       
    82     	<http://purl.org/dc/elements/1.1/description> "Extrait des enquêtes dialectologiques en vue de constituer un atlas linguistique de l'Alsace."@fr ;
       
    83     	<http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/gsw> ;
       
    84     	<http://purl.org/dc/elements/1.1/publisher> "Atlas linguistiques, cultures et parlers régionaux de France" ;
       
    85     	<http://purl.org/dc/elements/1.1/rights> "Copyright (c) Département de dialectologie alsacienne et mosellane de l'Université de Strasbourg" ;
       
    86     	<http://purl.org/dc/elements/1.1/subject> <http://lexvo.org/id/iso639-3/gsw> , <http://ark.bnf.fr/ark:/12148/cb11931472p> , <http://ark.bnf.fr/ark:/12148/cb11931564b> , <http://ark.bnf.fr/ark:/12148/cb11932194d> , <http://ark.bnf.fr/ark:/12148/cb11933029x> , <http://ark.bnf.fr/ark:/12148/cb11933281k> , <http://ark.bnf.fr/ark:/12148/cb11934740m> , <http://ark.bnf.fr/ark:/12148/cb11935375d> , <http://ark.bnf.fr/ark:/12148/cb11935986q> , <http://ark.bnf.fr/ark:/12148/cb11936549n> , <http://ark.bnf.fr/ark:/12148/cb11937931x> , <http://ark.bnf.fr/ark:/12148/cb119392962> , <http://ark.bnf.fr/ark:/12148/cb119458243> , <http://ark.bnf.fr/ark:/12148/cb11946662b> , <http://ark.bnf.fr/ark:/12148/cb11947332t> , <http://ark.bnf.fr/ark:/12148/cb119481497> , <http://ark.bnf.fr/ark:/12148/cb119591726> , <http://ark.bnf.fr/ark:/12148/cb119756721> , <http://ark.bnf.fr/ark:/12148/cb119757609> , <http://ark.bnf.fr/ark:/12148/cb11975806s> , <http://ark.bnf.fr/ark:/12148/cb119759527> , <http://ark.bnf.fr/ark:/12148/cb12032030g> , <http://ark.bnf.fr/ark:/12148/cb12042429k> , <http://ark.bnf.fr/ark:/12148/cb12099148r> , <http://ark.bnf.fr/ark:/12148/cb12148936v> , <http://ark.bnf.fr/ark:/12148/cb12289036m> , <http://ark.bnf.fr/ark:/12148/cb13318335q> , <http://ark.bnf.fr/ark:/12148/cb133183540> , <http://ark.bnf.fr/ark:/12148/cb13318415c> , <http://ark.bnf.fr/ark:/12148/cb13318491g> , "anthropological_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "lexicography"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "phonetics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> ;
       
    87     	<http://purl.org/dc/elements/1.1/title> "Atlas Linguistique et ethnographique de l'Alsace - Enquetes sur la conscience linguistique - ALA_738"@fr ;
       
    88     	<http://purl.org/dc/elements/1.1/type> <http://ark.bnf.fr/ark:/12148/cb11932135w> , <http://ark.bnf.fr/ark:/12148/cb12481481z> , <http://purl.org/dc/dcmitype/Sound> , "dialogue"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> , "primary_text"^^<http://www.language-archives.org/OLAC/1.1/linguistic-type> ;
       
    89     	<http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ;
       
    90     	<http://purl.org/dc/terms/available> "2004-07-03"^^<http://purl.org/dc/terms/W3CDTF> ;
       
    91     	<http://purl.org/dc/terms/isPartOf> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ALA_CL> , <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE> ;
       
    92     	<http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-nd/2.5/> ;
       
    93     	<http://purl.org/dc/terms/spatial> _:genid-2267740936ad4d04a567e6787732f0dd-genid1 ;
       
    94     	<http://www.language-archives.org/OLAC/1.1/depositor> <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> .
    76 EOT;
    96 EOT;
    77 
    97 
    78     function __construct(string $name = null) {
    98     function __construct(string $name = null) {
    79         parent::__construct($name);
    99         parent::__construct($name);
    80         $this->graph = new EasyRdf\Graph("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_608", DocumentRepositoryIntegrationTest::TEST_DOC);
   100         $this->graph = new EasyRdf\Graph("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738", DocumentRepositoryIntegrationTest::TEST_DOC);
    81     }
   101     }
    82 
   102 
    83     public function setUp() {
   103     public function setUp() {
    84         parent::setUp();
   104         parent::setUp();
    85 
   105 
    86         $this->httpClient = new Client(['base_uri' => config('corpusparole.sesame_base_url')]);
   106         $this->httpClient = new Client(['base_uri' => config('corpusparole.sesame_base_url')]);
    87         $this->sesameRepository = config('corpusparole.sesame_repository');
   107         $this->sesameRepository = config('corpusparole.sesame_repository');
    88         $this->cocoonDocIdBaseUri = config('corpusparole.cocoon_doc_id_base_uri');
   108         $this->corpusDocIdBaseUri = config('corpusparole.corpus_doc_id_base_uri');
    89 
   109 
    90         $this->documentRepository = $this->app->make('CorpusParole\Repositories\DocumentRepository');
   110         $this->documentRepository = $this->app->make('CorpusParole\Repositories\DocumentRepository');
    91         $uniqueid = uniqid('corpusparole', true);
   111         $uniqueid = uniqid('corpusparole', true);
    92         $repoCreateStmt = sprintf(DocumentRepositoryIntegrationTest::REPO_CREATION_TTL, $this->sesameRepository);
   112         $repoCreateStmt = sprintf(DocumentRepositoryIntegrationTest::REPO_CREATION_TTL, $this->sesameRepository);
    93         $this->httpClient->delete("repositories/$this->sesameRepository", ['http_errors' => false]);
   113         $this->httpClient->delete("repositories/$this->sesameRepository", ['http_errors' => false]);
    97             'body' => $repoCreateStmt,
   117             'body' => $repoCreateStmt,
    98         ]);
   118         ]);
    99         $this->httpClient->put("repositories/$this->sesameRepository/statements", [
   119         $this->httpClient->put("repositories/$this->sesameRepository/statements", [
   100             'headers' => ['Content-type' => 'text/turtle;charset=UTF-8'],
   120             'headers' => ['Content-type' => 'text/turtle;charset=UTF-8'],
   101             'body' => DocumentRepositoryIntegrationTest::TEST_DOC,
   121             'body' => DocumentRepositoryIntegrationTest::TEST_DOC,
   102             'query' => ['context' => '<http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_608>'],
   122             'query' => ['context' => '<http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738>'],
   103         ]);
   123         ]);
   104     }
   124     }
   105 
   125 
   106     public function tearDown() {
   126     public function tearDown() {
   107         $this->httpClient->delete("repositories/$this->sesameRepository");
   127         $this->httpClient->delete("repositories/$this->sesameRepository");
   108         parent::tearDown();
   128         parent::tearDown();
   109     }
   129     }
   110 
   130 
   111     public function testAll() {
   131     public function testAll() {
   112         $expectedId = $this->cocoonDocIdBaseUri.'crdo-ALA_608';
   132         $expectedId = $this->corpusDocIdBaseUri.'crdo-ALA_738';
   113         $docList = $this->documentRepository->all();
   133         $docList = $this->documentRepository->all();
   114         $this->assertCount(1, $docList, "Should have one element");
   134         $this->assertCount(1, $docList, "Should have one element");
   115 
   135 
   116         $resDoc = $docList[0];
   136         $resDoc = $docList[0];
   117 
   137 
   118         $this->assertInstanceOf(Document::class, $resDoc, "Res doc must be a Document");
   138         $this->assertInstanceOf(Document::class, $resDoc, "Res doc must be a Document");
   119         $this->assertEquals('crdo-ALA_608', $resDoc->getId(), "id must be crdo...");
   139         $this->assertEquals('crdo-ALA_738', $resDoc->getId(), "id must be crdo...");
   120         $this->assertEquals($expectedId, $resDoc->getUri(), 'url must be ...');
   140         $this->assertEquals($expectedId, $resDoc->getUri(), 'url must be ...');
   121         $this->assertNull($resDoc->getGraph(), 'Graph must be null');
   141         $this->assertNull($resDoc->getGraph(), 'Graph must be null');
   122 
   142 
   123     }
   143     }
   124 
   144 
   125     public function testGet() {
   145     public function testGet() {
   126 
   146 
   127         $expectedId = $this->cocoonDocIdBaseUri.'crdo-ALA_608';
   147         $expectedId = $this->corpusDocIdBaseUri.'crdo-ALA_738';
   128         $returnedGraph = new EasyRdf\Graph($expectedId, DocumentRepositoryIntegrationTest::TEST_DOC);
   148         $returnedGraph = new EasyRdf\Graph($expectedId, DocumentRepositoryIntegrationTest::TEST_DOC);
   129 
   149 
   130         $res = $this->documentRepository->get('crdo-ALA_608');
   150         $res = $this->documentRepository->get('crdo-ALA_738');
   131 
   151 
   132         $this->assertInstanceOf(Document::class, $res, "Result must be of type Document");
   152         $this->assertInstanceOf(Document::class, $res, "Result must be of type Document");
   133         $this->assertEquals('crdo-ALA_608', $res->getId(), 'id should be crdo-ALA_608' );
   153         $this->assertEquals('crdo-ALA_738', $res->getId(), 'id should be crdo-ALA_738' );
   134         $this->assertNotNull($res->getGraph(), "Graph shoul not be null");
   154         $this->assertNotNull($res->getGraph(), "Graph shoul not be null");
   135         $this->assertTrue(EasyRdf\Isomorphic::isomorphic($res->getGraph(),$returnedGraph));
   155         $this->assertTrue(EasyRdf\Isomorphic::isomorphic($res->getGraph(),$returnedGraph));
   136     }
   156     }
   137 
   157 
   138     public function testSave() {
   158     public function testSave() {
   139 
   159 
   140         $doc = new Document("http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-ALA_608", $this->graph);
   160         $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-ALA_738", $this->graph);
   141         $doc->updateDiscourseTypes(['oratory','drama','narrative']);
   161         $doc->updateDiscourseTypes(['oratory','drama','narrative']);
   142 
   162 
   143         $res = $this->documentRepository->save($doc);
   163         $res = $this->documentRepository->save($doc);
   144 
   164 
   145         $this->assertTrue($res, 'Has started a transaction');
   165         $this->assertTrue($res, 'Has started a transaction');
   146 
   166 
   147         $res = $this->documentRepository->get('crdo-ALA_608');
   167         $res = $this->documentRepository->get('crdo-ALA_738');
   148 
   168 
   149         $discoursesTypes = $res->getDiscourseTypes();
   169         $discoursesTypes = $res->getDiscourseTypes();
   150 
   170 
   151         $this->assertCount(3, $discoursesTypes, "types array must be of size 1");
   171         $this->assertCount(3, $discoursesTypes, "types array must be of size 1");
   152 
   172