Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

Application modulaire fonctionnelle !

Emmanuel ROY authored on 12/08/2019 15:10:25
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,75 +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 PHPUnit\Framework\TestCase;
15
-use Symfony\Component\Config\Resource\FileResource;
16
-use Symfony\Component\Translation\Loader\MoFileLoader;
17
-
18
-class MoFileLoaderTest extends TestCase
19
-{
20
-    public function testLoad()
21
-    {
22
-        $loader = new MoFileLoader();
23
-        $resource = __DIR__.'/../fixtures/resources.mo';
24
-        $catalogue = $loader->load($resource, 'en', 'domain1');
25
-
26
-        $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1'));
27
-        $this->assertEquals('en', $catalogue->getLocale());
28
-        $this->assertEquals([new FileResource($resource)], $catalogue->getResources());
29
-    }
30
-
31
-    public function testLoadPlurals()
32
-    {
33
-        $loader = new MoFileLoader();
34
-        $resource = __DIR__.'/../fixtures/plurals.mo';
35
-        $catalogue = $loader->load($resource, 'en', 'domain1');
36
-
37
-        $this->assertEquals([
38
-            'foo|foos' => 'bar|bars',
39
-            '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars',
40
-        ], $catalogue->all('domain1'));
41
-        $this->assertEquals('en', $catalogue->getLocale());
42
-        $this->assertEquals([new FileResource($resource)], $catalogue->getResources());
43
-    }
44
-
45
-    /**
46
-     * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
47
-     */
48
-    public function testLoadNonExistingResource()
49
-    {
50
-        $loader = new MoFileLoader();
51
-        $resource = __DIR__.'/../fixtures/non-existing.mo';
52
-        $loader->load($resource, 'en', 'domain1');
53
-    }
54
-
55
-    /**
56
-     * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
57
-     */
58
-    public function testLoadInvalidResource()
59
-    {
60
-        $loader = new MoFileLoader();
61
-        $resource = __DIR__.'/../fixtures/empty.mo';
62
-        $loader->load($resource, 'en', 'domain1');
63
-    }
64
-
65
-    public function testLoadEmptyTranslation()
66
-    {
67
-        $loader = new MoFileLoader();
68
-        $resource = __DIR__.'/../fixtures/empty-translation.mo';
69
-        $catalogue = $loader->load($resource, 'en', 'message');
70
-
71
-        $this->assertEquals([], $catalogue->all('message'));
72
-        $this->assertEquals('en', $catalogue->getLocale());
73
-        $this->assertEquals([new FileResource($resource)], $catalogue->getResources());
74
-    }
75
-}
Browse code

initial commit

Emmanuel ROY authored on 09/08/2019 08:39:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,75 @@
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 PHPUnit\Framework\TestCase;
15
+use Symfony\Component\Config\Resource\FileResource;
16
+use Symfony\Component\Translation\Loader\MoFileLoader;
17
+
18
+class MoFileLoaderTest extends TestCase
19
+{
20
+    public function testLoad()
21
+    {
22
+        $loader = new MoFileLoader();
23
+        $resource = __DIR__.'/../fixtures/resources.mo';
24
+        $catalogue = $loader->load($resource, 'en', 'domain1');
25
+
26
+        $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1'));
27
+        $this->assertEquals('en', $catalogue->getLocale());
28
+        $this->assertEquals([new FileResource($resource)], $catalogue->getResources());
29
+    }
30
+
31
+    public function testLoadPlurals()
32
+    {
33
+        $loader = new MoFileLoader();
34
+        $resource = __DIR__.'/../fixtures/plurals.mo';
35
+        $catalogue = $loader->load($resource, 'en', 'domain1');
36
+
37
+        $this->assertEquals([
38
+            'foo|foos' => 'bar|bars',
39
+            '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars',
40
+        ], $catalogue->all('domain1'));
41
+        $this->assertEquals('en', $catalogue->getLocale());
42
+        $this->assertEquals([new FileResource($resource)], $catalogue->getResources());
43
+    }
44
+
45
+    /**
46
+     * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
47
+     */
48
+    public function testLoadNonExistingResource()
49
+    {
50
+        $loader = new MoFileLoader();
51
+        $resource = __DIR__.'/../fixtures/non-existing.mo';
52
+        $loader->load($resource, 'en', 'domain1');
53
+    }
54
+
55
+    /**
56
+     * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
57
+     */
58
+    public function testLoadInvalidResource()
59
+    {
60
+        $loader = new MoFileLoader();
61
+        $resource = __DIR__.'/../fixtures/empty.mo';
62
+        $loader->load($resource, 'en', 'domain1');
63
+    }
64
+
65
+    public function testLoadEmptyTranslation()
66
+    {
67
+        $loader = new MoFileLoader();
68
+        $resource = __DIR__.'/../fixtures/empty-translation.mo';
69
+        $catalogue = $loader->load($resource, 'en', 'message');
70
+
71
+        $this->assertEquals([], $catalogue->all('message'));
72
+        $this->assertEquals('en', $catalogue->getLocale());
73
+        $this->assertEquals([new FileResource($resource)], $catalogue->getResources());
74
+    }
75
+}