diff --git a/library/Class/Systeme/Report.php b/library/Class/Systeme/Report.php index 2a7ed1b54788beb98b4206fd713797f93655525a..cc1781a8e0936d33f0832a29b2e8587c52ffaca6 100644 --- a/library/Class/Systeme/Report.php +++ b/library/Class/Systeme/Report.php @@ -205,7 +205,7 @@ class Class_Systeme_Report_DigitalConnectors extends Class_Systeme_Report_Abstra if ($description['doctype_id'] && in_array('HARVEST', $description['features'])) $record['album_count'] = Class_Album::countBy(['type_doc_id' => $description['doctype_id']]); - if ($description['enabled'] || isset($record['album_count'])) + if ($description['enabled'] || (isset($record['album_count']) && $record['album_count'])) $visitor->visitRecordValues($record); } } diff --git a/tests/library/ZendAfi/View/Helper/Status/JsonTest.php b/tests/library/ZendAfi/View/Helper/Status/JsonTest.php index 793530891873be1bbfaf5c55817f6efbd52423cd..bd2804986c9cd968a727728aaed89b686c29a802 100644 --- a/tests/library/ZendAfi/View/Helper/Status/JsonTest.php +++ b/tests/library/ZendAfi/View/Helper/Status/JsonTest.php @@ -284,27 +284,17 @@ class ZendAfi_View_Helper_Status_JsonTest extends ZendAfi_View_Helper_Status_Tes /** @test */ - public function OrpheaShouldEnabled() { - $this->assertContains(["code" => "ORPHEA", - "label" => "Orphea", - "enabled" => true, - "features" => ["HARVEST", "SSO"], - "album_count" => 0 - ], - $this->_report['digital_connectors']); + public function OrpheaShouldNotBePresent() { + $this->assertNotContains(["code" => "ORPHEA", + "label" => "Orphea", + "enabled" => false, + "features" => ["HARVEST", "SSO"], + "album_count" => 0 + ], + $this->_report['digital_connectors']); } - /** @test */ - public function MyCowShouldEnabled() { - $this->assertContains(["code" => "MYCOW", - "label" => "MyCoW", - "enabled" => true, - "features" => ["SSO"], - ], - $this->_report['digital_connectors']); - } - /** @test */ public function PlanetNemoShouldEnabled() { $this->assertContains(["code" => "PLANETNEMO", @@ -373,7 +363,7 @@ class ZendAfi_View_Helper_Status_JsonTest extends ZendAfi_View_Helper_Status_Tes /** @test */ - public function CiteDeLaMusiqueShouldEnabled() { + public function CiteDeLaMusiqueShouldBeEnabled() { $this->assertContains(["code" => "CITEDELAMUSIQUE", "label" => "Cité de la musique", "enabled" => true, @@ -386,12 +376,12 @@ class ZendAfi_View_Helper_Status_JsonTest extends ZendAfi_View_Helper_Status_Tes /** @test */ - public function SoundCloudShouldDisabled() { + public function SoundCloudShouldDisabledButPresent() { $this->assertContains(["code" => "SoundCloud", "label" => "SoundCloud", "enabled" => false, "features" => ["HARVEST"], - "album_count" => 0 + "album_count" => 1 ], $this->_report['digital_connectors']); } diff --git a/tests/library/ZendAfi/View/Helper/Status/TestCase.php b/tests/library/ZendAfi/View/Helper/Status/TestCase.php index eb1f5ab1ce3289c10627afd7015c6ae01e6b6b5c..d9cd2d931d70efe9dc20cb8d418a1b4a4ee47b29 100644 --- a/tests/library/ZendAfi/View/Helper/Status/TestCase.php +++ b/tests/library/ZendAfi/View/Helper/Status/TestCase.php @@ -105,6 +105,10 @@ abstract class ZendAfi_View_Helper_Status_TestCase extends ViewHelperTestCase { protected function _setupDigitalResources() { RessourcesNumeriquesFixtures::activate(); + RessourcesNumeriquesFixtures::deactivateOrphea(); + $this->fixture('Class_Album', + ['id' => 1, + 'type_doc_id' => Class_TypeDoc::SOUNDCLOUD]); return $this; }