--- a/server/src/tests/Models/DocumentTest.php Fri Nov 27 17:59:36 2015 +0100
+++ b/server/src/tests/Models/DocumentTest.php Tue Dec 01 13:33:08 2015 +0100
@@ -1,6 +1,7 @@
<?php
use CorpusParole\Models\Document;
+use CorpusParole\Libraries\CocoonUtils;
/**
*
@@ -120,6 +121,17 @@
$this->assertEquals('fr', $doc->getTitle()->getLang(), "Language title must be fr");
}
+ public function testModified() {
+ $this->assertNotNull($this->graph, 'Graph shoud not be null');
+
+ $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph);
+ $this->assertInstanceOf(EasyRdf\Literal::class, $doc->getModified(), "Modified must be a literal");
+ $this->assertEquals("http://purl.org/dc/terms/W3CDTF", $doc->getModified()->getDatatypeURI(), "type must be http://purl.org/dc/terms/W3CDTF");
+ $this->assertEquals("2013-10-12T14:35:57+02:00", $doc->getModified(), "modified must be 2013-10-12T14:35:57+02:00");
+
+ }
+
+
public function testPublisher() {
$doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph);
@@ -169,7 +181,7 @@
}
else {
$this->assertNull($media['extent'], "no media extent");
- $this->assertSame(0, $media['extent_ms'], "extend in ms is 0");
+ $this->assertNull($media['extent_ms'], "extend in ms is null");
$this->assertStringStartsWith('application/', $media['format']);
}
@@ -302,4 +314,20 @@
$this->assertFalse($doc->isIsomorphic($doc2),"document must not be isomorphic after adding discourse type");
}
+ public function testGetContributors() {
+ $doc = new Document("http://purl.org/poi/corpusdelaparole.huma-num.fr/crdo-CFPP2000_35_SOUND", $this->graph);
+
+ $contributors = $doc->getContributors();
+
+ $this->assertNotEmpty($contributors, "The contributors array should not be empty");
+ $this->assertCount(8, $contributors, "The contributors array should have 8 elements");
+
+ foreach ($contributors as $contribDef) {
+ $this->assertArrayHasKey('name', $contribDef, "ContribDef must have name key");
+ $this->assertArrayHasKey('url', $contribDef, "ContribDef must have url key");
+ $this->assertArrayHasKey('role', $contribDef, "ContribDef must have role key");
+ $this->assertContains($contribDef['role'], CocoonUtils::OLAC_ROLES, "Role should be in OLAC_ROLES");
+ }
+ }
+
}