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

rel #28103 : reset http auth between batch runs

parent 0a37ce56
Branches
Tags
4 merge requests!1267Master,!1221Master,!1220Hotline master,!1205Hotline#28103 les vignettes d album 1dtouch ne s affichent pas
- ticket #28103 : Correction de l'exécution des batchs qui empêchait le moissonage des vignettes d'album 1dtouch
\ No newline at end of file
......@@ -38,15 +38,25 @@ class Class_Cosmogramme_Integration_PhaseBatchs
return;
}
$batchs = Class_Batch::findAllBy(['order' => 'id']);
foreach($batchs as $batch) {
foreach(Class_Batch::findAllBy(['order' => 'id']) as $batch) {
if ($this->_getData('pointeur_reprise') > $batch->getId())
continue;
$this->_runOne($batch);
$this->_resetHttpClient()
->_runOne($batch);
}
}
protected function _resetHttpClient() {
if (!$client = Zend_Registry::get('httpClient'))
return $this;
$client->setAuth(null);
return $this;
}
protected function _runOne($batch) {
$this->_log->ecrire('<span class="vert">' . $batch->getLibelle().':');
$this->_setData('pointeur_reprise', $batch->getId());
......
......@@ -21,7 +21,7 @@
abstract class PhaseBatchsTestCase extends Class_Cosmogramme_Integration_PhaseTestCase {
protected $_batch;
protected $_batch, $_registry_http_client, $_mock_http_client;
protected function _prepareFixtures() {
$this->fixture('Class_Batch',
......@@ -41,8 +41,20 @@ abstract class PhaseBatchsTestCase extends Class_Cosmogramme_Integration_PhaseTe
public function setUp() {
parent::setUp();
$this->_registry_http_client = Zend_Registry::get('httpClient');
$this->_mock_http_client = $this->mock();
$this->_mock_http_client->whenCalled('setAuth')->answers($this->_mock_http_client);
Zend_Registry::set('httpClient', $this->_mock_http_client);
$this->_buildPhase('Batchs')->run();
}
public function tearDown() {
Zend_Registry::set('httpClient', $this->_registry_http_client);
parent::tearDown();
}
}
......@@ -102,6 +114,16 @@ class PhaseBatchsCronRunTest extends PhaseBatchsTestCase {
public function shouldDisplayElapsedTime() {
$this->assertLogContains('Temps de traitement');
}
/**
* @test
* @see http://forge.afi-sa.fr/issues/28103
*/
public function httpAuthShouldHaveBeenReset() {
$this->assertTrue($this->_mock_http_client
->methodHasBeenCalled('setAuth'));
}
}
......
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