| changeset 498 | 265992e5b379 |
| parent 497 | f3474aeec884 |
| child 500 | 4f507ba2bb4c |
| 497:f3474aeec884 | 498:265992e5b379 |
|---|---|
11 class DocumentTest extends TestCase { |
11 class DocumentTest extends TestCase { |
12 |
12 |
13 const TEST_INPUT_DOCS = [ |
13 const TEST_INPUT_DOCS = [ |
14 'TEST' => __DIR__.'/files/DocumentTest/test_doc.ttl', |
14 'TEST' => __DIR__.'/files/DocumentTest/test_doc.ttl', |
15 'TEST_NO_GEOINFO' => __DIR__.'/files/DocumentTest/test_no_geoinfo.ttl', |
15 'TEST_NO_GEOINFO' => __DIR__.'/files/DocumentTest/test_no_geoinfo.ttl', |
16 'TEST_NO_DESCRIPTION' => __DIR__.'/files/DocumentTest/test_doc_no_description.ttl', |
|
16 ]; |
17 ]; |
17 |
18 |
18 private $inputGraphes = []; |
19 private $inputGraphes = []; |
19 |
20 |
20 public function setUp() { |
21 public function setUp() { |
425 |
426 |
426 $json = $doc->jsonSerialize(); |
427 $json = $doc->jsonSerialize(); |
427 |
428 |
428 $this->assertTrue(is_array($json), 'Returned json must be an array'); |
429 $this->assertTrue(is_array($json), 'Returned json must be an array'); |
429 $this->assertEquals( |
430 $this->assertEquals( |
430 ["id", "uri", "title", "languages", "modified", "issued", "created", "publishers", "contributors", "subjects", "types", "transcript", "mediaArray", "geoInfo"], |
431 [ "id", "uri", "title", "languages", "modified", "issued", |
432 "created", "publishers", "contributors", "subjects", "types", |
|
433 "transcript", "mediaArray", "geoInfo", "descriptions" ], |
|
431 array_keys($json) |
434 array_keys($json) |
432 ); |
435 ); |
433 $this->assertEquals(sprintf('%1$s/crdo-CFPP2000_35_SOUNDid', config('corpusparole.handle_prefix')), $json['id']); |
436 $this->assertEquals(sprintf('%1$s/crdo-CFPP2000_35_SOUNDid', config('corpusparole.handle_prefix')), $json['id']); |
434 $this->assertTrue(is_array($json['transcript'])); |
437 $this->assertTrue(is_array($json['transcript'])); |
435 $this->assertTrue(is_array($json['mediaArray'])); |
438 $this->assertTrue(is_array($json['mediaArray'])); |
499 $this->assertCount(1, $res->getCurrentDelta()->getDeleteWhere(), "Delete where must have one element"); |
502 $this->assertCount(1, $res->getCurrentDelta()->getDeleteWhere(), "Delete where must have one element"); |
500 $this->assertNotNull($res->getCurrentDelta()->getAddedGraph(), "Added graph is not null"); |
503 $this->assertNotNull($res->getCurrentDelta()->getAddedGraph(), "Added graph is not null"); |
501 $this->assertEquals(9, $res->getCurrentDelta()->getAddedGraph()->countTriples(), "Added graph must have 7 triples"); |
504 $this->assertEquals(9, $res->getCurrentDelta()->getAddedGraph()->countTriples(), "Added graph must have 7 triples"); |
502 } |
505 } |
503 |
506 |
507 public function testDescriptions() { |
|
508 $doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->inputGraphes['TEST']); |
|
509 |
|
510 $descriptions = $doc->getDescriptions(); |
|
511 |
|
512 $this->assertTrue(is_array($descriptions)); |
|
513 |
|
514 $this->assertCount(4, $descriptions); |
|
515 } |
|
516 |
|
517 public function testNoDescription() { |
|
518 $doc = new Document(config('corpusparole.corpus_doc_id_base_uri')."crdo-CFPP2000_35_SOUND", $this->inputGraphes['TEST_NO_DESCRIPTION']); |
|
519 |
|
520 $descriptions = $doc->getDescriptions(); |
|
521 |
|
522 $this->assertTrue(is_array($descriptions)); |
|
523 |
|
524 $this->assertCount(0, $descriptions); |
|
525 } |
|
526 |
|
527 |
|
504 |
528 |
505 } |
529 } |