]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
1 | <?php |
2 | ||
3 | /* | |
4 | * This file is part of the Symfony package. | |
5 | * | |
6 | * (c) Fabien Potencier <fabien@symfony.com> | |
7 | * | |
8 | * For the full copyright and license information, please view the LICENSE | |
9 | * file that was distributed with this source code. | |
10 | */ | |
11 | ||
12 | namespace Symfony\Component\Intl\Tests\ResourceBundle; | |
13 | ||
14 | use Symfony\Component\Intl\ResourceBundle\RegionBundle; | |
15 | ||
16 | /** | |
17 | * @author Bernhard Schussek <bschussek@gmail.com> | |
18 | */ | |
19 | class RegionBundleTest extends \PHPUnit_Framework_TestCase | |
20 | { | |
21 | const RES_DIR = '/base/region'; | |
22 | ||
23 | /** | |
24 | * @var RegionBundle | |
25 | */ | |
26 | private $bundle; | |
27 | ||
28 | /** | |
29 | * @var \PHPUnit_Framework_MockObject_MockObject | |
30 | */ | |
31 | private $reader; | |
32 | ||
33 | protected function setUp() | |
34 | { | |
35 | $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); | |
36 | $this->bundle = new RegionBundle(self::RES_DIR, $this->reader); | |
37 | } | |
38 | ||
39 | public function testGetCountryName() | |
40 | { | |
41 | $this->reader->expects($this->once()) | |
42 | ->method('readEntry') | |
43 | ->with(self::RES_DIR, 'en', array('Countries', 'AT')) | |
44 | ->will($this->returnValue('Austria')); | |
45 | ||
46 | $this->assertSame('Austria', $this->bundle->getCountryName('AT', 'en')); | |
47 | } | |
48 | ||
49 | public function testGetCountryNames() | |
50 | { | |
51 | $sortedCountries = array( | |
52 | 'AT' => 'Austria', | |
53 | 'DE' => 'Germany', | |
54 | ); | |
55 | ||
56 | $this->reader->expects($this->once()) | |
57 | ->method('readEntry') | |
58 | ->with(self::RES_DIR, 'en', array('Countries')) | |
59 | ->will($this->returnValue($sortedCountries)); | |
60 | ||
61 | $this->assertSame($sortedCountries, $this->bundle->getCountryNames('en')); | |
62 | } | |
63 | } |