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,79 +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\QtFileLoader;
17
-
18
-class QtFileLoaderTest extends TestCase
19
-{
20
-    public function testLoad()
21
-    {
22
-        $loader = new QtFileLoader();
23
-        $resource = __DIR__.'/../fixtures/resources.ts';
24
-        $catalogue = $loader->load($resource, 'en', 'resources');
25
-
26
-        $this->assertEquals([
27
-            'foo' => 'bar',
28
-            'foo_bar' => 'foobar',
29
-            'bar_foo' => 'barfoo',
30
-        ], $catalogue->all('resources'));
31
-        $this->assertEquals('en', $catalogue->getLocale());
32
-        $this->assertEquals([new FileResource($resource)], $catalogue->getResources());
33
-    }
34
-
35
-    /**
36
-     * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
37
-     */
38
-    public function testLoadNonExistingResource()
39
-    {
40
-        $loader = new QtFileLoader();
41
-        $resource = __DIR__.'/../fixtures/non-existing.ts';
42
-        $loader->load($resource, 'en', 'domain1');
43
-    }
44
-
45
-    /**
46
-     * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
47
-     */
48
-    public function testLoadNonLocalResource()
49
-    {
50
-        $loader = new QtFileLoader();
51
-        $resource = 'http://domain1.com/resources.ts';
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 QtFileLoader();
61
-        $resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf';
62
-        $loader->load($resource, 'en', 'domain1');
63
-    }
64
-
65
-    public function testLoadEmptyResource()
66
-    {
67
-        $loader = new QtFileLoader();
68
-        $resource = __DIR__.'/../fixtures/empty.xlf';
69
-
70
-        if (method_exists($this, 'expectException')) {
71
-            $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
72
-            $this->expectExceptionMessage(sprintf('Unable to load "%s".', $resource));
73
-        } else {
74
-            $this->setExpectedException('Symfony\Component\Translation\Exception\InvalidResourceException', sprintf('Unable to load "%s".', $resource));
75
-        }
76
-
77
-        $loader->load($resource, 'en', 'domain1');
78
-    }
79
-}
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,79 @@
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\QtFileLoader;
17
+
18
+class QtFileLoaderTest extends TestCase
19
+{
20
+    public function testLoad()
21
+    {
22
+        $loader = new QtFileLoader();
23
+        $resource = __DIR__.'/../fixtures/resources.ts';
24
+        $catalogue = $loader->load($resource, 'en', 'resources');
25
+
26
+        $this->assertEquals([
27
+            'foo' => 'bar',
28
+            'foo_bar' => 'foobar',
29
+            'bar_foo' => 'barfoo',
30
+        ], $catalogue->all('resources'));
31
+        $this->assertEquals('en', $catalogue->getLocale());
32
+        $this->assertEquals([new FileResource($resource)], $catalogue->getResources());
33
+    }
34
+
35
+    /**
36
+     * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
37
+     */
38
+    public function testLoadNonExistingResource()
39
+    {
40
+        $loader = new QtFileLoader();
41
+        $resource = __DIR__.'/../fixtures/non-existing.ts';
42
+        $loader->load($resource, 'en', 'domain1');
43
+    }
44
+
45
+    /**
46
+     * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
47
+     */
48
+    public function testLoadNonLocalResource()
49
+    {
50
+        $loader = new QtFileLoader();
51
+        $resource = 'http://domain1.com/resources.ts';
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 QtFileLoader();
61
+        $resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf';
62
+        $loader->load($resource, 'en', 'domain1');
63
+    }
64
+
65
+    public function testLoadEmptyResource()
66
+    {
67
+        $loader = new QtFileLoader();
68
+        $resource = __DIR__.'/../fixtures/empty.xlf';
69
+
70
+        if (method_exists($this, 'expectException')) {
71
+            $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException');
72
+            $this->expectExceptionMessage(sprintf('Unable to load "%s".', $resource));
73
+        } else {
74
+            $this->setExpectedException('Symfony\Component\Translation\Exception\InvalidResourceException', sprintf('Unable to load "%s".', $resource));
75
+        }
76
+
77
+        $loader->load($resource, 'en', 'domain1');
78
+    }
79
+}