aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php')
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php
new file mode 100644
index 00000000..2da7f90d
--- /dev/null
+++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php
@@ -0,0 +1,64 @@
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
12namespace Symfony\Component\Intl\Tests\ResourceBundle\Reader;
13
14use Symfony\Component\Filesystem\Filesystem;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class AbstractBundleReaderTest extends \PHPUnit_Framework_TestCase
20{
21 private $directory;
22
23 /**
24 * @var Filesystem
25 */
26 private $filesystem;
27
28 /**
29 * @var \PHPUnit_Framework_MockObject_MockObject
30 */
31 private $reader;
32
33 protected function setUp()
34 {
35 $this->directory = sys_get_temp_dir() . '/AbstractBundleReaderTest/' . rand(1000, 9999);
36 $this->filesystem = new Filesystem();
37 $this->reader = $this->getMockForAbstractClass('Symfony\Component\Intl\ResourceBundle\Reader\AbstractBundleReader');
38
39 $this->filesystem->mkdir($this->directory);
40 }
41
42 protected function tearDown()
43 {
44 $this->filesystem->remove($this->directory);
45 }
46
47 public function testGetLocales()
48 {
49 $this->filesystem->touch($this->directory . '/en.foo');
50 $this->filesystem->touch($this->directory . '/de.foo');
51 $this->filesystem->touch($this->directory . '/fr.foo');
52 $this->filesystem->touch($this->directory . '/bo.txt');
53 $this->filesystem->touch($this->directory . '/gu.bin');
54 $this->filesystem->touch($this->directory . '/s.lol');
55
56 $this->reader->expects($this->any())
57 ->method('getFileExtension')
58 ->will($this->returnValue('foo'));
59
60 $sortedLocales = array('de', 'en', 'fr');
61
62 $this->assertSame($sortedLocales, $this->reader->getLocales($this->directory));
63 }
64}