]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/PhpBundleReaderTest.php
2fee35599fd43022728f549c755e78872ca3d33a
[github/wallabag/wallabag.git] / vendor / symfony / intl / Symfony / Component / Intl / Tests / ResourceBundle / Reader / PhpBundleReaderTest.php
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\Reader;
13
14 use Symfony\Component\Intl\ResourceBundle\Reader\PhpBundleReader;
15
16 /**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19 class PhpBundleReaderTest extends \PHPUnit_Framework_TestCase
20 {
21 /**
22 * @var PhpBundleReader
23 */
24 private $reader;
25
26 protected function setUp()
27 {
28 $this->reader = new PhpBundleReader();
29 }
30
31 public function testReadReturnsArray()
32 {
33 $data = $this->reader->read(__DIR__ . '/Fixtures', 'en');
34
35 $this->assertTrue(is_array($data));
36 $this->assertSame('Bar', $data['Foo']);
37 $this->assertFalse(isset($data['ExistsNot']));
38 }
39
40 /**
41 * @expectedException \Symfony\Component\Intl\Exception\InvalidArgumentException
42 */
43 public function testReadFailsIfLocaleOtherThanEn()
44 {
45 $this->reader->read(__DIR__ . '/Fixtures', 'foo');
46 }
47
48 /**
49 * @expectedException \Symfony\Component\Intl\Exception\RuntimeException
50 */
51 public function testReadFailsIfNonExistingDirectory()
52 {
53 $this->reader->read(__DIR__ . '/foo', 'en');
54 }
55
56 /**
57 * @expectedException \Symfony\Component\Intl\Exception\RuntimeException
58 */
59 public function testReadFailsIfNotAFile()
60 {
61 $this->reader->read(__DIR__ . '/Fixtures/NotAFile', 'en');
62 }
63 }