server/src/tests/Models/DocumentTest.php
author ymh <ymh.work@gmail.com>
Thu, 25 Feb 2016 10:20:01 +0100
changeset 130 fac22d8c2df8
parent 122 b37fde30dd4a
child 138 3079cbf80006
permissions -rw-r--r--
add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
use CorpusParole\Models\Document;
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
     4
use CorpusParole\Libraries\CocoonUtils;
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
/**
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 *
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 */
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
class DocumentTest extends TestCase {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    const TEST_DOC = <<<EOT
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    12
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    13
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    14
    @prefix sesame: <http://www.openrdf.org/schema/sesame#> .
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    15
    @prefix owl: <http://www.w3.org/2002/07/owl#> .
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    16
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    17
    @prefix fn: <http://www.w3.org/2005/xpath-functions#> .
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    18
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    19
    <http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND> a <http://www.openarchives.org/ore/terms/Aggregation> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    20
        <http://www.europeana.eu/schemas/edm/aggregatedCHO> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    21
        <http://www.europeana.eu/schemas/edm/dataProvider> "Langage et langues : description, théorisation, transmission" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    22
        <http://www.europeana.eu/schemas/edm/hasView> <http://cocoon.huma-num.fr/exist/crdo/cfpp2000/fra/Ozgur_Kilic_H_32_alii_3e-2.xml> , <http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.mp3> , <http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.wav> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    23
        <http://www.europeana.eu/schemas/edm/isShownAt> <http://corpusdelaparole.huma-num.fr/corpus-app#/detail/crdo-CFPP2000_35_SOUND> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    24
        <http://www.europeana.eu/schemas/edm/isShownBy> <http://cocoon.huma-num.fr/data/archi/masters/372593.wav> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    25
        <http://www.europeana.eu/schemas/edm/provider> "Corpus de la Parole"@fr ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    26
        <http://www.europeana.eu/schemas/edm/rights> <http://creativecommons.org/licenses/by-nc-sa/4.0/> .
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
    27
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    28
    <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_35_SOUND> a <http://www.europeana.eu/schemas/edm/ProvidedCHO> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    29
        <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    30
        <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    31
        <http://purl.org/dc/terms/extent> "PT48M26S" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    32
        <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    33
        <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    34
        <http://purl.org/dc/elements/1.1/contributor> <http://viaf.org/viaf/93752300> , "Tanguy, Noalig" , "Chevrier, Michel" , "Kiliç, Ozgur" , "Salvegas, Etienne" , "du-Breuil-de-Pont-en-Auge, Augustin" , "du-Breuil-de-Pont-en-Auge, Benoît" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    35
        <http://purl.org/dc/elements/1.1/description> "Enregistrement issu du Corpus de Français Parlé Parisien des années 2000 (CFPP2000)"@fr , "Quartier(s) concerné(s) : Paris 3e, et 20e (pour l'âge adulte); Anonymisation : Noalig TANGUY;"@fr ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    36
        <http://purl.org/dc/elements/1.1/identifier> "ark:/87895/1.17-375004" , "corpusparole:crdo-CFPP2000_35_SOUNDid" , "oai:crdo.vjf.cnrs.fr:crdo-CFPP2000_35" , "Cote producteur: [03-01] Ozgur_Kilic_H_32_alii_3e"@fr , "ark:/87895/1.17-372593" , "oai:crdo.vjf.cnrs.fr:crdo-CFPP2000_35_SOUND" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    37
        <http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/fra> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    38
        <http://purl.org/dc/elements/1.1/publisher> <http://viaf.org/viaf/142432638>;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    39
        <http://purl.org/dc/elements/1.1/subject> <http://ark.bnf.fr/ark:/12148/cb13318415c> , "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> , <http://lexvo.org/id/iso639-3/fra> , <http://ark.bnf.fr/ark:/12148/cb133188907> , <http://ark.bnf.fr/ark:/12148/cb11932762f> , "general_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , <http://ark.bnf.fr/ark:/12148/cb133183660> , "text_and_corpus_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "Français"@fr , <http://ark.bnf.fr/ark:/12148/cb122368540> , "phonology"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "semantics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "sociolinguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "syntax"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "typology"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , <http://ark.bnf.fr/ark:/12148/cb119418302> , <http://ark.bnf.fr/ark:/12148/cb135540729> , "discourse_analysis"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "historical_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , "language_documentation"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> , <http://ark.bnf.fr/ark:/12148/cb133192210> , <http://ark.bnf.fr/ark:/12148/cb119377452> , <http://ark.bnf.fr/ark:/12148/cb13320451h> , <http://ark.bnf.fr/ark:/12148/cb13318422n> , <http://ark.bnf.fr/ark:/12148/cb11975823c> , "mathematical_linguistics"^^<http://www.language-archives.org/OLAC/1.1/linguistic-field> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    40
        <http://purl.org/dc/elements/1.1/title> "Entretien de Ozgur Kiliç 2"@fr ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    41
        <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> , "primary_text"^^<http://www.language-archives.org/OLAC/1.1/linguistic-type> , <http://purl.org/dc/dcmitype/Text> , "narrative"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> , "report"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> , "unintelligible_speech"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    42
        <http://purl.org/dc/terms/available> "2013-10-12"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    43
        <http://purl.org/dc/terms/spatial> [
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    44
            a <http://www.europeana.eu/schemas/edm/Place> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    45
            owl:sameAs <http://sws.geonames.org/6618626/> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    46
            <http://www.w3.org/2004/02/skos/core#note> "FR"^^<http://purl.org/dc/terms/ISO3166> , "France, Île-de-France, Paris, Université Sorbonne Nouvelle Paris 3, site Censier"@fr , "Domicile de Ozgur Kiliç"@fr , "France, Île-de-France, Paris 20"@fr
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    47
        ];
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    48
        <http://www.europeana.eu/schemas/edm/isGatheredInto> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_LANGUESDEFRANCE> , <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_CFPP2000> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    49
        <http://www.language-archives.org/OLAC/1.1/depositor> <http://viaf.org/viaf/93752300> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    50
        <http://www.language-archives.org/OLAC/1.1/interviewer> <http://viaf.org/viaf/93752300> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    51
        <http://www.language-archives.org/OLAC/1.1/transcriber> "Tanguy, Noalig" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    52
        <http://purl.org/dc/elements/1.1/coverage> "Quartier concerné : 3e"@fr ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    53
        <http://www.language-archives.org/OLAC/1.1/responder> "Chevrier, Michel" , "Kiliç, Ozgur" , "Salvegas, Etienne" , "du-Breuil-de-Pont-en-Auge, Augustin" , "du-Breuil-de-Pont-en-Auge, Benoît" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    54
        <http://purl.org/dc/elements/1.1/relation> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-CFPP2000_31_SOUND> .
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    55
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
    56
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    57
    <http://cocoon.huma-num.fr/exist/crdo/cfpp2000/fra/Ozgur_Kilic_H_32_alii_3e-2.xml> a <http://www.europeana.eu/schemas/edm/WebResource> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    58
        <http://purl.org/dc/elements/1.1/format> "application/xml"^^<http://purl.org/dc/terms/IMT> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    59
        <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    60
        <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    61
        <http://purl.org/dc/terms/issued> "2013-11-04T22:20:07+01:00"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    62
        <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    63
        <http://purl.org/dc/terms/conformsTo> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_transcriber> .
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    64
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    65
    <http://cocoon.huma-num.fr/data/archi/masters/372593.wav> a <http://www.europeana.eu/schemas/edm/WebResource> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    66
        <http://purl.org/dc/elements/1.1/format> "audio/x-wav"^^<http://purl.org/dc/terms/IMT> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    67
        <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    68
        <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    69
        <http://purl.org/dc/terms/extent> "PT48M26S" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    70
        <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    71
        <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> .
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
    72
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    73
    <http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.mp3> a <http://www.europeana.eu/schemas/edm/WebResource> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    74
        <http://purl.org/dc/elements/1.1/format> "audio/mpeg"^^<http://purl.org/dc/terms/IMT> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    75
        <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    76
        <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    77
        <http://purl.org/dc/terms/extent> "PT48M26S" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    78
        <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    79
        <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    80
        <http://www.europeana.eu/schemas/edm/isDerivativeOf> <http://cocoon.huma-num.fr/data/archi/masters/372593.wav> .
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    81
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    82
    <http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.wav> a <http://www.europeana.eu/schemas/edm/WebResource> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    83
        <http://purl.org/dc/elements/1.1/format> "audio/x-wav"^^<http://purl.org/dc/terms/IMT> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    84
        <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    85
        <http://purl.org/dc/terms/created> "2010-11-17"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    86
        <http://purl.org/dc/terms/extent> "PT48M26S" ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    87
        <http://purl.org/dc/terms/issued> "2013-10-12T14:35:57+02:00"^^<http://purl.org/dc/terms/W3CDTF> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    88
        <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-sa/3.0/> ;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
    89
        <http://www.europeana.eu/schemas/edm/isDerivativeOf> <http://cocoon.huma-num.fr/data/archi/masters/372593.wav> .
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
EOT;
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
    public function setUp() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
        parent::setup();
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
    96
        $this->graph = new EasyRdf\Graph("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
    public function testConstructor() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
        $this->assertNotNull($this->graph, 'Graph shoud not be null');
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   103
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
122
b37fde30dd4a correct problem of identifier
ymh <ymh.work@gmail.com>
parents: 115
diff changeset
   105
        $this->assertEquals('corpusparole:crdo-CFPP2000_35_SOUNDid',$doc->getId(),'Must have the correct id');
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
    public function testTitle() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
        $this->assertNotNull($this->graph, 'Graph shoud not be null');
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   111
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   113
        $this->assertEquals("Entretien de Ozgur Kiliç 2",$doc->getTitle(),'Must have correct title');
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   114
        $this->assertInstanceOf(EasyRdf\Literal::class, $doc->getTitle(), "Title must be a literal");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
        $this->assertEquals('fr', $doc->getTitle()->getLang(), "Language title must be fr");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   118
    public function testModified() {
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   119
        $this->assertNotNull($this->graph, 'Graph shoud not be null');
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   120
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   121
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   122
        $this->assertInstanceOf(EasyRdf\Literal::class, $doc->getModified(), "Modified must be a literal");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   123
        $this->assertEquals("http://purl.org/dc/terms/W3CDTF", $doc->getModified()->getDatatypeURI(), "type must be http://purl.org/dc/terms/W3CDTF");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   124
        $this->assertEquals("2013-10-12T14:35:57+02:00", $doc->getModified(), "modified must be 2013-10-12T14:35:57+02:00");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   125
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   126
    }
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   127
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   128
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
    public function testPublisher() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   131
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
        $this->assertCount(1, $doc->getPublishers(), 'Publisher is an array of size 1');
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   134
        $this->assertInstanceOf('EasyRdf\Resource', $doc->getPublishers()[0], 'publisher is a resource');
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   135
        $this->assertEquals("http://viaf.org/viaf/142432638", $doc->getPublishers()[0]->getUri(),"");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
    public function testMediaArray() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   139
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   141
        $this->assertCount(4, $doc->getMediaArray(), "Media array must be of size 4");
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   142
        //print_r($doc->getMediaArray());
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   143
        foreach($doc->getMediaArray() as $url => $media) {
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
            $this->assertArrayHasKey('format', $media, "media has 'format key'");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
            $this->assertArrayHasKey('url', $media, "media has url");
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   146
            $this->assertCount(5, $media, "media is a 4 element array");
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   147
            $this->assertArrayHasKey('extent', $media, "media has extent");
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   148
            $this->assertArrayHasKey('extent_ms', $media, "media has extent_ms");
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   149
            $this->assertArrayHasKey('master', $media, "media has master");
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   150
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   151
            $this->assertEquals($media['url'], $url);
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   152
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   153
            $this->assertContains(
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   154
                $media['url'],
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   155
                [ "http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.wav",
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   156
                  "http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.mp3",
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   157
                  "http://cocoon.huma-num.fr/exist/crdo/cfpp2000/fra/Ozgur_Kilic_H_32_alii_3e-2.xml",
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   158
                  "http://cocoon.huma-num.fr/data/archi/masters/372593.wav"
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   159
                ]
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   160
            );
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   161
            if($url === "http://cocoon.huma-num.fr/data/archi/masters/372593.wav") {
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   162
                $this->assertEquals('audio/x-wav', $media['format']);
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   163
                $this->assertTrue($media['master'] === true, "should be master");
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   164
            }
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   165
            else {
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   166
                $this->assertTrue($media['master'] === false, "should not be master");
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   167
            }
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   168
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   169
            if( $url === "http://cocoon.huma-num.fr/data/archi/masters/372593.wav" ||
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   170
                $url === "http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.mp3" ||
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   171
                $url === "http://cocoon.huma-num.fr/data/cfpp2000/Ozgur_Kilic_H_32_alii_3e-2.wav" ) {
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   172
                $this->assertEquals("PT48M26S", $media['extent'], "extent is PT48M26S");
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   173
                $this->assertGreaterThan(0, $media['extent_ms'], "extent_ms must be > 0");
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   174
                $this->assertStringStartsWith('audio/', $media['format']);
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   175
            }
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   176
            else {
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   177
                $this->assertNull($media['extent'], "no media extent");
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   178
                $this->assertNull($media['extent_ms'], "extend in ms is null");
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   179
                $this->assertStringStartsWith('application/', $media['format']);
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   180
            }
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   181
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
        }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
    public function testGetTypes() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   186
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   188
        $this->assertCount(8, $doc->getTypes(), "types array must be of size 5");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
        foreach($doc->getTypes() as $type) {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
            $this->assertThat(
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
                $type,
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
                $this->logicalXor(
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   194
                    $this->isInstanceOf(EasyRdf\Literal::class),
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   195
                    $this->isInstanceOf(EasyRdf\Resource::class)
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
                )
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
            );
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
        }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
    public function testGetOtherTypes() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   202
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   204
        $this->assertCount(5, $doc->getOtherTypes(), "types array must be of size 5");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
        foreach($doc->getTypes() as $type) {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
            $this->assertThat(
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
                $type,
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
                $this->logicalXor(
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   210
                    $this->isInstanceOf(EasyRdf\Literal::class),
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   211
                    $this->isInstanceOf(EasyRdf\Resource::class)
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
                )
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
            );
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
        }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
    public function testGetDiscourseTypes() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   218
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   220
        $this->assertCount(3, $doc->getDiscourseTypes(), "types array must be of size 3");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   222
        $this->assertContainsOnlyInstancesOf("EasyRdf\Literal", $doc->getDiscourseTypes(), "Result contains only literals");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
        $type = $doc->getDiscourseTypes()[0];
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   224
        $this->assertEquals("narrative", $type->getValue(), "discourse type is narrative");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
        $this->assertEquals("http://www.language-archives.org/OLAC/1.1/discourse-type", $type->getDatatypeUri(), "discourse type url");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
    public function testCloneDocument() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   229
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
        $doc2 = clone $doc;
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
        $this->assertNotSame($doc, $doc2, "documents must not be the same");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
        $this->assertNotSame($doc->getGraph(), $doc2->getGraph(), "documents must not be the same");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   236
        $this->assertTrue(EasyRdf\Isomorphic::isomorphic($doc->getGraph(), $doc2->getGraph()),"graph must be isomorphic");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
    public function testIsIsomorphic() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   240
        $doc1 = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   241
        $doc2 = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", new EasyRdf\Graph("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC));
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
        $this->assertTrue($doc1->isIsomorphic($doc2),"document must be isomorphic");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   245
        $doc2->addLiteral('dc11:type', new EasyRdf\Literal("oratory", null, Config::get('OLAC_DISCOURSE_TYPE')['uri']));
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
        $this->assertFalse($doc1->isIsomorphic($doc2),"document must not be isomorphic");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
    public function testUpdateDiscourseTypes() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   252
        $newDiscourseTypes = ['oratory','dialogue','narrative', 'formulaic', 'ludic'];
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   254
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   255
        $this->assertCount(3, $doc->getDiscourseTypes(), "types array must be of size 3");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
        $doc->updateDiscourseTypes($newDiscourseTypes);
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   259
        $this->assertCount(5, $doc->getDiscourseTypes(), "types array must be of size 5");
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
        $discourseTypes = $doc->getDiscourseTypes();
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
        foreach($newDiscourseTypes as $dt) {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
            $this->assertContains($dt, $discourseTypes, "all discourse types must be in result list");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
        }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   268
    public function testUpdateDiscourseTypesDelta() {
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   269
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   270
        $newDiscourseTypes = ['oratory','dialogue','narrative', 'formulaic', 'ludic'];
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   271
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   272
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   273
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   274
        $doc->updateDiscourseTypes($newDiscourseTypes);
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   275
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   276
        $this->assertTrue($doc->isDirty());
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   277
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   278
        $this->assertEquals(1, $doc->deltaCount(), "There is one delta");
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   279
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   280
        $delta = $doc->getDeltaList()[0];
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   281
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   282
        $this->assertEquals("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $delta->getDeletedGraph()->getUri(), "uri of deleted graph must be ok");
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   283
        $this->assertEquals("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $delta->getAddedGraph()->getUri(), "uri of added graph must be ok");
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   284
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   285
        $this->assertEquals(3, $delta->getDeletedGraph()->countTriples(), "deleted graph must have only 3 triples");
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   286
        $this->assertEquals(5, $delta->getAddedGraph()->countTriples(), "deleted graph must have only 5 triples");
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   287
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   288
        $resQueryDiscourseType = $delta->getAddedGraph()->allLiterals($doc->getProvidedCHO(), 'dc11:type');
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   289
        foreach($resQueryDiscourseType as $dt) {
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   290
            $this->assertInstanceOf(EasyRdf\Literal::class, $dt, "This must be a litteral");
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   291
            $this->assertEquals('http://www.language-archives.org/OLAC/1.1/discourse-type', $dt->getDatatypeUri(), "The type of the Litteral must be correct");
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   292
        }
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   293
        foreach($newDiscourseTypes as $dt) {
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   294
            $this->assertContains($dt, $resQueryDiscourseType, "all discourse types must be in result list");
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   295
        }
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   296
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   297
    }
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   298
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   299
    public function testUpdateTitle() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   300
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   301
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   302
        $oldTitle = $doc->getTitle();
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   303
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   304
        $doc->setTitle("new title", "en");
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   305
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   306
        $this->assertEquals("new title", $doc->getTitleValue());
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   307
        $this->assertEquals("new title", $doc->getTitle()->getValue());
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   308
        $this->assertEquals("en", $doc->getTitle()->getLang());
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   309
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   310
        $this->assertTrue($doc->isDirty());
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   311
        $this->assertEquals(1, $doc->deltaCount(), "There is one delta");
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   312
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   313
        $delta = $doc->getDeltaList()[0];
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   314
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   315
        $addedTitles = $delta->getAddedGraph()->allLiterals($doc->getProvidedCHO(), '<http://purl.org/dc/elements/1.1/title>');
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   316
        $this->assertCount(1, $addedTitles);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   317
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   318
        $removedTitles = $delta->getDeletedGraph()->allLiterals($doc->getProvidedCHO(), '<http://purl.org/dc/elements/1.1/title>');
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   319
        $this->assertCount(1, $removedTitles);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   320
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   321
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   322
    }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   323
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
    public function testUpdateDiscourseTypesIsomorphic() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
        $newDiscourseTypes = ['oratory','dialogue','narrative'];
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   327
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   328
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
        $doc->updateDiscourseTypes($newDiscourseTypes);
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   330
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   331
        $doc2 = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", new EasyRdf\Graph("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", DocumentTest::TEST_DOC));
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   333
        $this->assertFalse($doc->isIsomorphic($doc2),"document must not be isomorphic after adding discourse type");
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
    }
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
   335
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   336
    public function testGetContributors() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   337
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   338
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   339
        $contributors = $doc->getContributors();
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   340
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   341
        $this->assertNotEmpty($contributors, "The contributors array should not be empty");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   342
        $this->assertCount(8, $contributors, "The contributors array should have 8 elements");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   343
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   344
        foreach ($contributors as $contribDef) {
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   345
            $this->assertArrayHasKey('name', $contribDef, "ContribDef must have name key");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   346
            $this->assertArrayHasKey('url', $contribDef, "ContribDef must have url key");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   347
            $this->assertArrayHasKey('role', $contribDef, "ContribDef must have role key");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   348
            $this->assertContains($contribDef['role'], CocoonUtils::OLAC_ROLES, "Role should be in OLAC_ROLES");
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   349
        }
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   350
    }
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   351
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   352
    public function testSetContributors() {
112
7a542145832c replace corpus doc base url
ymh <ymh.work@gmail.com>
parents: 111
diff changeset
   353
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   354
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   355
        $contributors = $doc->getContributors();
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   356
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   357
        $contribList = [[
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   358
            "name"=> "Guylaine Brun-Trigaud",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   359
            "url"=> "http://viaf.org/viaf/56666014",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   360
            "role"=> "http://www.language-archives.org/OLAC/1.1/data_inputter"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   361
        ], [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   362
            "name"=> "LDOR",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   363
            "url"=> null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   364
            "role"=> "http://www.language-archives.org/OLAC/1.1/depositor"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   365
        ], [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   366
            "name"=> "Thésaurus Occitan",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   367
            "url"=> null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   368
            "role"=> "http://www.language-archives.org/OLAC/1.1/depositor"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   369
        ], [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   370
            "name"=> "Équipe de Recherche en Syntaxe et Sémantique",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   371
            "url"=> null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   372
            "role"=> "http://www.language-archives.org/OLAC/1.1/editor"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   373
        ], [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   374
            "name"=> "Bases, corpus, langage",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   375
            "url"=> null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   376
            "role"=> "http://www.language-archives.org/OLAC/1.1/editor"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   377
        ], [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   378
            "name"=> "Patrick Sauzet",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   379
            "url"=> "http://viaf.org/viaf/51700729",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   380
            "role"=> "http://www.language-archives.org/OLAC/1.1/researcher"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   381
        ], [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   382
            "name"=> "Alazet, Pierre",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   383
            "url"=> null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   384
            "role"=> "http://www.language-archives.org/OLAC/1.1/speaker"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   385
        ], [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   386
            "name"=> "Del Duca, Jeanne",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   387
            "url"=> null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   388
            "role"=> "http://www.language-archives.org/OLAC/1.1/transcriber"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   389
        ], [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   390
            "name"=> "Jane Austen, 1775-1817",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   391
            "url"=> "http://viaf.org/viaf/102333412",
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   392
            "role"=> "http://www.language-archives.org/OLAC/1.1/compiler"
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   393
        ]];
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   394
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   395
        $doc->setContributors($contribList);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   396
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   397
        $newContribs = $doc->getContributors();
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   398
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   399
        $this->assertCount(9, $newContribs);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   400
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   401
        $this->assertTrue($doc->isDirty());
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   402
        $this->assertEquals(1, $doc->deltaCount(), "There is one delta");
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   403
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   404
        $delta = $doc->getDeltaList()[0];
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   405
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   406
        $addedGraph = $delta->getAddedGraph();
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   407
        $this->assertEquals(9, $addedGraph->countTriples());
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   408
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   409
        $removedGraph = $delta->getDeletedGraph();
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   410
        $this->assertEquals(count($contributors), $removedGraph->countTriples());
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   411
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   412
        $foundJaneAusten = false;
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   413
        foreach ($newContribs as $contribDef) {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   414
            if(!is_null($contribDef['nameLiteral'])) {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   415
                $lit = $contribDef['nameLiteral'];
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   416
                $this->assertNull($lit->getDatatype(), "Data type must be null $lit");
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   417
                $this->assertNotNull($lit->getLang(), "lang must not be null $lit");
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   418
            }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   419
            if($contribDef['url'] == 'http://viaf.org/viaf/102333412') {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   420
                $this->assertNull($contribDef['name'], 'Name must be null');
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   421
                $this->assertNull($contribDef['nameLiteral'], 'Name literal must be null');
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   422
                $foundJaneAusten = true;
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   423
            }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   424
        }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   425
        $this->assertTrue($foundJaneAusten, "Jane austenn not foud");
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   426
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   427
    }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   428
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   429
    public function testGetSubjects() {
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   430
        $doc = new Document("http://corpusdelaparole.huma-num.fr/corpus/res/crdo-CFPP2000_35_SOUND", $this->graph);
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   431
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   432
        $subjects = $doc->getSubjects();
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   433
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   434
        $this->assertCount(28, $subjects, "Must have 15 subjects");
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   435
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   436
        foreach ($doc->getSubjects() as $s) {
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   437
            $this->assertThat(
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   438
                $s,
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   439
                $this->logicalXor(
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   440
                    $this->isInstanceOf('EasyRdf\Literal'),
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   441
                    $this->isInstanceOf('EasyRdf\Resource')
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   442
                )
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   443
            );
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   444
        }
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   445
    }
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 122
diff changeset
   446
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   447
}