Skip to content
Snippets Groups Projects
Commit de7b9101 authored by Sebastien ANDRE's avatar Sebastien ANDRE
Browse files

Merge branch...

Merge branch 'hotline#184104_php_81_erreur_cosmogramme_mise_a_jour_des_cles_d_etageres' into 'master'

[RTok] hotline : #184104 : Error php 8.1 in shelf key

See merge request !4811
parents cb48afb6 e9461a6c
1 merge request!4811[RTok] hotline : #184104 : Error php 8.1 in shelf key
Pipeline #25085 passed with stage
in 24 minutes and 36 seconds
- correctif #184104 : PHP 8.1 : Erreur cosmogramme mise à jour des clés d'étagères
\ No newline at end of file
...@@ -43,10 +43,10 @@ class Class_Exemplaire_ShelfKey { ...@@ -43,10 +43,10 @@ class Class_Exemplaire_ShelfKey {
public function generateForArray(array $row) : string { public function generateForArray(array $row) : string {
$parts = $this->_coteKeyParts($row['cote']); $parts = $this->_coteKeyParts($row['cote'] ?? '');
$parts [] = $this->_padLeft($row['clef_chapeau'], $this->_subkey_len * 2); $parts [] = $this->_padLeft($row['clef_chapeau'] ?? '', $this->_subkey_len * 2);
$parts [] = $this->_padLeft($row['tome_alpha'], $this->_subkey_len); $parts [] = $this->_padLeft($row['tome_alpha'] ?? '', $this->_subkey_len);
$parts [] = $this->_padLeft($row['clef_alpha'], $this->_subkey_len * 2); $parts [] = $this->_padLeft($row['clef_alpha'] ?? '', $this->_subkey_len * 2);
$parts [] = str_pad(substr($row['id'], $parts [] = str_pad(substr($row['id'],
-$this->_subkey_len), -$this->_subkey_len),
$this->_subkey_len, $this->_subkey_len,
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
*/ */
abstract class PhaseItemsShelfKeyGenerationTestCase extends Class_Cosmogramme_Integration_PhaseTestCase { abstract class PhaseItemsShelfKeyGenerationTestCase
extends Class_Cosmogramme_Integration_PhaseTestCase {
protected bool $_build_result_to_update_done = false; protected bool $_build_result_to_update_done = false;
protected bool $_build_result_to_init_done = false; protected bool $_build_result_to_init_done = false;
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
...@@ -51,6 +51,10 @@ abstract class PhaseItemsShelfKeyGenerationTestCase extends Class_Cosmogramme_In ...@@ -51,6 +51,10 @@ abstract class PhaseItemsShelfKeyGenerationTestCase extends Class_Cosmogramme_In
->with('update exemplaires set shelf_key = (CASE WHEN (id = "1") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0001" WHEN (id = "2") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0002" WHEN (id = "3") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0003" ELSE shelf_key END), shelf_key_update_date = \'2022-06-01 03:07:10\' WHERE id in (1,2,3)') ->with('update exemplaires set shelf_key = (CASE WHEN (id = "1") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0001" WHEN (id = "2") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0002" WHEN (id = "3") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0003" ELSE shelf_key END), shelf_key_update_date = \'2022-06-01 03:07:10\' WHERE id in (1,2,3)')
->answers(true) ->answers(true)
->whenCalled('execute')
->with('update exemplaires set shelf_key = (CASE WHEN (id = "1") THEN "0000_0000_0000_0000_0000_0000_00000000_0000_00000000_0001" WHEN (id = "2") THEN "0000_0000_0000_0000_0000_0000_00000000_0000_00000000_0002" WHEN (id = "3") THEN "0000_0000_0000_0000_0000_0000_00000000_0000_00000000_0003" ELSE shelf_key END), shelf_key_update_date = \'2022-06-01 03:07:10\' WHERE id in (1,2,3)')
->answers(true)
->whenCalled('execute') ->whenCalled('execute')
->with('update exemplaires set shelf_key = (CASE WHEN (id = "1") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0001" WHEN (id = "2") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0002" ELSE shelf_key END), shelf_key_update_date = \'2022-06-01 03:07:10\' WHERE id in (1,2,3)') ->with('update exemplaires set shelf_key = (CASE WHEN (id = "1") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0001" WHEN (id = "2") THEN "0AMT_000R_0GER_0740_0001_0698_BOOK-OF-_BOOK_BOOK-OF-_0002" ELSE shelf_key END), shelf_key_update_date = \'2022-06-01 03:07:10\' WHERE id in (1,2,3)')
->answers(true); ->answers(true);
...@@ -105,7 +109,8 @@ abstract class PhaseItemsShelfKeyGenerationTestCase extends Class_Cosmogramme_In ...@@ -105,7 +109,8 @@ abstract class PhaseItemsShelfKeyGenerationTestCase extends Class_Cosmogramme_In
class PhaseItemsShelfKeyGenerationBadPreviousPhaseTest extends PhaseItemsShelfKeyGenerationTestCase { class PhaseItemsShelfKeyGenerationBadPreviousPhaseTest
extends PhaseItemsShelfKeyGenerationTestCase {
protected function _getPreviousPhase() { protected function _getPreviousPhase() {
return new Class_Cosmogramme_Integration_Phase(7); return new Class_Cosmogramme_Integration_Phase(7);
...@@ -161,7 +166,8 @@ class PhaseItemsShelfKeyGenerationRunTest extends PhaseItemsShelfKeyGenerationTe ...@@ -161,7 +166,8 @@ class PhaseItemsShelfKeyGenerationRunTest extends PhaseItemsShelfKeyGenerationTe
class PhaseItemsShelfKeyGenerationRunWithMysqlLoopTest extends PhaseItemsShelfKeyGenerationTestCase { class PhaseItemsShelfKeyGenerationRunWithMysqlLoopTest
extends PhaseItemsShelfKeyGenerationTestCase {
protected function _getPreviousPhase() { protected function _getPreviousPhase() {
return (new Class_Cosmogramme_Integration_Phase(7.3)) return (new Class_Cosmogramme_Integration_Phase(7.3))
...@@ -199,4 +205,39 @@ class PhaseItemsShelfKeyGenerationRunWithMysqlLoopTest extends PhaseItemsShelfKe ...@@ -199,4 +205,39 @@ class PhaseItemsShelfKeyGenerationRunWithMysqlLoopTest extends PhaseItemsShelfKe
', $this->_log_content); ', $this->_log_content);
} }
} }
\ No newline at end of file
/* hotline : https://forge.afi-sa.net/issues/184104 */
class PhaseItemsShelfKeyGenerationWithNullValueTest
extends PhaseItemsShelfKeyGenerationTestCase {
protected function _getPreviousPhase() {
return (new Class_Cosmogramme_Integration_Phase(7.3))
->beCron();
}
protected function _buildResult(int $count) : array {
$result = [];
for ($i = 1; $i <= $count ; $i++)
$result [] =
['id' => $i,
'id_notice' => $i,
'cote' => null,
'clef_chapeau' => null,
'tome_alpha' => null,
'clef_alpha' => null];
return $result;
}
/** @test */
public function phaseShouldBeSevenDotThree() {
$this->assertTrue($this->_phase->isId(7.3));
}
}
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