Skip to content
Snippets Groups Projects
Commit 99711665 authored by Laurent's avatar Laurent
Browse files

hotline #55142 WIP new cosmo integration logs screen

parent 5c7b2b9d
Branches
Tags
2 merge requests!2334Master,!2133Hotline#55142 1 dtouch
Pipeline #1327 canceled with stage
in 4 minutes and 2 seconds
......@@ -21,7 +21,25 @@
class Cosmo_LogsController extends ZendAfi_Controller_Action {
use Trait_StormFileSystem;
public function indexAction() {
$this->view->titre = $this->_('Journal des intégrations');
}
public function integrationAction() {
$this->view->contents = $this->getFileSystem()->fileGetContents($this->_logPath('integration'));
}
public function debugAction() {
$this->view->contents = $this->getFileSystem()->fileGetContents($this->_logPath('debug'));
}
protected function _logPath($type) {
return Class_CosmoVar::getValueOf('log_path') . '/' . $type . '_' . $this->_getParam('day') . '.log';
}
}
?>
\ No newline at end of file
<div>
<?php
echo nl2br($this->contents);
?>
</div>
<?php
echo $this->cosmoLogs();
?>
<h1><?php echo $this->titre ?></h1>
<?php echo $this->cosmoLogs(); ?>
<div>
<?php
echo $this->contents;
?>
</div>
......@@ -14,7 +14,7 @@
</tr>
<?php foreach($this->runs as $run) { ?>
<tr>
<td align="center"><?php
<td align="center"><?php
echo $this->tagAnchor(
$this->url(['module' => 'cosmo',
'controller' => 'run-log',
......@@ -26,17 +26,17 @@
<td align="center" style="white-space:nowrap">
<?php echo $this->getHumanDate($run->getTraite(), 'EEEE d MMMM yyyy');?></td>
<td>(<?php echo $run->getBib()->getId();?>)&nbsp;<?php echo $run->getBib()->getNomCourt();?></td>
<td><?php
<td><?php
echo Class_CosmoVar::getLabelInList(
'type_fichier',
'type_fichier',
$run->getProfilDonnees()->getTypeFichier())?></td>
<td><?php
echo Class_CosmoVar::getLabelInList('import_type_operation',
<td><?php
echo Class_CosmoVar::getLabelInList('import_type_operation',
$run->getTypeOperation());?></td>
<td><?php echo $run->getFichier();?></td>
<td align="right" style="white-space:nowrap">
<?php echo number_format((int)$run->getFileSize()/1024, 0, '', ' ');?>&nbsp;ko
<?php if (0 < $run->getFileSize())
<?php if (0 < $run->getFileSize())
echo $this->tagAnchor(
$this->url(['module' => 'cosmo',
'controller' => 'run-log',
......@@ -53,8 +53,8 @@
<?php } ?>
</table>
<br>
<input type="button" class="bouton" value="Retour"
onclick="document.location.replace('<?php echo $this->cosmoPath->getCosmoBaseUrl(); ?>php/integre_log.php')" style="margin-left:20px">
<input type="button" class="bouton" value="Retour"
onclick="document.location.replace('<?php echo $this->url(['module' => 'cosmo', 'controller' => 'logs'], null, true); ?>')" style="margin-left:20px">
<br>
<br>
</div>
......@@ -20,8 +20,8 @@
*/
require 'application/modules/cosmo/controllers/LogsController.php';
class LogsControllerTest extends CosmoControllerTestCase {
abstract class LogsControllerTestCase extends CosmoControllerTestCase {
public function setUp() {
parent::setUp();
Class_CosmoVar::setValueOf('log_path','/log');
......@@ -41,7 +41,7 @@ class LogsControllerTest extends CosmoControllerTestCase {
->filePutContents('/log/a_file.log', "that should not be there");
ZendAfi_View_Helper_CosmoLogs::setFileSystem($filesystem);
Cosmo_LogsController::setFileSystem($filesystem);
$this->fixture('Class_Cosmogramme_Integration',
['id' => 1,
......@@ -58,7 +58,21 @@ class LogsControllerTest extends CosmoControllerTestCase {
'nb_erreurs' => 2,
'nb_warnings' => 1,
]);
}
public function tearDown() {
ZendAfi_View_Helper_CosmoLogs::setFileSystem(null);
Cosmo_LogsController::setFileSystem(null);
parent::tearDown();
}
}
class LogsControllerIndexTest extends LogsControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/cosmo/logs', true);
}
......@@ -131,6 +145,22 @@ class LogsControllerTest extends CosmoControllerTestCase {
public function secondTRWarningsShouldContains8() {
$this->assertXPath('//tr[2]/td[6][text()="8"]');
}
}
class LogsControllerDisplayIntegrationTest extends LogsControllerTestCase {
/** @test */
public function withValidIntegrationLogShouldDisplayFileContent() {
$this->dispatch('/cosmo/logs/integration/day/2017-05-12', true);
$this->assertXPathContentContains('//div', '[IntegrationTest] first line');
}
/** @test */
public function withValidDebugLogShouldDisplayFileContent() {
$this->dispatch('/cosmo/logs/debug/day/2017-05-13', true);
$this->assertXPathContentContains('//div', '[LogTest]');
}
}
?>
\ 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