Skip to content
Snippets Groups Projects
Commit 4d7ddabb authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline : add missing records migration to toutapprendre plugin

parent fb74d3db
Branches
Tags
3 merge requests!2806Master,!2776Master,!2773Hotline
Pipeline #4738 canceled with stage
in 5 minutes
......@@ -32,7 +32,8 @@ abstract class Class_Migration_DigitalResource_Abstract {
->renameMenusKeys()
->upgradePermissions()
->renameBatches()
->upgradeAlbums();
->upgradeAlbums()
->upgradeRecords();
}
......@@ -140,6 +141,19 @@ abstract class Class_Migration_DigitalResource_Abstract {
}
protected function upgradeRecords() {
if (!$old_id = $this->_getOldDocTypeId())
return $this;
foreach(Class_Notice::findAllBy(['type_doc' => $old_id]) as $record)
$record
->setTypeDoc($this->_getConfig()->getDocType())
->save();
return $this;
}
protected function _getOldDocTypeId() {
return null;
}
......
......@@ -108,6 +108,10 @@ class Class_Migration_DigitialResource_ToutApprendreTest extends ModelTestCase {
'type_doc_id' => 108,
'titre' => 'update Me']);
$this->fixture('Class_Notice',
['id' => 654,
'type_doc' => 108]);
$this->_migration = (new Class_Migration_DigitalResource_ToutApprendre())
->setMemoryCleaner(function(){})
->run();
......@@ -126,6 +130,12 @@ class Class_Migration_DigitialResource_ToutApprendreTest extends ModelTestCase {
}
/** @test */
public function record654MeDocTypeShouldBeToutApprendre() {
$this->assertEquals('ToutApprendre', Class_Notice::find(654)->getTypeDoc());
}
/** @test */
public function adminVarToutApprendreSsoUrlShoudBeCreated() {
$this->assertEquals('http://biblio.toutapprendre.com/ws/wsUrl.aspx', Class_AdminVar::getValueOrDefault('ToutApprendre_SSO_URL'));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment