diff --git a/VERSIONS_HOTLINE/51096 b/VERSIONS_HOTLINE/51096 new file mode 100644 index 0000000000000000000000000000000000000000..eef6b4cd26b1746616807618aa542247cbb6f568 --- /dev/null +++ b/VERSIONS_HOTLINE/51096 @@ -0,0 +1 @@ + - ticket #51096 : désactivation du moissonnage total de Jamendo (trop de notices). L'import manuel d'album reste activé. \ No newline at end of file diff --git a/library/Class/Batch/Jamendo.php b/library/Class/Batch/Jamendo.php index 68148377f6d6b94a79737c9deba412242cc41b00..dd10330ecfc99979829a17b27695bfa9878f14c6 100644 --- a/library/Class/Batch/Jamendo.php +++ b/library/Class/Batch/Jamendo.php @@ -26,5 +26,10 @@ class Class_Batch_Jamendo extends Class_Batch_RessourceNumerique{ protected function _getService() { return new Class_WebService_BibNumerique_Jamendo(); } + + + public function isEnabled() { + return false; + } } ?> diff --git a/library/Class/Batch/RessourceNumerique.php b/library/Class/Batch/RessourceNumerique.php index 1aaee65218a8aa10b732379c9e47d207c339460c..79f8d55e20c23a5cb51f859e54bfcc9e7509ebfb 100644 --- a/library/Class/Batch/RessourceNumerique.php +++ b/library/Class/Batch/RessourceNumerique.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -29,7 +29,10 @@ abstract class Class_Batch_RessourceNumerique extends Class_Batch_Abstract { } public function run() { - return $this->_getService()->harvest(); + if ($this->isEnabled()) + $this->_getService()->harvest(); + + return $this; } public function isEnabled() { diff --git a/tests/library/Class/BatchTest.php b/tests/library/Class/BatchTest.php index 441ec8782d307801bfecf15a09135aeadd6f8a56..478d2941a0b876743aa08eb911df33146ea30865 100644 --- a/tests/library/Class/BatchTest.php +++ b/tests/library/Class/BatchTest.php @@ -121,27 +121,6 @@ class BatchLoaderWithoutRessourcesNumeriquesTest extends Storm_Test_ModelTestCas -class BatchLoaderWithRessourcesNumeriquesTest extends Storm_Test_ModelTestCase { - protected $_types; - - public function setUp() { - parent::setUp(); - - Class_Batch::beVolatile(); - Class_AdminVar::beVolatile(); - RessourcesNumeriquesFixtures::activate(); - $this->_types = Class_Batch::getAvailableType(); - } - - /** @test */ - public function ressourcesNumeriquesShouldBeAvailable() { - foreach(array_keys(Class_Batch::getRessourcesNumeriqueTypes()) as $type) - $this->assertTrue(in_array($type, array_keys($this->_types)), $type); - } -} - - - class BatchIndexRessourcesNumeriquesTest extends Storm_Test_ModelTestCase { public function setUp() { $album = $this->fixture('Class_Album', ['id' => 1, diff --git a/tests/scenarios/Jamendo/JamendoTest.php b/tests/scenarios/Jamendo/JamendoTest.php index 072db59dc8a2fce66e115817aec46082a766a401..6a82ec26f6c27b51111fdc77d60b7e48254f1c3d 100644 --- a/tests/scenarios/Jamendo/JamendoTest.php +++ b/tests/scenarios/Jamendo/JamendoTest.php @@ -62,6 +62,24 @@ abstract class JamendoTestCase extends ModelTestCase { +class JamendoBatchTest extends JamendoTestCase { + /** + * @see http://forge.afi-sa.fr/issues/51096 + * @test + */ + public function jamendoBatchShouldBeDisabled() { + $this->assertFalse((new Class_Batch_Jamendo())->isEnabled()); + } + + + /** @test */ + public function runBatchShouldNotHarvestJamendo() { + (new Class_Batch_Jamendo())->run(); + $this->assertCount(0, Class_Album::findAll()); + } +} + + class JamendoImportTracksFromUrlTest extends JamendoTestCase { public function setUp() {