Просмотр исходного кода

[TESTS] backport r21179 to trunk

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21180 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 лет назад
Родитель
Сommit
5bd148b92c

+ 11 - 4
library/Zend/Locale/Math.php

@@ -65,8 +65,8 @@ class Zend_Locale_Math
     public static function round($op1, $precision = 0)
     {
         if (self::$_bcmathDisabled) {
-            $return = round($op1, $precision);
-            if (strpos((string) $return, 'E') === false) {
+            $op1 = round($op1, $precision);
+            if (strpos((string) $op1, 'E') === false) {
                 return self::normalize(round($op1, $precision));
             }
         }
@@ -118,8 +118,14 @@ class Zend_Locale_Math
             $roundUp[$roundPos + $decPos] = '1';
 
             if ($op1 > 0) {
+                if (self::$_bcmathDisabled) {
+                    return Zend_Locale_Math_PhpMath::Add($op1, $roundUp, $precision);
+                }
                 return self::Add($op1, $roundUp, $precision);
             } else {
+                if (self::$_bcmathDisabled) {
+                    return Zend_Locale_Math_PhpMath::Sub($op1, $roundUp, $precision);
+                }
                 return self::Sub($op1, $roundUp, $precision);
             }
         } elseif ($precision >= 0) {
@@ -341,8 +347,9 @@ class Zend_Locale_Math
     }
 }
 
-if ((defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') && !TESTS_ZEND_LOCALE_BCMATH_ENABLED)
-    || !extension_loaded('bcmath')) {
+if (!extension_loaded('bcmath')
+    || (defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') && !TESTS_ZEND_LOCALE_BCMATH_ENABLED)
+) {
     require_once 'Zend/Locale/Math/PhpMath.php';
     Zend_Locale_Math_PhpMath::disable();
 }

+ 3 - 4
library/Zend/Measure/Abstract.php

@@ -237,7 +237,6 @@ abstract class Zend_Measure_Abstract
         if (empty($this->_type)) {
             $this->_type = $type;
         } else {
-
             // Convert to standard value
             $value = $this->_value;
             if (is_array($this->_units[$this->getType()][0])) {
@@ -245,7 +244,7 @@ abstract class Zend_Measure_Abstract
                     switch ($key) {
                         case "/":
                             if ($found != 0) {
-                                $value = @call_user_func(Zend_Locale_Math::$div, $value, $found, 25);
+                                $value = call_user_func(Zend_Locale_Math::$div, $value, $found, 25);
                             }
                             break;
                         case "+":
@@ -278,13 +277,13 @@ abstract class Zend_Measure_Abstract
                             break;
                         default:
                             if ($found != 0) {
-                                $value = @call_user_func(Zend_Locale_Math::$div, $value, $found, 25);
+                                $value = call_user_func(Zend_Locale_Math::$div, $value, $found, 25);
                             }
                             break;
                     }
                 }
             } else {
-                $value = @call_user_func(Zend_Locale_Math::$div, $value, $this->_units[$type][0], 25);
+                $value = call_user_func(Zend_Locale_Math::$div, $value, $this->_units[$type][0], 25);
             }
 
             $slength = strlen($value);

+ 3 - 0
tests/Zend/Auth/Adapter/Ldap/OfflineTest.php

@@ -67,6 +67,9 @@ class Zend_Auth_Adapter_Ldap_OfflineTest extends PHPUnit_Framework_TestCase
 
     public function testGetSetLdap()
     {
+        if (!extension_loaded('ldap')) {
+            $this->markTestSkipped('LDAP is not enabled');
+        }
         $this->_adapter->setLdap(new Zend_Ldap());
         $this->assertType('Zend_Ldap', $this->_adapter->getLdap());
     }

+ 3 - 0
tests/Zend/Ldap/OfflineTest.php

@@ -62,6 +62,9 @@ class Zend_Ldap_OfflineTest extends PHPUnit_Framework_TestCase
      */
     public function setUp()
     {
+        if (!extension_loaded('ldap')) {
+            $this->markTestSkipped('LDAP is not enabled');
+        }
         $this->_ldap = new Zend_Ldap();
     }
 

+ 2 - 5
tests/Zend/Measure/EnergyTest.php

@@ -20,6 +20,7 @@
  * @version    $Id$
  */
 
+require_once dirname(__FILE__) . '/../../TestHelper.php';
 
 /**
  * Zend_Measure_Energy
@@ -27,11 +28,6 @@
 require_once 'Zend/Measure/Energy.php';
 
 /**
- * PHPUnit test case
- */
-require_once 'PHPUnit/Framework/TestCase.php';
-
-/**
  * @category   Zend
  * @package    Zend_Measure
  * @subpackage UnitTests
@@ -322,6 +318,7 @@ class Zend_Measure_EnergyTest extends PHPUnit_Framework_TestCase
     /**
      * test setting computed type
      * expected new type
+     * @group foo
      */
     public function testEnergySetComputedType1()
     {

+ 1 - 1
tests/Zend/View/Helper/PartialTest.php

@@ -247,7 +247,7 @@ class Zend_View_Helper_PartialTest extends PHPUnit_Framework_TestCase
 
         foreach (get_object_vars($model) as $key => $value) {
             $string = sprintf('%s: %s', $key, $value);
-            $this->assertContains($string, $return);
+            $this->assertContains($string, $return, "Checking for '$return' containing '$string'");
         }
     }
 

+ 1 - 1
tests/Zend/View/Helper/_files/modules/default/views/scripts/partialObj.phtml

@@ -3,7 +3,7 @@ No object model passed
 <?php else: 
     $vars = get_object_vars($this->foo);
     foreach ($vars as $key => $value): ?>
-<?php echo $key ?>: <?= $value ?>
+<?php echo $key ?>: <?php echo $value ?>
 <?php endforeach;
 endif ?>