浏览代码

fix behavior tests

euromark 11 年之前
父节点
当前提交
5fc3544d73

+ 0 - 1
Model/Behavior/NumberFormatBehavior.php

@@ -69,7 +69,6 @@ class NumberFormatBehavior extends ModelBehavior {
 		if ($this->settings[$Model->alias]['localeconv'] || !empty($config['localeconv'])) {
 			// use locale settings
 			$conv = localeconv();
-			debug($conv);ob_flush();
 			$loc = array(
 				'decimals' => $conv['decimal_point'],
 				'thousands' => $conv['thousands_sep']

+ 6 - 1
Test/Case/Model/Behavior/DecimalInputBehaviorTest.php

@@ -11,6 +11,8 @@ class DecimalInputBehaviorTest extends MyCakeTestCase {
 	public function setUp() {
 		parent::setUp();
 
+		Configure::delete('Localization');
+
 		$this->Model = ClassRegistry::init('PaymentMethod');
 
 		$this->Model->Behaviors->load('Tools.DecimalInput', array('fields' => array('rel_rate', 'set_rate'), 'output' => true));
@@ -126,10 +128,13 @@ class DecimalInputBehaviorTest extends MyCakeTestCase {
 
 	public function testLocaleConv() {
 		$res = setlocale(LC_NUMERIC, 'de_DE.utf8', 'german');
-		$this->skipIf(empty($res));
+		$this->skipIf(empty($res), 'No valid locale found.');
 
 		$this->assertTrue(!empty($res));
 
+		$conv = localeconv();
+		$this->skipIf(empty($conv['thousands_sep']), 'No thousands separator in this locale.');
+
 		$this->Model->Behaviors->unload('DecimalInput');
 		$this->Model->Behaviors->load('Tools.DecimalInput', array('fields' => array('rel_rate', 'set_rate'), 'localeconv' => true, 'output' => true));
 

+ 5 - 2
Test/Case/Model/Behavior/NumberFormatBehaviorTest.php

@@ -146,10 +146,13 @@ class NumberFormatBehaviorTest extends MyCakeTestCase {
 	 */
 	public function testLocaleConv() {
 		$res = setlocale(LC_NUMERIC, 'de_DE.utf8', 'german');
-		$this->skipIf(empty($res));
-		debug($res);ob_flush();
+		$this->skipIf(empty($res), 'No valid locale found.');
+
 		$this->assertTrue(!empty($res));
 
+		$conv = localeconv();
+		$this->skipIf(empty($conv['thousands_sep']), 'No thousands separator in this locale.');
+
 		$this->Model->Behaviors->unload('NumberFormat');
 		$this->Model->Behaviors->load('Tools.NumberFormat', array('fields' => array('rel_rate', 'set_rate'), 'localeconv' => true, 'output' => true));