From 7193b9c44c604ded5ded6ead089ab0fdf28058b4 Mon Sep 17 00:00:00 2001
From: Alex Arnaud <alex.arnaud@biblibre.com>
Date: Thu, 4 Jun 2015 11:25:06 +0200
Subject: [PATCH] dev #17871 OAI - Remove useless message while importing via a
 browser

---
 library/Class/Cosmogramme/Integration/PhaseOnDataSource.php | 4 +++-
 .../Class/Cosmogramme/Integration/PhaseNoticeOAITest.php    | 6 ++++++
 .../library/Class/Cosmogramme/Integration/PhaseTestCase.php | 5 +++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/library/Class/Cosmogramme/Integration/PhaseOnDataSource.php b/library/Class/Cosmogramme/Integration/PhaseOnDataSource.php
index a9628847abf..767937eb404 100644
--- a/library/Class/Cosmogramme/Integration/PhaseOnDataSource.php
+++ b/library/Class/Cosmogramme/Integration/PhaseOnDataSource.php
@@ -39,7 +39,9 @@ abstract class Class_Cosmogramme_Integration_PhaseOnDataSource extends Class_Cos
 		$msg = ($processed > 0) ?
 			$processed . ' fichier(s) traité(s).' :
 			'aucun fichier traité';
-		$this->_log->ecrire('<br><span class="violet">' . $msg . '</span><br>');
+
+		if (!$this->isTimeOut())
+			$this->_log->ecrire('<br><span class="violet">' . $msg . '</span><br>');
 	}
 
 
diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseNoticeOAITest.php b/tests/library/Class/Cosmogramme/Integration/PhaseNoticeOAITest.php
index 7f6ebd6abff..995d949e361 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhaseNoticeOAITest.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhaseNoticeOAITest.php
@@ -108,6 +108,12 @@ class PhaseNoticeOAITest extends PhaseNoticeOAITestCase {
 	public function oldItemShouldHaveBeenDeleted() {
 		$this->assertEmpty(Class_Notice::find(1)->getExemplaires());
 	}
+
+
+	/** @test */
+	public function logShouldNotContainsAucunFichier() {
+		$this->assertNotLogContains('aucun fichier traité');
+	}
 }
 
 
diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseTestCase.php b/tests/library/Class/Cosmogramme/Integration/PhaseTestCase.php
index 02605b42731..a55d980fffe 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhaseTestCase.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhaseTestCase.php
@@ -76,6 +76,11 @@ abstract class Class_Cosmogramme_Integration_PhaseTestCase extends ModelTestCase
 		$this->assertContains($value, $this->_log_content);
 	}
 
+
+	protected function assertNotLogContains($value) {
+		$this->assertNotContains($value, $this->_log_content);
+	}
+
 	protected function _getPreviousPhase() {
 		return null;
 	}
-- 
GitLab