Skip to content

Commit

Permalink
[TESTS] backport r21179 to trunk
Browse files Browse the repository at this point in the history
git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21180 44c647ce-9c0f-0410-b52a-842ac1e357ba
  • Loading branch information
matthew committed Feb 23, 2010
1 parent a72d2dc commit 5bd148b
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
15 changes: 11 additions & 4 deletions library/Zend/Locale/Math.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public static function isBcmathDisabled()
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));
}
}
Expand Down Expand Up @@ -118,8 +118,14 @@ public static function round($op1, $precision = 0)
$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) {
Expand Down Expand Up @@ -341,8 +347,9 @@ public static function Comp($op1, $op2, $scale = null)
}
}

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();
}
7 changes: 3 additions & 4 deletions library/Zend/Measure/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,14 @@ public function setType($type)
if (empty($this->_type)) {
$this->_type = $type;
} else {

// Convert to standard value
$value = $this->_value;
if (is_array($this->_units[$this->getType()][0])) {
foreach ($this->_units[$this->getType()][0] as $key => $found) {
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 "+":
Expand Down Expand Up @@ -278,13 +277,13 @@ public function setType($type)
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);
Expand Down
3 changes: 3 additions & 0 deletions tests/Zend/Auth/Adapter/Ldap/OfflineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public function setUp()

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());
}
Expand Down
3 changes: 3 additions & 0 deletions tests/Zend/Ldap/OfflineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
7 changes: 2 additions & 5 deletions tests/Zend/Measure/EnergyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@
* @version $Id$
*/

require_once dirname(__FILE__) . '/../../TestHelper.php';

/**
* Zend_Measure_Energy
*/
require_once 'Zend/Measure/Energy.php';

/**
* PHPUnit test case
*/
require_once 'PHPUnit/Framework/TestCase.php';

/**
* @category Zend
* @package Zend_Measure
Expand Down Expand Up @@ -322,6 +318,7 @@ public function testEnergySetType()
/**
* test setting computed type
* expected new type
* @group foo
*/
public function testEnergySetComputedType1()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Zend/View/Helper/PartialTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function testObjectModelSetInObjectKeyWhenKeyPresent()

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'");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?>

Expand Down

0 comments on commit 5bd148b

Please sign in to comment.