diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-04 17:50:34 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-04 17:50:34 +0200 |
commit | 46b77928f746a4231d064774b5b67fd892c7ce86 (patch) | |
tree | e3ea690b3f0def1744ddae758923cf92171ef985 /vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php | |
parent | 68abd9c71b1d2f7bb2e9d21819584d1d15005b25 (diff) | |
download | wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.gz wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.zst wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.zip |
rm vendor
Diffstat (limited to 'vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php')
-rw-r--r-- | vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php deleted file mode 100644 index 511b1279..00000000 --- a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
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\Translation\Tests\Loader; | ||
13 | |||
14 | use Symfony\Component\Translation\Loader\YamlFileLoader; | ||
15 | use Symfony\Component\Config\Resource\FileResource; | ||
16 | |||
17 | class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase | ||
18 | { | ||
19 | protected function setUp() | ||
20 | { | ||
21 | if (!class_exists('Symfony\Component\Config\Loader\Loader')) { | ||
22 | $this->markTestSkipped('The "Config" component is not available'); | ||
23 | } | ||
24 | |||
25 | if (!class_exists('Symfony\Component\Yaml\Yaml')) { | ||
26 | $this->markTestSkipped('The "Yaml" component is not available'); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | public function testLoad() | ||
31 | { | ||
32 | $loader = new YamlFileLoader(); | ||
33 | $resource = __DIR__.'/../fixtures/resources.yml'; | ||
34 | $catalogue = $loader->load($resource, 'en', 'domain1'); | ||
35 | |||
36 | $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); | ||
37 | $this->assertEquals('en', $catalogue->getLocale()); | ||
38 | $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); | ||
39 | } | ||
40 | |||
41 | public function testLoadDoesNothingIfEmpty() | ||
42 | { | ||
43 | $loader = new YamlFileLoader(); | ||
44 | $resource = __DIR__.'/../fixtures/empty.yml'; | ||
45 | $catalogue = $loader->load($resource, 'en', 'domain1'); | ||
46 | |||
47 | $this->assertEquals(array(), $catalogue->all('domain1')); | ||
48 | $this->assertEquals('en', $catalogue->getLocale()); | ||
49 | $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException | ||
54 | */ | ||
55 | public function testLoadNonExistingResource() | ||
56 | { | ||
57 | $loader = new YamlFileLoader(); | ||
58 | $resource = __DIR__.'/../fixtures/non-existing.yml'; | ||
59 | $loader->load($resource, 'en', 'domain1'); | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException | ||
64 | */ | ||
65 | public function testLoadThrowsAnExceptionIfFileNotLocal() | ||
66 | { | ||
67 | $loader = new YamlFileLoader(); | ||
68 | $resource = 'http://example.com/resources.yml'; | ||
69 | $loader->load($resource, 'en', 'domain1'); | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException | ||
74 | */ | ||
75 | public function testLoadThrowsAnExceptionIfNotAnArray() | ||
76 | { | ||
77 | $loader = new YamlFileLoader(); | ||
78 | $resource = __DIR__.'/../fixtures/non-valid.yml'; | ||
79 | $loader->load($resource, 'en', 'domain1'); | ||
80 | } | ||
81 | } | ||