From 4e89245f382a73b3fa7521f63e46450eea8354e0 Mon Sep 17 00:00:00 2001
From: Patrick Barroca <pbarroca@sandbox.pergame.net>
Date: Tue, 31 Mar 2015 19:29:37 +0200
Subject: [PATCH] rel #18297: fix locale setting in tests bootstrap

---
 library/ZendAfi/Form/Login.php           |  1 -
 tests/bootstrap.php                      |  2 +-
 tests/library/ZendAfi/Form/LoginTest.php | 13 ++++++++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/library/ZendAfi/Form/Login.php b/library/ZendAfi/Form/Login.php
index b39553fc476..072a9a837d3 100644
--- a/library/ZendAfi/Form/Login.php
+++ b/library/ZendAfi/Form/Login.php
@@ -24,7 +24,6 @@ class ZendAfi_Form_Login extends ZendAfi_Form {
 	protected $_data, $_redirect_url, $_id_notice,$_service;
 
 	public function init() {
-		xdebug_break();
 		parent::init();
 
 		$this->_redirect_url = $this->_data['redirect_url'];
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index ac7b0c611b5..6e794a0cfe8 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -78,9 +78,9 @@ $cfg->amber = new Zend_Config(array('deploy' => false));
 
 Zend_Registry::set('cfg', $cfg);
 $translate = Zend_Registry::get('translate');
-$translate->setLocale('fr');
 $translate->addTranslation(LANG_DIR.'ro.mo', 'ro');
 $translate->addTranslation(LANG_DIR.'en.mo', 'en');
+$translate->setLocale('fr');
 
 //Initialize the router for tests that do not rely on dispatch
 Zend_Controller_Front::getInstance()->getRouter()->route(new Zend_Controller_Request_Http('http://localhost/'));
diff --git a/tests/library/ZendAfi/Form/LoginTest.php b/tests/library/ZendAfi/Form/LoginTest.php
index 48eac3ecb98..05395fde556 100644
--- a/tests/library/ZendAfi/Form/LoginTest.php
+++ b/tests/library/ZendAfi/Form/LoginTest.php
@@ -20,15 +20,22 @@
  */
 
 
-abstract class ZendAfi_Form_LoginTestCase extends PHPUnit_Framework_TestCase {
+abstract class ZendAfi_Form_LoginTestCase extends Storm_Test_ModelTestCase {
 	protected $_form;
 
 	public function setUp() {
 		parent::setUp();
+		Storm_Model_Loader::defaultToVolatile();
 		$this->_form = ZendAfi_Form_Login::newWithOptions(['data' => $this->_getDatas()]);
 	}
 
 
+	public function tearDown() {
+		Storm_Model_Loader::defaultToDb();
+		parent::tearDown();
+	}
+
+
 	protected function _getDatas() {
 		return ['redirect_url' => '',
 						'id_notice' => '',
@@ -48,13 +55,13 @@ abstract class ZendAfi_Form_LoginTestCase extends PHPUnit_Framework_TestCase {
 class ZendAfi_Form_LoginRGAAWithEmptyDatasTest extends ZendAfi_Form_LoginTestCase {
 	/** @test */
 	public function usernameShouldHaveDefaultTitle() {
-		$this->assertEquals('Login', $this->_form->username->getAttrib('title'));
+		$this->assertEquals('Identifiant', $this->_form->username->getAttrib('title'));
 	}
 
 
 	/** @test */
 	public function passwordShouldHaveDefaultTitle() {
-		$this->assertEquals('Password', $this->_form->password->getAttrib('title'));
+		$this->assertEquals('Mot de passe', $this->_form->password->getAttrib('title'));
 	}
 }
 
-- 
GitLab