diff --git a/lib/classes/databox/subdef.php b/lib/classes/databox/subdef.php index 65cd81e0f4..c3b8bca719 100644 --- a/lib/classes/databox/subdef.php +++ b/lib/classes/databox/subdef.php @@ -309,7 +309,7 @@ class databox_subdef /** * @return bool */ - public function is_downloadable() + public function isDownloadable() { return $this->downloadable; } diff --git a/lib/classes/patch/370alpha6a.php b/lib/classes/patch/370alpha6a.php index 7f3472c260..7219d0d12b 100644 --- a/lib/classes/patch/370alpha6a.php +++ b/lib/classes/patch/370alpha6a.php @@ -108,7 +108,7 @@ class patch_370alpha6a extends patchAbstract $options['meta'] = $subdef->isMetadataUpdateRequired() ? 'yes' : 'no'; $options['devices'] = [databox_subdef::DEVICE_SCREEN]; - $root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->is_downloadable(), $options, []); + $root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->isDownloadable(), $options, []); } protected function addMobileSubdefVideo($root, $baseSubdef, $groupname) diff --git a/lib/classes/record/exportElement.php b/lib/classes/record/exportElement.php index fe225f145d..62ac7ab0a8 100644 --- a/lib/classes/record/exportElement.php +++ b/lib/classes/record/exportElement.php @@ -85,11 +85,10 @@ class record_exportElement extends record_adapter $sbas_id = phrasea::sbasFromBas($this->app, $this->get_base_id()); - $subdefgroups = $this->app->findDataboxById($sbas_id)->get_subdef_structure(); - + /** @var databox_subdef[] $subdefs */ $subdefs = []; - foreach ($subdefgroups as $subdef_type => $subdefs_obj) { + foreach ($this->app->findDataboxById($sbas_id)->get_subdef_structure() as $subdef_type => $subdefs_obj) { if ($subdef_type == $this->get_type()) { $subdefs = $subdefs_obj; break; @@ -173,7 +172,7 @@ class record_exportElement extends record_adapter $downloadable[$name] = false; - $downloadable_settings = $subdef->is_downloadable(); + $downloadable_settings = $subdef->isDownloadable(); if (! $downloadable_settings || $go_dl[$class] === false) { continue; diff --git a/templates/web/admin/subdefs.html.twig b/templates/web/admin/subdefs.html.twig index 5172612eee..c7c63258bd 100644 --- a/templates/web/admin/subdefs.html.twig +++ b/templates/web/admin/subdefs.html.twig @@ -227,7 +227,7 @@ {% endfor %} {{ 'Telechargeable' | trans }} - + diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php index 7c8c1572e5..2aced1154a 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php @@ -94,8 +94,7 @@ class SubdefsTest extends \PhraseanetAuthenticatedWebTestCase $subdefs = new \databox_subdefsStructure($app->findDataboxById($this->databox_id), $app['translator']); $subdef = $subdefs->get_subdef("image", $name); - /* @var $subdef \databox_subdef */ - $this->assertFalse($subdef->is_downloadable()); + $this->assertFalse($subdef->isDownloadable()); $options = $subdef->getOptions(); diff --git a/tests/classes/databox/subdefTest.php b/tests/classes/databox/subdefTest.php index 0a9da63026..2db6d8c234 100644 --- a/tests/classes/databox/subdefTest.php +++ b/tests/classes/databox/subdefTest.php @@ -1,27 +1,7 @@ @@ -52,7 +32,7 @@ class databox_subdefTest extends \PhraseanetTestCase $this->assertArrayHasKey('en', $labels); $this->assertEquals('Preview', $labels['en']); - $this->assertTrue($object->is_downloadable()); + $this->assertTrue($object->isDownloadable()); $this->assertTrue(is_array($object->getAvailableSubdefTypes())); $this->assertTrue(count($object->getAvailableSubdefTypes()) > 0); @@ -73,21 +53,6 @@ class databox_subdefTest extends \PhraseanetTestCase } } - /** - * @covers databox_subdef::__construct - * @covers databox_subdef::get_class - * @covers databox_subdef::get_name - * @covers databox_subdef::isMetadataUpdateRequired - * @covers databox_subdef::getAvailableSubdefTypes - * @covers databox_subdef::is_downloadable - * @covers databox_subdef::get_labels - * @covers databox_subdef::getSubdefGroup - * @covers databox_subdef::getSubdefType - * @covers databox_subdef::get_path - * @covers databox_subdef::getSpecs - * @covers databox_subdef::getOptions - * @covers databox_subdef::buildVideoSubdef - */ public function testVideo() { $xml = ' @@ -118,7 +83,7 @@ class databox_subdefTest extends \PhraseanetTestCase $this->assertTrue(is_array($labels)); $this->assertEquals(0, count($labels)); - $this->assertFalse($object->is_downloadable()); + $this->assertFalse($object->isDownloadable()); $this->assertTrue(is_array($object->getAvailableSubdefTypes())); $this->assertTrue(count($object->getAvailableSubdefTypes()) > 0); @@ -139,12 +104,6 @@ class databox_subdefTest extends \PhraseanetTestCase } } - /** - * @covers databox_subdef::__construct - * @covers databox_subdef::getSpecs - * @covers databox_subdef::getOptions - * @covers databox_subdef::buildGifSubdef - */ public function testGif() { $xml = ' @@ -170,12 +129,6 @@ class databox_subdefTest extends \PhraseanetTestCase } } - /** - * @covers databox_subdef::__construct - * @covers databox_subdef::getSpecs - * @covers databox_subdef::getOptions - * @covers databox_subdef::buildAudioSubdef - */ public function testAudio() { $xml = ' @@ -197,12 +150,6 @@ class databox_subdefTest extends \PhraseanetTestCase } } - /** - * @covers databox_subdef::__construct - * @covers databox_subdef::getSpecs - * @covers databox_subdef::getOptions - * @covers databox_subdef::buildFlexPaperSubdef - */ public function testFlexPaper() { $xml = ' @@ -226,11 +173,9 @@ class databox_subdefTest extends \PhraseanetTestCase /** * @dataProvider getVariouasTypeAndSubdefs - * @covers databox_subdef::getAvailableSubdefTypes */ public function testGetAvailableSubdefTypes($object) { - foreach ($object->getAvailableSubdefTypes() as $type) { $this->assertInstanceOf('\\Alchemy\\Phrasea\\Media\\Subdef\\Subdef', $type); }