Skip to content
Snippets Groups Projects

Master

Merged Patrick Barroca requested to merge master into WIP
Compare and
+ 163
67
Preferences
Compare changes
Files
@@ -170,7 +170,7 @@ abstract class Cosmo_IntegrationControllerGenerateActionTestCase extends CosmoCo
$subdir_calls = 0;
$subdir_provider = function() use (&$subdir_calls) {
$subdir_calls++;
$mapping = [1 => '.', 2 => '..', 3 => 'library1', 4 => 'test'];
$mapping = [1 => '.', 2 => '..', 3 => 'library', 4 => 'test'];
return array_key_exists($subdir_calls, $mapping) ? $mapping[$subdir_calls] : false;
};
@@ -184,43 +184,43 @@ abstract class Cosmo_IntegrationControllerGenerateActionTestCase extends CosmoCo
->whenCalled('readdir')->with(true)
->willDo($subdir_provider)
->whenCalled('is_dir')->with('../ftp/transfert/library1')
->whenCalled('is_dir')->with('../ftp/transfert/library')
->answers(true)
->whenCalled('is_readable')
->with('../ftp/transfert/library1/etalon')
->with('../ftp/transfert/library/etalon')
->answers(true)
->whenCalled('is_readable')
->with('../ftp/transfert/library1/etalon/annexes.txt')
->with('../ftp/transfert/library/etalon/annexes.txt')
->answers(true)
->whenCalled('is_readable')
->with('../ftp/transfert/library1/etalon/genres.txt')
->with('../ftp/transfert/library/etalon/genres.txt')
->answers(true)
->whenCalled('is_readable')
->with('../ftp/transfert/library1/etalon/sections.txt')
->with('../ftp/transfert/library/etalon/sections.txt')
->answers(true)
->whenCalled('is_readable')
->with('../ftp/transfert/library1/etalon/emplacements.txt')
->with('../ftp/transfert/library/etalon/emplacements.txt')
->answers(true)
->whenCalled('file')
->with('../ftp/transfert/library1/etalon/annexes.txt')
->with('../ftp/transfert/library/etalon/annexes.txt')
->answers(['BIB_SPS_UTT|ID_SITE|LIBELLE',
'20|library1',
'12|library2'])
->whenCalled('file')
->with('../ftp/transfert/library1/etalon/sections.txt')
->with('../ftp/transfert/library/etalon/sections.txt')
->answers(['BIB_C_SECTION|CODE|LIBELLE',
'1|Adulte',
'2|Jeunesse'])
->whenCalled('file')
->with('../ftp/transfert/library1/etalon/emplacements.txt')
->with('../ftp/transfert/library/etalon/emplacements.txt')
->answers(['BIB_C_EMPLACEMENT|CODE|LIBELLE',
'4|Coin des tout-petits',
'5|Livres CD',
@@ -228,7 +228,7 @@ abstract class Cosmo_IntegrationControllerGenerateActionTestCase extends CosmoCo
'7|Albums'])
->whenCalled('file')
->with('../ftp/transfert/library1/etalon/genres.txt')
->with('../ftp/transfert/library/etalon/genres.txt')
->answers(['BIB_GENRES|SUPPORT|CODE|LIBELLE|DOC',
'0|1|Album|f',
'0|2|Bande dessinée|f',
@@ -269,7 +269,7 @@ class Cosmo_IntegrationControllerGenerateActionTest extends Cosmo_IntegrationCon
/** @test */
public function library1ShouldBeSelectable() {
$this->assertXPath('//select[@name="path_ftp"]//option[@value="library1"]');
$this->assertXPath('//select[@name="path_ftp"]//option[@value="library"]');
}
@@ -321,12 +321,14 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
'libelle' => 'Abonné Nanook',
'type_fichier' => 1]);
$this->_setupExistingDeletedBib();
$time_source = $this->mock()->whenCalled('time')->answers(strtotime('2016-01-28'));
Class_Cosmogramme_Generator::setTimeSource($time_source);
Class_Cosmogramme_Generator_AbstractTask::setTimeSource($time_source);
$this->postDispatch('cosmo/integration/generate',
['path_ftp' => 'library1',
['path_ftp' => 'library',
'type_sigb' => 13,
'service_nanook' => 'http://nanook-ws.net/ilsdi/',
'creer_annexes' => 1,
@@ -334,6 +336,26 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
}
protected function _setupExistingDeletedBib() {
$lib = $this->fixture('Class_IntBib',
['id_bib' => 6,
'nom' => 'Existing deleted',
'nom_court' => 'Deleted',
'qualite' => 5,
'sigb' => Class_IntBib::SIGB_NANOOK,
'planif_mode' => 'r',
'planif_jours' => '1111111',
'comm_sigb' => Class_IntBib::COM_NANOOK]);
$this->fixture('Class_IntMajAuto',
['id_bib' => 20,
'profil' => 103,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => 'library/site6/reservations.txt']);
}
public function tearDown() {
Class_Cosmogramme_Generator::setTimeSource(null);
Class_Cosmogramme_Generator_AbstractTask::setTimeSource(null);
@@ -366,10 +388,22 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
/** @test */
public function shouldHaveDisabledExistingDeletedLibrary() {
$this->assertTrue(Class_IntBib::find(6)->isDisconnected());
}
/** @test */
public function shouldHaveDeletedExistingDeletedPlannedIntegrations() {
$this->assertEmpty(Class_IntMajAuto::findAllBy(['id_bib' => 6]));
}
/** @test */
public function library1ShouldBeCreated() {
$this->assertNotNull(Class_Bib::findFirstBy(['id_site' => 20,
'libelle' => 'library1',
'ville' => 'library1',
'ville' => 'library',
'id_zone' => 1,
'visibilite' => Class_Bib::V_DATA]),
$this->_response->getBody());
@@ -426,7 +460,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
'rang' => 2001,
'profil' => $profile->getId(),
'type_operation' => Class_IntMajAuto::OP_ITEMS_DELETION,
'nom_fichier' => 'library1/site20/suppressions.txt']));
'nom_fichier' => 'library/site20/suppressions.txt']));
}
@@ -435,7 +469,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 104,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => 'library1/site20/notices_total.txt']));
'nom_fichier' => 'library/site20/notices_total.txt']));
}
@@ -444,7 +478,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 104,
'type_operation' => Class_IntMajAuto::OP_PARTIAL_IMPORT,
'nom_fichier' => 'library1/site20/notices.txt']));
'nom_fichier' => 'library/site20/notices.txt']));
}
@@ -453,7 +487,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 105,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => 'library1/site20/abonnes.txt']));
'nom_fichier' => 'library/site20/abonnes.txt']));
}
@@ -462,7 +496,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 102,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => 'library1/site20/prets.txt']));
'nom_fichier' => 'library/site20/prets.txt']));
}
@@ -471,7 +505,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
$this->assertNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 103,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => 'library1/site20/reservations.txt']));
'nom_fichier' => 'library/site20/reservations.txt']));
}
@@ -494,7 +528,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => $profile->getId(),
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => 'library1/site20/paniers_total.txt']));
'nom_fichier' => 'library/site20/paniers_total.txt']));
}
@@ -506,7 +540,7 @@ class Cosmo_IntegrationControllerGenerateActionNanookPostTest
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => $profile->getId(),
'type_operation' => Class_IntMajAuto::OP_PARTIAL_IMPORT,
'nom_fichier' => 'library1/site20/paniers.txt']));
'nom_fichier' => 'library/site20/paniers.txt']));
}