From 0fb8426deb74d3e0734c2f0abdbcd28f27926d6e Mon Sep 17 00:00:00 2001 From: thomas Date: Fri, 4 Jun 2010 14:49:59 +0000 Subject: [PATCH] [ZF-9941] Zend_Currency: - allow to give value as option git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22368 44c647ce-9c0f-0410-b52a-842ac1e357ba --- library/Zend/Currency.php | 2 +- tests/Zend/CurrencyTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/library/Zend/Currency.php b/library/Zend/Currency.php index 9ecd9ece8..5fba0bab6 100644 --- a/library/Zend/Currency.php +++ b/library/Zend/Currency.php @@ -137,7 +137,7 @@ class Zend_Currency public function toCurrency($value = null, array $options = array()) { if ($value === null) { - if (is_array($value) && isset($options['value'])) { + if (is_array($options) && isset($options['value'])) { $value = $options['value']; } else { $value = $this->_options['value']; diff --git a/tests/Zend/CurrencyTest.php b/tests/Zend/CurrencyTest.php index 57f4379d4..a32cb7335 100644 --- a/tests/Zend/CurrencyTest.php +++ b/tests/Zend/CurrencyTest.php @@ -816,4 +816,13 @@ class Zend_CurrencyTest extends PHPUnit_Framework_TestCase $this->assertEquals(50, $currency->getValue()); $this->assertEquals('RUB', $currency->getShortName()); } + + /** + * @ZF-9941 + */ + public function testSetValueByOutput() + { + $currency = new Zend_Currency(array('value' => 1000, 'locale' => 'de_AT')); + $this->assertEquals('€ 2.000,00', $currency->toCurrency(null, array('value' => 2000))); + } } -- 2.11.4.GIT