Bläddra i källkod

[ZF-10751] Zend_Currency

- Fixed the typo variable undefined.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23493 44c647ce-9c0f-0410-b52a-842ac1e357ba
ramon 15 år sedan
förälder
incheckning
a2c7250276
3 ändrade filer med 22 tillägg och 1 borttagningar
  1. 1 1
      library/Zend/Currency.php
  2. 11 0
      tests/Zend/Currency/Service.php
  3. 10 0
      tests/Zend/CurrencyTest.php

+ 1 - 1
library/Zend/Currency.php

@@ -794,7 +794,7 @@ class Zend_Currency
             if (!class_exists($service)) {
             if (!class_exists($service)) {
                 $file = str_replace('_', DIRECTORY_SEPARATOR, $service) . '.php';
                 $file = str_replace('_', DIRECTORY_SEPARATOR, $service) . '.php';
                 if (Zend_Loader::isReadable($file)) {
                 if (Zend_Loader::isReadable($file)) {
-                    Zend_Loader::loadClass($class);
+                    Zend_Loader::loadClass($service);
                 }
                 }
             }
             }
 
 

+ 11 - 0
tests/Zend/Currency/Service.php

@@ -0,0 +1,11 @@
+<?php
+/**
+ * @see Zend_Currency_CurrencyInterface
+ */
+require_once 'Zend/Currency/CurrencyInterface.php';
+
+class Zend_Currency_Service implements Zend_Currency_CurrencyInterface
+{
+    public function getRate($from, $to)
+    {}
+}

+ 10 - 0
tests/Zend/CurrencyTest.php

@@ -825,4 +825,14 @@ class Zend_CurrencyTest extends PHPUnit_Framework_TestCase
         $currency = new Zend_Currency(array('value' => 1000, 'locale' => 'de_AT'));
         $currency = new Zend_Currency(array('value' => 1000, 'locale' => 'de_AT'));
         $this->assertEquals('€ 2.000,00', $currency->toCurrency(null, array('value' => 2000)));
         $this->assertEquals('€ 2.000,00', $currency->toCurrency(null, array('value' => 2000)));
     }
     }
+
+    /**
+     * @group ZF-10751
+     */
+    public function testSetService()
+    {
+        $currency = new Zend_Currency();
+        $currency->setService('Zend_Currency_Service');
+        $this->assertTrue($currency->getService() instanceof Zend_Currency_Service);
+    }
 }
 }