Skip to content
Snippets Groups Projects
Commit acb42de6 authored by Patrick Barroca's avatar Patrick Barroca
Browse files

rel #37078 : generation screen to cosmozend work in progress

parent 2c655b2d
Branches
Tags
10 merge requests!1587Master,!1553Master,!1519Master,!1502Master,!1501Stable,!1491Master,!1490Hotline master,!1472Stable,!1468Stable,!1462Hotline#37078 cosmogramme le lien de generation de site nanook ne cree pas les imports paniers
......@@ -203,16 +203,40 @@ abstract class Cosmo_IntegrationControllerGenerateActionTestCase extends CosmoCo
->with('../ftp/transfert/library1/etalon/sections.txt')
->answers(true)
->whenCalled('is_readable')
->with('../ftp/transfert/library1/etalon/emplacements.txt')
->answers(true)
->whenCalled('file')
->with('../ftp/transfert/library1/etalon/annexes.txt')
->answers(['BIB_SPS_UTT|ID_SITE|LIBELLE',
'20|library1',
'12|Caden'])
'12|library2'])
->whenCalled('file')
->with('../ftp/transfert/library1/etalon/sections.txt')
->answers(['BIB_C_SECTION|CODE|LIBELLE',
'1|Adulte',
'2|Jeunesse'])
->whenCalled('file')
->with('../ftp/transfert/library1/etalon/emplacements.txt')
->answers(['BIB_C_EMPLACEMENT|CODE|LIBELLE',
'4|Coin des tout-petits',
'5|Livres CD',
'6|Bacs imagiers',
'7|Albums'])
->beStrict();
Class_Cosmogramme_LandingDirectory::setFileSystem($file_system);
}
public function tearDown() {
Class_Log::getInstance()->reset();
parent::tearDown();
}
}
......@@ -274,7 +298,9 @@ class Cosmo_IntegrationControllerGenerateActionTest extends Cosmo_IntegrationCon
class Cosmo_IntegrationControllerGenerateActionPostTest extends Cosmo_IntegrationControllerGenerateActionTestCase {
class Cosmo_IntegrationControllerGenerateActionNanookPostTest
extends Cosmo_IntegrationControllerGenerateActionTestCase {
public function setUp() {
parent::setUp();
......@@ -288,14 +314,25 @@ class Cosmo_IntegrationControllerGenerateActionPostTest extends Cosmo_Integratio
'libelle' => 'Abonné Nanook',
'type_fichier' => 1]);
Class_Cosmogramme_Generator::setTimeSource($this->mock()
->whenCalled('time')->answers(strtotime('2016-01-28'))
->beStrict());
$this->postDispatch('cosmo/integration/generate',
['path_ftp' => 'library1',
'type_sigb' => 13,
'service_nanook' => 'http://nanook-ws.net/ilsdi/',
'creer_annexes' => 1,
'synchro' => 1]);
}
public function tearDown() {
Class_Cosmogramme_Generator::setTimeSource(null);
parent::tearDown();
}
/** @test */
public function shouldNotContainsForm() {
$this->assertNotXPath('//form');
......@@ -315,7 +352,165 @@ class Cosmo_IntegrationControllerGenerateActionPostTest extends Cosmo_Integratio
/** @test */
public function shouldCreateLibrary1() {
$this->assertNotNull(Class_Bib::findFirstBy(['id_site'=> 20]));
public function shouldHaveCreated2Libraries() {
$this->assertEquals(2, Class_Bib::count());
}
/** @test */
public function library1ShouldBeCreated() {
$this->assertNotNull(Class_Bib::findFirstBy(['id_site' => 20,
'libelle' => 'library1',
'ville' => 'library1',
'id_zone' => 1,
'visibilite' => Class_Bib::V_DATA]),
$this->_response->getBody());
}
/** @test */
public function library1IntegrationShouldBeCreated() {
$this->assertNotNull($bib = Class_IntBib::findFirstBy(['id_bib' => 20,
'nom' => 'library1',
'nom_court' => 'library1',
'qualite' => 5,
'sigb' => Class_IntBib::SIGB_NANOOK,
'planif_mode' => 'r',
'planif_jours' => '1111111',
'comm_sigb' => Class_IntBib::COM_NANOOK]),
$this->_response->getBody());
return $bib;
}
/**
* @test
* @depends library1IntegrationShouldBeCreated
*/
public function library1IntegrationCommParamsShouldContainsNanookWebservice($bib) {
$this->assertContains('http://nanook-ws.net/ilsdi/', $bib->getCommParams());
}
/** @test */
public function library1BranchShouldBeCreated() {
$this->assertNotNull(Class_CodifAnnexe::findFirstBy(['id_bib' => 20,
'code' => 20,
'libelle' => 'library1',
'invisible' => 0]),
$this->_response->getBody());
}
/** @test */
public function barCodeProfileShouldBeCreated() {
$this->assertNotNull($profile = Class_IntProfilDonnees::findFirstBy(['libelle' => 'Liste de codes-barres']));
return $profile;
}
/**
* @test
* @depends barCodeProfileShouldBeCreated
*/
public function library1ShouldHeveItemDeletionPlanned($profile) {
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => $profile->getId(),
'type_operation' => Class_IntMajAuto::OP_ITEMS_DELETION,
'nom_fichier' => '../ftp/transfert/library1/site20/suppressions.txt']));
}
/** @test */
public function library1ShouldHaveRecordsTotalPlanned() {
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 104,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => '../ftp/transfert/library1/site20/notices_total.txt']));
}
/** @test */
public function library1ShouldHaveRecordsPartialPlanned() {
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 104,
'type_operation' => Class_IntMajAuto::OP_PARTIAL_IMPORT,
'nom_fichier' => '../ftp/transfert/library1/site20/notices.txt']));
}
/** @test */
public function library1ShouldHaveUsersPlanned() {
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 105,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => '../ftp/transfert/library1/site20/abonnes.txt']));
}
/** @test */
public function library1ShouldHaveLoansPlanned() {
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 102,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => '../ftp/transfert/library1/site20/prets.txt']));
}
/** @test */
public function library1ShouldNotHaveHoldsPlanned() {
$this->assertNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => 103,
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => '../ftp/transfert/library1/site20/reservations.txt']));
}
/** @test */
public function basketsProfileShouldBeCreated() {
$profile = Class_IntProfilDonnees::findFirstBy(['accents' => Class_IntProfilDonnees::ENCODING_UTF8,
'type_fichier' => Class_IntProfilDonnees::FT_BASKETS,
'format' => Class_IntProfilDonnees::FORMAT_PIPED_ASCII]);
$this->assertNotNull($profile);
return $profile;
}
/**
* @test
* @depends basketsProfileShouldBeCreated
*/
public function library1ShouldHaveBasketsFullPlanned($profile) {
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => $profile->getId(),
'type_operation' => Class_IntMajAuto::OP_FULL_IMPORT,
'nom_fichier' => '../ftp/transfert/library1/site20/paniers_total.txt']));
}
/**
* @test
* @depends basketsProfileShouldBeCreated
*/
public function library1ShouldHaveBasketsPartialPlanned($profile) {
$this->assertNotNull(Class_IntMajAuto::findFirstBy(['id_bib' => 20,
'profil' => $profile->getId(),
'type_operation' => Class_IntMajAuto::OP_PARTIAL_IMPORT,
'nom_fichier' => '../ftp/transfert/library1/site20/paniers.txt']));
}
/** @test */
public function adulteSectionShouldBeCreated() {
$this->assertNotNull(Class_CodifSection::findFirstBy(['libelle' => 'Adulte',
'regles' => '995$9=1']));
}
/** @test */
public function coinLocationShouldBeCreated() {
$this->assertNotNull(Class_CodifEmplacement::findFirstBy(['libelle' => 'Coin des tout-petits',
'regles' => '995$6=4']));
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -30,7 +30,8 @@ class Class_Cosmogramme_LandingDirectory {
$_path,
$_required_files = ['libraries' => 'annexes.txt',
'kinds' => 'genres.txt',
'sections' => 'sections.txt'];
'sections' => 'sections.txt',
'locations' => 'emplacements.txt'];
public function __construct() {
......@@ -76,10 +77,15 @@ class Class_Cosmogramme_LandingDirectory {
}
protected function _getStandardDirPath($subdir) {
public function getSubdirPath($subdir) {
return $this->_path
. (DIRECTORY_SEPARATOR != substr($this->_path, -1) ? DIRECTORY_SEPARATOR : '')
. $subdir . DIRECTORY_SEPARATOR . static::STANDARD_NAME;
. $subdir;
}
protected function _getStandardDirPath($subdir) {
return $this->getSubdirPath($subdir) . DIRECTORY_SEPARATOR . static::STANDARD_NAME;
}
......@@ -94,6 +100,18 @@ class Class_Cosmogramme_LandingDirectory {
}
public function getSectionsOf($subdir) {
$file = $this->_getStandardFilePath($subdir, $this->_required_files['sections']);
return $this->getFileSystem()->file($file);
}
public function getLocationsOf($subdir) {
$file = $this->_getStandardFilePath($subdir, $this->_required_files['locations']);
return $this->getFileSystem()->file($file);
}
public function getSubdirectories() {
if (!$this->isValid())
return [];
......
......@@ -27,6 +27,7 @@ class Class_Log {
public function log($message) {
$this->_messages[] = $message;
return $this;
}
......@@ -38,4 +39,10 @@ class Class_Log {
public function getMessages() {
return $this->_messages;
}
public function reset() {
$this->_messages = [];
return $this;
}
}
\ No newline at end of file
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