author | Chloe Laisne <chloe.laisne@gmail.com> |
Wed, 24 Aug 2016 17:48:50 +0200 | |
changeset 266 | 0e1880fa7bd3 |
parent 169 | 8fddc113095e |
child 277 | bd4bc1db4f40 |
permissions | -rw-r--r-- |
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 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
19 |
<%1\$scrdo-CFPP2000_35_SOUND> a <http://www.openarchives.org/ore/terms/Aggregation> ; |
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
|
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 ; |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
36 |
<http://purl.org/dc/elements/1.1/identifier> "ark:/87895/1.17-375004" , "%2\$scrdo-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" ; |
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
|
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(); |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
96 |
$this->graph = new EasyRdf\Graph(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", sprintf(DocumentTest::TEST_DOC, config('corpusparole.corpus_doc_id_base_uri'), config('corpusparole.corpus_id_scheme'))); |
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 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
103 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
105 |
$this->assertEquals(config('corpusparole.corpus_id_scheme').'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 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
111 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
121 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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 |
|
138
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
128 |
public function testSetModified() { |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
129 |
$currentTime = gmdate(DateTime::ATOM); |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
130 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
138
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
131 |
$doc->setModified($currentTime); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
132 |
$this->assertInstanceOf(EasyRdf\Literal::class, $doc->getModified(), "Modified must be a literal"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
133 |
$this->assertEquals("http://purl.org/dc/terms/W3CDTF", $doc->getModified()->getDatatypeURI(), "type must be http://purl.org/dc/terms/W3CDTF"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
134 |
$this->assertEquals(preg_replace('/[\+\-]00(\:?)00$/', 'Z', $currentTime), $doc->getModified()->getValue(), "modified must be $currentTime"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
135 |
} |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
136 |
|
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
137 |
public function testSetModifiedNull() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
138 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
138
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
139 |
$doc->setModified(); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
140 |
$this->assertInstanceOf(EasyRdf\Literal::class, $doc->getModified(), "Modified must be a literal"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
141 |
$this->assertEquals("http://purl.org/dc/terms/W3CDTF", $doc->getModified()->getDatatypeURI(), "type must be http://purl.org/dc/terms/W3CDTF"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
142 |
$foundDateTime = \DateTime::createFromFormat(\DateTime::ATOM, $doc->getModified()->getValue()); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
143 |
$nowUTC = new \DateTime('now', new \DateTimeZone("UTC")); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
144 |
$this->assertTrue($nowUTC->getTimestamp() - $foundDateTime->getTimestamp() < 2, "must have less than 2 seconds diff"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
145 |
} |
20
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
146 |
|
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
147 |
public function testPublisher() { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
148 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
149 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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
|
150 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
151 |
$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
|
152 |
$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
|
153 |
$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
|
154 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
155 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
156 |
public function testMediaArray() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
157 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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
|
158 |
|
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
159 |
$this->assertCount(3, $doc->getMediaArray(), "Media array must be of size 3"); |
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
|
160 |
//print_r($doc->getMediaArray()); |
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
161 |
foreach($doc->getMediaArray() as $media) { |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
162 |
$this->assertInstanceOf('CorpusParole\Models\MediaResource', $media, "media msute of type MediaResource"); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
163 |
// $this->assertArrayHasKey('format', $media, "media has 'format key'"); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
164 |
// $this->assertArrayHasKey('url', $media, "media has url"); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
165 |
// $this->assertCount(5, $media, "media is a 4 element array"); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
166 |
// $this->assertArrayHasKey('extent', $media, "media has extent"); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
167 |
// $this->assertArrayHasKey('extent_ms', $media, "media has extent_ms"); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
168 |
// $this->assertArrayHasKey('master', $media, "media has master"); |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
169 |
|
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
170 |
//$this->assertEquals($media['url'], $url); |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
171 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
172 |
$this->assertContains( |
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
173 |
$media->getUrl(), |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
174 |
[ "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
|
175 |
"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
|
176 |
"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
|
177 |
] |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
178 |
); |
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
179 |
if($media->getUrl() === "http://cocoon.huma-num.fr/data/archi/masters/372593.wav") { |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
180 |
$this->assertEquals('audio/x-wav', $media->getFormat()); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
181 |
$this->assertTrue($media->isMaster() === true, "should be master"); |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
182 |
} |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
183 |
else { |
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
184 |
$this->assertTrue($media->isMaster() === false, "should not be master"); |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
185 |
} |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
186 |
|
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
187 |
$this->assertEquals("PT48M26S", $media->getExtent(), "extent is PT48M26S"); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
188 |
$this->assertGreaterThan(0, $media->getExtentMs(), "extent_ms must be > 0"); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
189 |
$this->assertStringStartsWith('audio/', $media->getFormat()); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
190 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
191 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
192 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
193 |
public function testGetTypes() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
194 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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
|
195 |
|
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
|
196 |
$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
|
197 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
198 |
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
|
199 |
$this->assertThat( |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
200 |
$type, |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
201 |
$this->logicalXor( |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
202 |
$this->isInstanceOf(EasyRdf\Literal::class), |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
203 |
$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
|
204 |
) |
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 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
207 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
208 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
209 |
public function testGetOtherTypes() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
210 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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
|
211 |
|
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
|
212 |
$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
|
213 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
214 |
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
|
215 |
$this->assertThat( |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
216 |
$type, |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
217 |
$this->logicalXor( |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
218 |
$this->isInstanceOf(EasyRdf\Literal::class), |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
219 |
$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
|
220 |
) |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
221 |
); |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
222 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
223 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
224 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
225 |
public function testGetDiscourseTypes() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
226 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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
|
227 |
|
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
228 |
$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
|
229 |
|
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
230 |
$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
|
231 |
$type = $doc->getDiscourseTypes()[0]; |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
232 |
$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
|
233 |
$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
|
234 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
235 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
236 |
public function testCloneDocument() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
237 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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
|
238 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
239 |
$doc2 = clone $doc; |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
240 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
241 |
$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
|
242 |
$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
|
243 |
|
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
244 |
$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
|
245 |
} |
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 |
public function testIsIsomorphic() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
248 |
$doc1 = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
249 |
$doc2 = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", new EasyRdf\Graph(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", sprintf(DocumentTest::TEST_DOC, config('corpusparole.corpus_doc_id_base_uri'), config('corpusparole.corpus_id_scheme')))); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
250 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
251 |
$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
|
252 |
|
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
253 |
$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
|
254 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
255 |
$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
|
256 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
257 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
258 |
public function testUpdateDiscourseTypes() { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
259 |
|
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
260 |
$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
|
261 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
262 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
263 |
$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
|
264 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
265 |
$doc->updateDiscourseTypes($newDiscourseTypes); |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
266 |
|
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
267 |
$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
|
268 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
269 |
$discourseTypes = $doc->getDiscourseTypes(); |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
270 |
foreach($newDiscourseTypes as $dt) { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
271 |
$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
|
272 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
273 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
274 |
} |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
275 |
|
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
276 |
public function testUpdateDiscourseTypesDelta() { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
277 |
|
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
278 |
$newDiscourseTypes = ['oratory','dialogue','narrative', 'formulaic', 'ludic']; |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
279 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
280 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
4
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
281 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
282 |
$doc->updateDiscourseTypes($newDiscourseTypes); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
283 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
284 |
$this->assertTrue($doc->isDirty()); |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
285 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
286 |
$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
|
287 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
288 |
$delta = $doc->getDeltaList()[0]; |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
289 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
290 |
$this->assertEquals(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $delta->getDeletedGraph()->getUri(), "uri of deleted graph must be ok"); |
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
291 |
$this->assertEquals(config('corpusparole.corpus_doc_id_base_uri')."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
|
292 |
|
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
293 |
$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
|
294 |
$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
|
295 |
|
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
296 |
$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
|
297 |
foreach($resQueryDiscourseType as $dt) { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
298 |
$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
|
299 |
$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
|
300 |
} |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
301 |
foreach($newDiscourseTypes as $dt) { |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
302 |
$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
|
303 |
} |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
304 |
|
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
305 |
} |
f55970e41793
first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
306 |
|
28 | 307 |
public function testUpdateTitle() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
308 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
28 | 309 |
|
310 |
$oldTitle = $doc->getTitle(); |
|
311 |
||
312 |
$doc->setTitle("new title", "en"); |
|
313 |
||
314 |
$this->assertEquals("new title", $doc->getTitleValue()); |
|
315 |
$this->assertEquals("new title", $doc->getTitle()->getValue()); |
|
316 |
$this->assertEquals("en", $doc->getTitle()->getLang()); |
|
317 |
||
318 |
$this->assertTrue($doc->isDirty()); |
|
319 |
$this->assertEquals(1, $doc->deltaCount(), "There is one delta"); |
|
320 |
||
321 |
$delta = $doc->getDeltaList()[0]; |
|
322 |
||
323 |
$addedTitles = $delta->getAddedGraph()->allLiterals($doc->getProvidedCHO(), '<http://purl.org/dc/elements/1.1/title>'); |
|
324 |
$this->assertCount(1, $addedTitles); |
|
325 |
||
326 |
$removedTitles = $delta->getDeletedGraph()->allLiterals($doc->getProvidedCHO(), '<http://purl.org/dc/elements/1.1/title>'); |
|
327 |
$this->assertCount(1, $removedTitles); |
|
328 |
||
329 |
||
330 |
} |
|
331 |
||
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
332 |
public function testUpdateDiscourseTypesIsomorphic() { |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
333 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
334 |
$newDiscourseTypes = ['oratory','dialogue','narrative']; |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
335 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
336 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."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
|
337 |
$doc->updateDiscourseTypes($newDiscourseTypes); |
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
338 |
|
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
339 |
$doc2 = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", new EasyRdf\Graph(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", sprintf(DocumentTest::TEST_DOC, config('corpusparole.corpus_doc_id_base_uri'), config('corpusparole.corpus_id_scheme')))); |
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
340 |
|
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
341 |
$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
|
342 |
} |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
4
diff
changeset
|
343 |
|
20
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
344 |
public function testGetContributors() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
345 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
20
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
346 |
|
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
347 |
$contributors = $doc->getContributors(); |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
348 |
|
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
349 |
$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
|
350 |
$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
|
351 |
|
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
352 |
foreach ($contributors as $contribDef) { |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
353 |
$this->assertArrayHasKey('name', $contribDef, "ContribDef must have name key"); |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
354 |
$this->assertArrayHasKey('url', $contribDef, "ContribDef must have url key"); |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
355 |
$this->assertArrayHasKey('role', $contribDef, "ContribDef must have role key"); |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
356 |
$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
|
357 |
} |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
358 |
} |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
359 |
|
28 | 360 |
public function testSetContributors() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
361 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
28 | 362 |
|
363 |
$contributors = $doc->getContributors(); |
|
364 |
||
365 |
$contribList = [[ |
|
366 |
"name"=> "Guylaine Brun-Trigaud", |
|
367 |
"url"=> "http://viaf.org/viaf/56666014", |
|
368 |
"role"=> "http://www.language-archives.org/OLAC/1.1/data_inputter" |
|
369 |
], [ |
|
370 |
"name"=> "LDOR", |
|
371 |
"url"=> null, |
|
372 |
"role"=> "http://www.language-archives.org/OLAC/1.1/depositor" |
|
373 |
], [ |
|
374 |
"name"=> "Thésaurus Occitan", |
|
375 |
"url"=> null, |
|
376 |
"role"=> "http://www.language-archives.org/OLAC/1.1/depositor" |
|
377 |
], [ |
|
378 |
"name"=> "Équipe de Recherche en Syntaxe et Sémantique", |
|
379 |
"url"=> null, |
|
380 |
"role"=> "http://www.language-archives.org/OLAC/1.1/editor" |
|
381 |
], [ |
|
382 |
"name"=> "Bases, corpus, langage", |
|
383 |
"url"=> null, |
|
384 |
"role"=> "http://www.language-archives.org/OLAC/1.1/editor" |
|
385 |
], [ |
|
386 |
"name"=> "Patrick Sauzet", |
|
387 |
"url"=> "http://viaf.org/viaf/51700729", |
|
388 |
"role"=> "http://www.language-archives.org/OLAC/1.1/researcher" |
|
389 |
], [ |
|
390 |
"name"=> "Alazet, Pierre", |
|
391 |
"url"=> null, |
|
392 |
"role"=> "http://www.language-archives.org/OLAC/1.1/speaker" |
|
393 |
], [ |
|
394 |
"name"=> "Del Duca, Jeanne", |
|
395 |
"url"=> null, |
|
396 |
"role"=> "http://www.language-archives.org/OLAC/1.1/transcriber" |
|
397 |
], [ |
|
398 |
"name"=> "Jane Austen, 1775-1817", |
|
399 |
"url"=> "http://viaf.org/viaf/102333412", |
|
400 |
"role"=> "http://www.language-archives.org/OLAC/1.1/compiler" |
|
401 |
]]; |
|
402 |
||
403 |
$doc->setContributors($contribList); |
|
404 |
||
405 |
$newContribs = $doc->getContributors(); |
|
406 |
||
407 |
$this->assertCount(9, $newContribs); |
|
408 |
||
409 |
$this->assertTrue($doc->isDirty()); |
|
410 |
$this->assertEquals(1, $doc->deltaCount(), "There is one delta"); |
|
411 |
||
412 |
$delta = $doc->getDeltaList()[0]; |
|
413 |
||
414 |
$addedGraph = $delta->getAddedGraph(); |
|
415 |
$this->assertEquals(9, $addedGraph->countTriples()); |
|
416 |
||
417 |
$removedGraph = $delta->getDeletedGraph(); |
|
418 |
$this->assertEquals(count($contributors), $removedGraph->countTriples()); |
|
419 |
||
420 |
$foundJaneAusten = false; |
|
421 |
foreach ($newContribs as $contribDef) { |
|
422 |
if(!is_null($contribDef['nameLiteral'])) { |
|
423 |
$lit = $contribDef['nameLiteral']; |
|
424 |
$this->assertNull($lit->getDatatype(), "Data type must be null $lit"); |
|
425 |
$this->assertNotNull($lit->getLang(), "lang must not be null $lit"); |
|
426 |
} |
|
427 |
if($contribDef['url'] == 'http://viaf.org/viaf/102333412') { |
|
428 |
$this->assertNull($contribDef['name'], 'Name must be null'); |
|
429 |
$this->assertNull($contribDef['nameLiteral'], 'Name literal must be null'); |
|
430 |
$foundJaneAusten = true; |
|
431 |
} |
|
432 |
} |
|
433 |
$this->assertTrue($foundJaneAusten, "Jane austenn not foud"); |
|
434 |
||
435 |
} |
|
436 |
||
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
|
437 |
public function testGetSubjects() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
438 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
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
|
439 |
|
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 |
$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
|
441 |
|
138
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
442 |
$this->assertCount(28, $subjects, "Must have 28 subjects"); |
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
|
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 |
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
|
445 |
$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
|
446 |
$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
|
447 |
$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
|
448 |
$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
|
449 |
$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
|
450 |
) |
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
|
451 |
); |
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
|
452 |
} |
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
|
453 |
} |
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
|
454 |
|
138
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
455 |
public function testSetSubjects() { |
143
023b6d467566
Change id prefix + url + correct tests
ymh <ymh.work@gmail.com>
parents:
138
diff
changeset
|
456 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
138
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
457 |
|
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
458 |
$newSubjects = [ |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
459 |
"http://ark.bnf.fr/ark:/12148/cb13318415c", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
460 |
"http://ark.bnf.fr/ark:/12148/cb133188907", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
461 |
"http://ark.bnf.fr/ark:/12148/cb11932762f", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
462 |
"http://ark.bnf.fr/ark:/12148/cb133183660", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
463 |
"http://ark.bnf.fr/ark:/12148/cb122368540", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
464 |
"http://ark.bnf.fr/ark:/12148/cb119418302", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
465 |
"http://ark.bnf.fr/ark:/12148/cb135540729", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
466 |
"http://ark.bnf.fr/ark:/12148/cb133192210", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
467 |
"http://ark.bnf.fr/ark:/12148/cb119377452", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
468 |
"http://ark.bnf.fr/ark:/12148/cb13320451h", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
469 |
"http://ark.bnf.fr/ark:/12148/cb13318422n", |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
470 |
"http://ark.bnf.fr/ark:/12148/cb11975823c" |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
471 |
]; |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
472 |
|
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
473 |
$doc->setSubjects($newSubjects); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
474 |
|
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
475 |
$this->assertTrue($doc->isDirty(), "The document must have changed"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
476 |
|
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
477 |
$subjects = $doc->getSubjects(); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
478 |
|
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
479 |
$this->assertCount(12, $subjects, "Must have 12 subjects"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
480 |
|
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
481 |
foreach ($doc->getSubjects() as $s) { |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
482 |
$this->assertInstanceOf('EasyRdf\Resource', $s, "Mustbe a Resource"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
483 |
$this->assertTrue(strrpos($s->getUri(), "http://ark.bnf.fr/ark:/12148/cb") === 0, "Must start with http://ark.bnf.fr/ark:/12148/cb"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
484 |
$this->assertContains($s->getUri(), $newSubjects, "$s must be in new subjects list"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
485 |
if(($key = array_search($s->getUri(), $newSubjects)) !== false) { |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
486 |
unset($newSubjects[$key]); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
487 |
} |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
488 |
} |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
489 |
$this->assertEmpty($newSubjects, "all subjects must have been removed"); |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
490 |
} |
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
491 |
|
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
492 |
//TODO: test null transcript + null media array |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
493 |
public function testJsonSerialize() { |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
494 |
$doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->graph); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
495 |
|
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
496 |
$json = $doc->jsonSerialize(); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
497 |
|
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
498 |
$this->assertTrue(is_array($json), 'Returned json must be an array'); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
499 |
$this->assertEquals( |
169
8fddc113095e
Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents:
168
diff
changeset
|
500 |
["id", "uri", "title", "language", "modified", "issued", "publishers", "contributors", "subjects", "transcript", "mediaArray", "geoInfo"], |
168
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
501 |
array_keys($json) |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
502 |
); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
503 |
$this->assertEquals(sprintf('%1$s/crdo-CFPP2000_35_SOUNDid', config('corpusparole.handle_prefix')), $json['id']); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
504 |
$this->assertTrue(is_array($json['transcript'])); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
505 |
$this->assertTrue(is_array($json['mediaArray'])); |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
506 |
|
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
507 |
} |
17f10b56c079
improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents:
143
diff
changeset
|
508 |
|
138
3079cbf80006
add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents:
130
diff
changeset
|
509 |
|
2
00e2916104fe
Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
510 |
} |