From de7218b2ed0f37ad674fc42ecc36278e789a9610 Mon Sep 17 00:00:00 2001
From: Patrick Barroca <pbarroca@afi-sa.fr>
Date: Thu, 16 Feb 2017 10:02:30 +0100
Subject: [PATCH] dev #50215 remove Bibliondemand from available doctypes

---
 .../DataProfileControllerDublinCoreTest.php        | 14 +++++++++++---
 library/Class/DigitalResource.php                  |  5 ++++-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerDublinCoreTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerDublinCoreTest.php
index d4e3da21f23..a08f7c6ac41 100644
--- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerDublinCoreTest.php
+++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DataProfileControllerDublinCoreTest.php
@@ -41,6 +41,7 @@ abstract class Cosmo_DataProfileControllerDublinCoreProfileTestCase extends Cosm
 
 
 
+
 class Cosmo_DataProfileControllerDublinCoreTest extends Cosmo_DataProfileControllerDublinCoreProfileTestCase {
   public function setUp() {
     parent::setUp();
@@ -48,28 +49,35 @@ class Cosmo_DataProfileControllerDublinCoreTest extends Cosmo_DataProfileControl
   }
 
 
-/** @test */
+  /** @test */
   public function fileFormatShouldBeDublinCore() {
     $this->assertXPath('//select/option[@label="Dublin Core"][@value="9"][@selected]');
   }
 
 
-/** @test */
+  /** @test */
   public function fieldsetDocTypesShouldBePresent() {
     $this->assertXPathContentContains('//form//fieldset/legend',
                                       'Type de documents');
   }
 
 
-/** @test */
+  /** @test */
   public function typeDocColumnLabelsShouldBeTypeAndFormat() {
     $this->assertXPathContentContains('//script',
                                       'fields:[{"name":"1_type","label":"dc:Type"},{"name":"1_format","label":"dc:Format"}]');
   }
+
+
+  /** @test */
+  public function docTypeBibliondemandShouldNotBePresent() {
+    $this->assertNotXPathContentContains('//script', 'Bibliondemand', $this->_response->getBody());
+  }
 }
 
 
 
+
 class Cosmo_DataProfileControllerDublinCorePostTest extends Cosmo_DataProfileControllerDublinCoreProfileTestCase {
   public function setUp() {
     parent::setUp();
diff --git a/library/Class/DigitalResource.php b/library/Class/DigitalResource.php
index b3951f3e932..5e75e54e458 100644
--- a/library/Class/DigitalResource.php
+++ b/library/Class/DigitalResource.php
@@ -189,7 +189,10 @@ class Class_DigitalResource extends Class_Entity {
                 ->injectInto([],
                              function($types, $config)
                              {
-                               $types[$this->getDocType($config->getName())] = $config->getDocTypeLabel();
+                               if(!$label = $config->getDocTypeLabel())
+                                 return $types;
+
+                               $types[$this->getDocType($config->getName())] = $label;
                                return $types;
                              }
                 );
-- 
GitLab