From 2e032f037e33225e47775674308429dabad9327e Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@git-test.afi-sa.fr>
Date: Fri, 10 Jan 2014 11:31:58 +0000
Subject: [PATCH] =?UTF-8?q?Test=20abonne=20pass=C3=A9=20en=20volatile?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../php/classes/AbonneIntegrationTest.php     | 47 ++++++++++++-------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/cosmogramme/tests/php/classes/AbonneIntegrationTest.php b/cosmogramme/tests/php/classes/AbonneIntegrationTest.php
index eb46b3cc033..d5f3c9e1c0d 100644
--- a/cosmogramme/tests/php/classes/AbonneIntegrationTest.php
+++ b/cosmogramme/tests/php/classes/AbonneIntegrationTest.php
@@ -101,22 +101,29 @@ class AbonneIntegrationASCIIWithNoUsersInDbTest extends AbonneIntegrationASCIITe
 
 
 
-class AbonneIntegrationASCIIWithRoutoInDbTest extends AbonneIntegrationASCIITestCase {
+class AbonneIntegrationASCIIWithRoutoInDbTest extends AbonneIntegrationTestCase {
 	protected $user_routo;
 	protected $routo_after_import;
 
 	public function setup(){
 		parent::setup();
-		$this->user_routo = Class_Users::newInstanceWithId(5,['nom'=>'Routo',
-																													'prenom'=>'Pierre',
-																													'login'=>'routop',
-																													'password'=>'old']);
-				
-		Class_Users::whenCalled('findFirstBy')
-			->with(['login' => '5  5',
-							'id_site'=> 2])
-			->answers($this->user_routo);
 
+		$this->abon_config->setChamps(['IDABON',
+																	 'ID_SIGB',
+																	 'NOM',
+																	 'PRENOM',
+																	 'PASSWORD',
+																	 'MAIL']);
+
+		$this->user_routo = $this->fixture('Class_Users',
+																			 ['id' => 5,
+																				'nom'=>'Routo',
+																				'prenom'=>'Pierre',
+																				'login'=>'5  5',
+																				'id_site' => 2,
+																				'pseudo' => 'riri',
+																				'password'=>'old']);
+				
 		$champs_sigb_ascii = implode(chr(9), ['5  5',
 																					'12',
 																					'Routo',
@@ -124,20 +131,26 @@ class AbonneIntegrationASCIIWithRoutoInDbTest extends AbonneIntegrationASCIITest
 																					'la',
 																					'rp@afi-sa.fr']);
 
+
 		$this->abon_config->importFicheAscii($champs_sigb_ascii);	
 
-		$this->routo_after_import = Class_Users::getFirstAttributeForLastCallOn('save');
+		$this->users = Class_Users::findAllBy(['login' => '5  5']);
+	}
+
+
+	/** @test */
+	public function onlyOneUserShouldHaveLogin55() {
+		$this->assertEquals(1, count($this->users));
 	}
 
 	/** @test **/
 	public function withRoutoInDbImportShouldUpdateRoutoWithIdabon55() {
-		$this->assertEquals('5  5',$this->routo_after_import->getIdabon());
+		$this->assertEquals('5  5',$this->users[0]->getIdabon());
 	}
-	
-	
-	/** @test  **/
-	public function routoInDbAndRoutoAfterImportShouldBeTheSame() {
-		$this->assertSame($this->user_routo, $this->routo_after_import);
+
+	/** @test **/
+	public function pseudoShouldBeRiri() {
+		$this->assertEquals('riri',$this->users[0]->getPseudo());
 	}
 }
 
-- 
GitLab