Jelajahi Sumber

[Locale] added implementation to StubNumberFormatter::getLocale(), matching StubIntlDateFormatter::getLocale()

Eriksen Costa 14 tahun lalu
induk
melakukan
b649843e00

+ 1 - 2
src/Symfony/Component/Locale/Stub/StubNumberFormatter.php

@@ -355,11 +355,10 @@ class StubNumberFormatter
      *
      * @param  int      $type     The locale name type to return between valid or actual (StubLocale::VALID_LOCALE or StubLocale::ACTUAL_LOCALE, respectively)
      * @return string             The locale name used to create the formatter
-     * @throws MethodNotImplementedException
      */
     public function getLocale($type = StubLocale::ACTUAL_LOCALE)
     {
-        throw new MethodNotImplementedException(__METHOD__);
+        return $this->locale;
     }
 
     /**

+ 1 - 4
tests/Symfony/Tests/Component/Locale/Stub/StubNumberFormatterTest.php

@@ -602,13 +602,10 @@ class StubNumberFormatterTest extends LocaleTestCase
         $this->assertEquals(StubNumberFormatter::U_ZERO_ERROR_MESSAGE, $formatter->getErrorMessage());
     }
 
-    /**
-     * @expectedException Symfony\Component\Locale\Exception\MethodNotImplementedException
-     */
     public function testGetLocale()
     {
         $formatter = $this->getStubFormatterWithDecimalStyle();
-        $formatter->getLocale();
+        $this->assertEquals('en', $formatter->getLocale());
     }
 
     /**