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

Merge branch 'hotline_176130_serveurs_d_identites_migration' into 'master'

hotline 176130 fix fatal error in Class_Migration_AbonnementsUtilisateurs

See merge request !4692
parents 222139d6 d0a5049e
Branches
Tags
1 merge request!4692hotline 176130 fix fatal error in Class_Migration_AbonnementsUtilisateurs
Pipeline #21770 failed with stage
in 23 minutes and 16 seconds
- correctif #176130 : Serveurs d'idendités : correction de la migration des abonnements des utilisateurs.
\ No newline at end of file
<?php
//rerun
(new Class_Migration_AbonnementsUtilisateurs())->run();
$adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
......
......@@ -71,7 +71,7 @@ class Class_IntMajAuto extends Storm_Model_Abstract {
return array_key_exists($this->getTypeOperation(), $map)
? $map[$this->getTypeOperation()]
: '';
: '';
}
......@@ -136,12 +136,24 @@ class Class_IntMajAuto extends Storm_Model_Abstract {
public static function getPatronConfigurations() {
return array_unique((new Storm_Collection(Class_IntMajAuto::findAllBy([])))
->select( fn($maj_auto)
=> $maj_auto->getIntBib()->isNanook()
&& (Class_IntProfilDonnees::FT_PATRONS == $maj_auto->getProfilDonnees()->getTypeFichier())
)
->collect(fn($maj_auto) => $maj_auto->getProfilDonnees())
->getArrayCopy());
return
array_unique((new Storm_Collection(Class_IntMajAuto::findAll()))
->select( fn($maj_auto) => $maj_auto->_isPatronNanook())
->collect(fn($maj_auto) => $maj_auto->getProfilDonnees())
->getArrayCopy());
}
protected function _isPatronNanook() : bool {
if ( ! $library = $this->getIntBib())
return false;
if ( ! $library->isNanook())
return false;
if ( ! $profile = $this->getProfilDonnees())
return false;
return Class_IntProfilDonnees::FT_PATRONS == $profile->getTypeFichier();
}
}
......@@ -33,10 +33,6 @@ abstract class AbonnementsUtilisateursTestCase extends ModelTestCase {
->run();
}
public function tearDown(){
parent::tearDown();
}
protected function _setIntProfilDonnees() :void{
$this->_profil = clone($this->fixture(Class_IntProfilDonnees::class,
......@@ -227,3 +223,34 @@ class AbonnementsUtilisateursSingleNanookWithAbonnementsTest extends Abonnements
$this->_checkChampsValueWith($this->_string);
}
}
class AbonnementsUtilisateursMajAutoWithoutProfileTest extends ModelTestCase {
public function setUp(){
parent::setUp();
$params = ['url_serveur' => 'http://localhost:8080/afi_Nanook/ilsdi/',
'id_bib' => 5,
'type' => Class_IntBib::COM_NANOOK];
$this->fixture(Class_IntBib::class,
['id' => 5,
'sigb' => Class_IntBib::SIGB_NANOOK,
'comm_sigb' => Class_IntBib::COM_NANOOK,
'comm_params' => serialize($params)]);
$this->fixture(Class_IntMajAuto::class,
['id' => 4,
'id_bib' => 5,
'profil' => 4
]);
}
/** @test */
public function migrationShouldRunWithoutError() {
$this->assertNotNull((new Class_Migration_AbonnementsUtilisateurs)->run());
}
}
......@@ -22,9 +22,9 @@
require_once 'tests/fixtures/NanookFixtures.php';
abstract class IdentityProviderAuthenticationCasTestCase extends AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true,
$_provider;
protected $_provider;
public function setUp() {
parent::setUp();
......@@ -636,7 +636,8 @@ class IdentityProviderAuthenticationCasNetworkErrorTest
abstract class IdentityProviderAuthenticationCasBokehToBokehTestCase extends IdentityProviderAuthenticationCasTestCase {
abstract class IdentityProviderAuthenticationCasBokehToBokehTestCase
extends IdentityProviderAuthenticationCasTestCase {
public function setUp() {
......@@ -676,11 +677,20 @@ class IdentityProviderAuthenticationCasBokeh2BokehTest extends IdentityProviderA
public function setUp() {
parent::setUp();
Class_Users::setTimeSource(new TimeSourceForTest('2023-03-01'));
$time_source = new TimeSourceForTest('2023-03-01');
Class_Users::setTimeSource($time_source);
Class_User_ILSSubscription::setTimeSource($time_source);
$this->dispatch('/auth/login/provider/1?ticket=testticket');
}
public function tearDown() {
Class_Users::setTimeSource(null);
Class_User_ILSSubscription::setTimeSource(null);
parent::tearDown();
}
/** @test */
public function userShouldBeRemotelyLogged() {
$this->assertTrue($this->_provider->isRemotelyLogged());
......@@ -895,7 +905,8 @@ class IdentityProviderAuthenticationCasBokeh2BokehWithDuplicateIdentifierTest ex
class IdentityProviderAuthenticationCasBokeh2BokehWithAbonneSIGBLevelTest extends IdentityProviderAuthenticationCasBokehToBokehTestCase {
class IdentityProviderAuthenticationCasBokeh2BokehWithAbonneSIGBLevelTest
extends IdentityProviderAuthenticationCasBokehToBokehTestCase {
public function setUp() {
parent::setUp();
......@@ -904,7 +915,10 @@ class IdentityProviderAuthenticationCasBokeh2BokehWithAbonneSIGBLevelTest extend
'libelle' => 'Jolieville'
]);
Class_User_Log::setTimeSource(new TimeSourceForTest('2019-11-04 10:00:00'));
$time_source = new TimeSourceForTest('2019-11-04 10:00:00');
Class_User_Log::setTimeSource($time_source);
Class_User_ILSSubscription::setTimeSource($time_source);
Class_IdentityProvider::find(1)
->setConfigValue('default_id_bib',4)
->setConfigValue('role_level',ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB)
......@@ -913,6 +927,13 @@ class IdentityProviderAuthenticationCasBokeh2BokehWithAbonneSIGBLevelTest extend
}
public function tearDown() {
Class_User_ILSSubscription::setTimeSource(null);
Class_User_Log::setTimeSource(null);
parent::tearDown();
}
/** @test */
public function userShouldBeRemotelyLogged() {
$this->assertTrue($this->_provider->isRemotelyLogged());
......
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