]>
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 | /** | |
15 | * @author Bernhard Schussek <bschussek@gmail.com> | |
16 | */ | |
17 | class AbstractBundleTest extends \PHPUnit_Framework_TestCase | |
18 | { | |
19 | const RES_DIR = '/base/dirName'; | |
20 | ||
21 | /** | |
22 | * @var \Symfony\Component\Intl\ResourceBundle\AbstractBundle | |
23 | */ | |
24 | private $bundle; | |
25 | ||
26 | /** | |
27 | * @var \PHPUnit_Framework_MockObject_MockObject | |
28 | */ | |
29 | private $reader; | |
30 | ||
31 | protected function setUp() | |
32 | { | |
33 | $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); | |
34 | $this->bundle = $this->getMockForAbstractClass( | |
35 | 'Symfony\Component\Intl\ResourceBundle\AbstractBundle', | |
36 | array(self::RES_DIR, $this->reader) | |
37 | ); | |
38 | ||
39 | $this->bundle->expects($this->any()) | |
40 | ->method('getDirectoryName') | |
41 | ->will($this->returnValue('dirName')); | |
42 | } | |
43 | ||
44 | public function testGetLocales() | |
45 | { | |
46 | $locales = array('de', 'en', 'fr'); | |
47 | ||
48 | $this->reader->expects($this->once()) | |
49 | ->method('getLocales') | |
50 | ->with(self::RES_DIR) | |
51 | ->will($this->returnValue($locales)); | |
52 | ||
53 | $this->assertSame($locales, $this->bundle->getLocales()); | |
54 | } | |
55 | } |