aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/translation/Symfony/Component/Translation/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/translation/Symfony/Component/Translation/Tests')
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php74
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php60
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php60
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php33
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php37
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php32
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php31
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php32
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php31
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php32
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php32
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php39
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php61
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php48
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php67
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php72
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php59
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php57
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php22
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php67
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php56
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php79
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php66
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php113
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php81
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php212
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php80
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php124
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php306
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.po3
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.csv0
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.ini0
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.mo0
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.po0
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.yml0
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/encoding.xlf15
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf23
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.xlf11
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.yml1
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.mobin0 -> 74 bytes
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.po5
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resname.xlf19
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/corrupted/resources.dat1
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.resbin0 -> 120 bytes
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt3
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.resbin0 -> 124 bytes
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt3
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/packagelist.txt2
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/resources.datbin0 -> 352 bytes
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/res/en.resbin0 -> 84 bytes
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources-clean.xlf15
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.csv4
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ini1
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.mobin0 -> 52 bytes
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.php5
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.po2
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ts10
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.xlf23
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.yml1
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/valid.csv4
-rw-r--r--vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withdoctype.xlf12
61 files changed, 2226 insertions, 0 deletions
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
new file mode 100644
index 00000000..78023e1b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
@@ -0,0 +1,74 @@
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\Translation\Test\Catalogue;
13
14use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
15use Symfony\Component\Translation\MessageCatalogue;
16use Symfony\Component\Translation\MessageCatalogueInterface;
17
18abstract class AbstractOperationTest extends TestCase
19{
20 public function testGetEmptyDomains()
21 {
22 $this->assertEquals(
23 array(),
24 $this->createOperation(
25 new MessageCatalogue('en'),
26 new MessageCatalogue('en')
27 )->getDomains()
28 );
29 }
30
31 public function testGetMergedDomains()
32 {
33 $this->assertEquals(
34 array('a', 'b', 'c'),
35 $this->createOperation(
36 new MessageCatalogue('en', array('a' => array(), 'b' => array())),
37 new MessageCatalogue('en', array('b' => array(), 'c' => array()))
38 )->getDomains()
39 );
40 }
41
42 public function testGetMessagesFromUnknownDomain()
43 {
44 $this->setExpectedException('InvalidArgumentException');
45 $this->createOperation(
46 new MessageCatalogue('en'),
47 new MessageCatalogue('en')
48 )->getMessages('domain');
49 }
50
51 public function testGetEmptyMessages()
52 {
53 $this->assertEquals(
54 array(),
55 $this->createOperation(
56 new MessageCatalogue('en', array('a' => array())),
57 new MessageCatalogue('en')
58 )->getMessages('a')
59 );
60 }
61
62 public function testGetEmptyResult()
63 {
64 $this->assertEquals(
65 new MessageCatalogue('en'),
66 $this->createOperation(
67 new MessageCatalogue('en'),
68 new MessageCatalogue('en')
69 )->getResult()
70 );
71 }
72
73 abstract protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target);
74}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php
new file mode 100644
index 00000000..b2e852d9
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php
@@ -0,0 +1,60 @@
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\Translation\Test\Catalogue;
13
14use Symfony\Component\Translation\Catalogue\DiffOperation;
15use Symfony\Component\Translation\MessageCatalogue;
16use Symfony\Component\Translation\MessageCatalogueInterface;
17
18class DiffOperationTest extends AbstractOperationTest
19{
20 public function testGetMessagesFromSingleDomain()
21 {
22 $operation = $this->createOperation(
23 new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))),
24 new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c')))
25 );
26
27 $this->assertEquals(
28 array('a' => 'old_a', 'c' => 'new_c'),
29 $operation->getMessages('messages')
30 );
31
32 $this->assertEquals(
33 array('c' => 'new_c'),
34 $operation->getNewMessages('messages')
35 );
36
37 $this->assertEquals(
38 array('b' => 'old_b'),
39 $operation->getObsoleteMessages('messages')
40 );
41 }
42
43 public function testGetResultFromSingleDomain()
44 {
45 $this->assertEquals(
46 new MessageCatalogue('en', array(
47 'messages' => array('a' => 'old_a', 'c' => 'new_c')
48 )),
49 $this->createOperation(
50 new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))),
51 new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c')))
52 )->getResult()
53 );
54 }
55
56 protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target)
57 {
58 return new DiffOperation($source, $target);
59 }
60}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php
new file mode 100644
index 00000000..fa5118a7
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php
@@ -0,0 +1,60 @@
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\Translation\Test\Catalogue;
13
14use Symfony\Component\Translation\Catalogue\MergeOperation;
15use Symfony\Component\Translation\MessageCatalogue;
16use Symfony\Component\Translation\MessageCatalogueInterface;
17
18class MergeOperationTest extends AbstractOperationTest
19{
20 public function testGetMessagesFromSingleDomain()
21 {
22 $operation = $this->createOperation(
23 new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))),
24 new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c')))
25 );
26
27 $this->assertEquals(
28 array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'),
29 $operation->getMessages('messages')
30 );
31
32 $this->assertEquals(
33 array('c' => 'new_c'),
34 $operation->getNewMessages('messages')
35 );
36
37 $this->assertEquals(
38 array(),
39 $operation->getObsoleteMessages('messages')
40 );
41 }
42
43 public function testGetResultFromSingleDomain()
44 {
45 $this->assertEquals(
46 new MessageCatalogue('en', array(
47 'messages' => array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c')
48 )),
49 $this->createOperation(
50 new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))),
51 new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c')))
52 )->getResult()
53 );
54 }
55
56 protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target)
57 {
58 return new MergeOperation($source, $target);
59 }
60}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php
new file mode 100644
index 00000000..29177ff5
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php
@@ -0,0 +1,33 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\CsvFileDumper;
16
17class CsvFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 public function testDump()
20 {
21 $catalogue = new MessageCatalogue('en');
22 $catalogue->add(array('foo' => 'bar', 'bar' => 'foo
23foo', 'foo;foo' => 'bar'));
24
25 $tempDir = sys_get_temp_dir();
26 $dumper = new CsvFileDumper();
27 $dumper->dump($catalogue, array('path' => $tempDir));
28
29 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/valid.csv'), file_get_contents($tempDir.'/messages.en.csv'));
30
31 unlink($tempDir.'/messages.en.csv');
32 }
33}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php
new file mode 100644
index 00000000..d187ef1d
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php
@@ -0,0 +1,37 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\IcuResFileDumper;
16
17class IcuResFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 public function testDump()
20 {
21 if (!extension_loaded('mbstring')) {
22 $this->markTestSkipped('This test requires mbstring to work.');
23 }
24
25 $catalogue = new MessageCatalogue('en');
26 $catalogue->add(array('foo' => 'bar'));
27
28 $tempDir = sys_get_temp_dir();
29 $dumper = new IcuResFileDumper();
30 $dumper->dump($catalogue, array('path' => $tempDir));
31
32 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resourcebundle/res/en.res'), file_get_contents($tempDir.'/messages/en.res'));
33
34 unlink($tempDir.'/messages/en.res');
35 rmdir($tempDir.'/messages');
36 }
37}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php
new file mode 100644
index 00000000..2a2cefde
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php
@@ -0,0 +1,32 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\IniFileDumper;
16
17class IniFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 public function testDump()
20 {
21 $catalogue = new MessageCatalogue('en');
22 $catalogue->add(array('foo' => 'bar'));
23
24 $tempDir = sys_get_temp_dir();
25 $dumper = new IniFileDumper();
26 $dumper->dump($catalogue, array('path' => $tempDir));
27
28 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.ini'), file_get_contents($tempDir.'/messages.en.ini'));
29
30 unlink($tempDir.'/messages.en.ini');
31 }
32}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php
new file mode 100644
index 00000000..439a25cd
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php
@@ -0,0 +1,31 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\MoFileDumper;
16
17class MoFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 public function testDump()
20 {
21 $catalogue = new MessageCatalogue('en');
22 $catalogue->add(array('foo' => 'bar'));
23
24 $tempDir = sys_get_temp_dir();
25 $dumper = new MoFileDumper();
26 $dumper->dump($catalogue, array('path' => $tempDir));
27 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.mo'), file_get_contents($tempDir.'/messages.en.mo'));
28
29 unlink($tempDir.'/messages.en.mo');
30 }
31}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php
new file mode 100644
index 00000000..18be5a0d
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php
@@ -0,0 +1,32 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\PhpFileDumper;
16
17class PhpFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 public function testDump()
20 {
21 $catalogue = new MessageCatalogue('en');
22 $catalogue->add(array('foo' => 'bar'));
23
24 $tempDir = sys_get_temp_dir();
25 $dumper = new PhpFileDumper();
26 $dumper->dump($catalogue, array('path' => $tempDir));
27
28 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.php'), file_get_contents($tempDir.'/messages.en.php'));
29
30 unlink($tempDir.'/messages.en.php');
31 }
32}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php
new file mode 100644
index 00000000..0296d6b2
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php
@@ -0,0 +1,31 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\PoFileDumper;
16
17class PoFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 public function testDump()
20 {
21 $catalogue = new MessageCatalogue('en');
22 $catalogue->add(array('foo' => 'bar'));
23
24 $tempDir = sys_get_temp_dir();
25 $dumper = new PoFileDumper();
26 $dumper->dump($catalogue, array('path' => $tempDir));
27 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.po'), file_get_contents($tempDir.'/messages.en.po'));
28
29 unlink($tempDir.'/messages.en.po');
30 }
31}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php
new file mode 100644
index 00000000..d7d8fb7e
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php
@@ -0,0 +1,32 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\QtFileDumper;
16
17class QtFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 public function testDump()
20 {
21 $catalogue = new MessageCatalogue('en');
22 $catalogue->add(array('foo' => 'bar'), 'resources');
23
24 $tempDir = sys_get_temp_dir();
25 $dumper = new QtFileDumper();
26 $dumper->dump($catalogue, array('path' => $tempDir));
27
28 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.ts'), file_get_contents($tempDir.'/resources.en.ts'));
29
30 unlink($tempDir.'/resources.en.ts');
31 }
32}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php
new file mode 100644
index 00000000..bef31358
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php
@@ -0,0 +1,32 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\XliffFileDumper;
16
17class XliffFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 public function testDump()
20 {
21 $catalogue = new MessageCatalogue('en');
22 $catalogue->add(array('foo' => 'bar', 'key' => ''));
23
24 $tempDir = sys_get_temp_dir();
25 $dumper = new XliffFileDumper();
26 $dumper->dump($catalogue, array('path' => $tempDir));
27
28 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources-clean.xlf'), file_get_contents($tempDir.'/messages.en.xlf'));
29
30 unlink($tempDir.'/messages.en.xlf');
31 }
32}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php
new file mode 100644
index 00000000..e4e68e02
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php
@@ -0,0 +1,39 @@
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\Translation\Tests\Dumper;
13
14use Symfony\Component\Translation\MessageCatalogue;
15use Symfony\Component\Translation\Dumper\YamlFileDumper;
16
17class YamlFileDumperTest extends \PHPUnit_Framework_TestCase
18{
19 protected function setUp()
20 {
21 if (!class_exists('Symfony\Component\Yaml\Yaml')) {
22 $this->markTestSkipped('The "Yaml" component is not available');
23 }
24 }
25
26 public function testDump()
27 {
28 $catalogue = new MessageCatalogue('en');
29 $catalogue->add(array('foo' => 'bar'));
30
31 $tempDir = sys_get_temp_dir();
32 $dumper = new YamlFileDumper();
33 $dumper->dump($catalogue, array('path' => $tempDir));
34
35 $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.yml'), file_get_contents($tempDir.'/messages.en.yml'));
36
37 unlink($tempDir.'/messages.en.yml');
38 }
39}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
new file mode 100644
index 00000000..435f0c28
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
@@ -0,0 +1,61 @@
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\Translation\Tests;
13
14use Symfony\Component\Translation\IdentityTranslator;
15use Symfony\Component\Translation\MessageSelector;
16
17class IdentityTranslatorTest extends \PHPUnit_Framework_TestCase
18{
19 /**
20 * @dataProvider getTransTests
21 */
22 public function testTrans($expected, $id, $parameters)
23 {
24 $translator = new IdentityTranslator(new MessageSelector());
25
26 $this->assertEquals($expected, $translator->trans($id, $parameters));
27 }
28
29 /**
30 * @dataProvider getTransChoiceTests
31 */
32 public function testTransChoice($expected, $id, $number, $parameters)
33 {
34 $translator = new IdentityTranslator(new MessageSelector());
35
36 $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters));
37 }
38
39 // noop
40 public function testGetSetLocale()
41 {
42 $translator = new IdentityTranslator(new MessageSelector());
43 $translator->setLocale('en');
44 $translator->getLocale();
45 }
46
47 public function getTransTests()
48 {
49 return array(
50 array('Symfony2 is great!', 'Symfony2 is great!', array()),
51 array('Symfony2 is awesome!', 'Symfony2 is %what%!', array('%what%' => 'awesome')),
52 );
53 }
54
55 public function getTransChoiceTests()
56 {
57 return array(
58 array('There is 10 apples', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', 10, array('%count%' => 10)),
59 );
60 }
61}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php
new file mode 100644
index 00000000..075c98b7
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php
@@ -0,0 +1,48 @@
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\Translation\Tests;
13
14use Symfony\Component\Translation\Interval;
15
16class IntervalTest extends \PHPUnit_Framework_TestCase
17{
18 /**
19 * @dataProvider getTests
20 */
21 public function testTest($expected, $number, $interval)
22 {
23 $this->assertEquals($expected, Interval::test($number, $interval));
24 }
25
26 /**
27 * @expectedException \InvalidArgumentException
28 */
29 public function testTestException()
30 {
31 Interval::test(1, 'foobar');
32 }
33
34 public function getTests()
35 {
36 return array(
37 array(true, 3, '{1,2, 3 ,4}'),
38 array(false, 10, '{1,2, 3 ,4}'),
39 array(false, 3, '[1,2]'),
40 array(true, 1, '[1,2]'),
41 array(true, 2, '[1,2]'),
42 array(false, 1, ']1,2['),
43 array(false, 2, ']1,2['),
44 array(true, log(0), '[-Inf,2['),
45 array(true, -log(0), '[-2,+Inf]'),
46 );
47 }
48}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
new file mode 100644
index 00000000..59569a3d
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
@@ -0,0 +1,67 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\CsvFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class CsvFileLoaderTest 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
26 public function testLoad()
27 {
28 $loader = new CsvFileLoader();
29 $resource = __DIR__.'/../fixtures/resources.csv';
30 $catalogue = $loader->load($resource, 'en', 'domain1');
31
32 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
33 $this->assertEquals('en', $catalogue->getLocale());
34 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
35 }
36
37 public function testLoadDoesNothingIfEmpty()
38 {
39 $loader = new CsvFileLoader();
40 $resource = __DIR__.'/../fixtures/empty.csv';
41 $catalogue = $loader->load($resource, 'en', 'domain1');
42
43 $this->assertEquals(array(), $catalogue->all('domain1'));
44 $this->assertEquals('en', $catalogue->getLocale());
45 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
46 }
47
48 /**
49 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
50 */
51 public function testLoadNonExistingResource()
52 {
53 $loader = new CsvFileLoader();
54 $resource = __DIR__.'/../fixtures/not-exists.csv';
55 $loader->load($resource, 'en', 'domain1');
56 }
57
58 /**
59 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
60 */
61 public function testLoadNonLocalResource()
62 {
63 $loader = new CsvFileLoader();
64 $resource = 'http://example.com/resources.csv';
65 $loader->load($resource, 'en', 'domain1');
66 }
67}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
new file mode 100644
index 00000000..a3bd67ab
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
@@ -0,0 +1,72 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\IcuDatFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class IcuDatFileLoaderTest extends LocalizedTestCase
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 (!extension_loaded('intl')) {
26 $this->markTestSkipped('This test requires intl extension to work.');
27 }
28 }
29
30 /**
31 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
32 */
33 public function testLoadInvalidResource()
34 {
35 $loader = new IcuDatFileLoader();
36 $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2');
37 }
38
39 public function testDatEnglishLoad()
40 {
41 // bundled resource is build using pkgdata command which at least in ICU 4.2 comes in extremely! buggy form
42 // you must specify an temporary build directory which is not the same as current directory and
43 // MUST reside on the same partition. pkgdata -p resources -T /srv -d.packagelist.txt
44 $loader = new IcuDatFileLoader();
45 $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources';
46 $catalogue = $loader->load($resource, 'en', 'domain1');
47
48 $this->assertEquals(array('symfony' => 'Symfony 2 is great'), $catalogue->all('domain1'));
49 $this->assertEquals('en', $catalogue->getLocale());
50 $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources());
51 }
52
53 public function testDatFrenchLoad()
54 {
55 $loader = new IcuDatFileLoader();
56 $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources';
57 $catalogue = $loader->load($resource, 'fr', 'domain1');
58
59 $this->assertEquals(array('symfony' => 'Symfony 2 est génial'), $catalogue->all('domain1'));
60 $this->assertEquals('fr', $catalogue->getLocale());
61 $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources());
62 }
63
64 /**
65 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
66 */
67 public function testLoadNonExistingResource()
68 {
69 $loader = new IcuDatFileLoader();
70 $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
71 }
72}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
new file mode 100644
index 00000000..233e1897
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
@@ -0,0 +1,59 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\IcuResFileLoader;
15use Symfony\Component\Config\Resource\DirectoryResource;
16
17class IcuResFileLoaderTest extends LocalizedTestCase
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 (!extension_loaded('intl')) {
26 $this->markTestSkipped('This test requires intl extension to work.');
27 }
28 }
29
30 public function testLoad()
31 {
32 // resource is build using genrb command
33 $loader = new IcuResFileLoader();
34 $resource = __DIR__.'/../fixtures/resourcebundle/res';
35 $catalogue = $loader->load($resource, 'en', 'domain1');
36
37 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
38 $this->assertEquals('en', $catalogue->getLocale());
39 $this->assertEquals(array(new DirectoryResource($resource)), $catalogue->getResources());
40 }
41
42 /**
43 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
44 */
45 public function testLoadNonExistingResource()
46 {
47 $loader = new IcuResFileLoader();
48 $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
49 }
50
51 /**
52 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
53 */
54 public function testLoadInvalidResource()
55 {
56 $loader = new IcuResFileLoader();
57 $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted', 'en', 'domain1');
58 }
59}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
new file mode 100644
index 00000000..ae1289d0
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
@@ -0,0 +1,57 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\IniFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class IniFileLoaderTest 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
26 public function testLoad()
27 {
28 $loader = new IniFileLoader();
29 $resource = __DIR__.'/../fixtures/resources.ini';
30 $catalogue = $loader->load($resource, 'en', 'domain1');
31
32 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
33 $this->assertEquals('en', $catalogue->getLocale());
34 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
35 }
36
37 public function testLoadDoesNothingIfEmpty()
38 {
39 $loader = new IniFileLoader();
40 $resource = __DIR__.'/../fixtures/empty.ini';
41 $catalogue = $loader->load($resource, 'en', 'domain1');
42
43 $this->assertEquals(array(), $catalogue->all('domain1'));
44 $this->assertEquals('en', $catalogue->getLocale());
45 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
46 }
47
48 /**
49 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
50 */
51 public function testLoadNonExistingResource()
52 {
53 $loader = new IniFileLoader();
54 $resource = __DIR__.'/../fixtures/non-existing.ini';
55 $loader->load($resource, 'en', 'domain1');
56 }
57}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
new file mode 100644
index 00000000..9d7c5d70
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
@@ -0,0 +1,22 @@
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\Translation\Tests\Loader;
13
14abstract class LocalizedTestCase extends \PHPUnit_Framework_TestCase
15{
16 protected function setUp()
17 {
18 if (!extension_loaded('intl')) {
19 $this->markTestSkipped('The "intl" extension is not available');
20 }
21 }
22}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
new file mode 100644
index 00000000..c2616bda
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
@@ -0,0 +1,67 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\MoFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class MoFileLoaderTest 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
26 public function testLoad()
27 {
28 $loader = new MoFileLoader();
29 $resource = __DIR__.'/../fixtures/resources.mo';
30 $catalogue = $loader->load($resource, 'en', 'domain1');
31
32 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
33 $this->assertEquals('en', $catalogue->getLocale());
34 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
35 }
36
37 public function testLoadPlurals()
38 {
39 $loader = new MoFileLoader();
40 $resource = __DIR__.'/../fixtures/plurals.mo';
41 $catalogue = $loader->load($resource, 'en', 'domain1');
42
43 $this->assertEquals(array('foo' => 'bar', 'foos' => '{0} bar|{1} bars'), $catalogue->all('domain1'));
44 $this->assertEquals('en', $catalogue->getLocale());
45 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
46 }
47
48 /**
49 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
50 */
51 public function testLoadNonExistingResource()
52 {
53 $loader = new MoFileLoader();
54 $resource = __DIR__.'/../fixtures/non-existing.mo';
55 $loader->load($resource, 'en', 'domain1');
56 }
57
58 /**
59 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
60 */
61 public function testLoadInvalidResource()
62 {
63 $loader = new MoFileLoader();
64 $resource = __DIR__.'/../fixtures/empty.mo';
65 $loader->load($resource, 'en', 'domain1');
66 }
67}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
new file mode 100644
index 00000000..5dfe837d
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
@@ -0,0 +1,56 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\PhpFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class PhpFileLoaderTest 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
26 public function testLoad()
27 {
28 $loader = new PhpFileLoader();
29 $resource = __DIR__.'/../fixtures/resources.php';
30 $catalogue = $loader->load($resource, 'en', 'domain1');
31
32 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
33 $this->assertEquals('en', $catalogue->getLocale());
34 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
35 }
36
37 /**
38 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
39 */
40 public function testLoadNonExistingResource()
41 {
42 $loader = new PhpFileLoader();
43 $resource = __DIR__.'/../fixtures/non-existing.php';
44 $loader->load($resource, 'en', 'domain1');
45 }
46
47 /**
48 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
49 */
50 public function testLoadThrowsAnExceptionIfFileNotLocal()
51 {
52 $loader = new PhpFileLoader();
53 $resource = 'http://example.com/resources.php';
54 $loader->load($resource, 'en', 'domain1');
55 }
56}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
new file mode 100644
index 00000000..cd3d85a1
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
@@ -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
12namespace Symfony\Component\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\PoFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class PoFileLoaderTest 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
26 public function testLoad()
27 {
28 $loader = new PoFileLoader();
29 $resource = __DIR__.'/../fixtures/resources.po';
30 $catalogue = $loader->load($resource, 'en', 'domain1');
31
32 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
33 $this->assertEquals('en', $catalogue->getLocale());
34 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
35 }
36
37 public function testLoadPlurals()
38 {
39 $loader = new PoFileLoader();
40 $resource = __DIR__.'/../fixtures/plurals.po';
41 $catalogue = $loader->load($resource, 'en', 'domain1');
42
43 $this->assertEquals(array('foo' => 'bar', 'foos' => 'bar|bars'), $catalogue->all('domain1'));
44 $this->assertEquals('en', $catalogue->getLocale());
45 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
46 }
47
48 public function testLoadDoesNothingIfEmpty()
49 {
50 $loader = new PoFileLoader();
51 $resource = __DIR__.'/../fixtures/empty.po';
52 $catalogue = $loader->load($resource, 'en', 'domain1');
53
54 $this->assertEquals(array(), $catalogue->all('domain1'));
55 $this->assertEquals('en', $catalogue->getLocale());
56 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
57 }
58
59 /**
60 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
61 */
62 public function testLoadNonExistingResource()
63 {
64 $loader = new PoFileLoader();
65 $resource = __DIR__.'/../fixtures/non-existing.po';
66 $loader->load($resource, 'en', 'domain1');
67 }
68
69 public function testLoadEmptyTranslation()
70 {
71 $loader = new PoFileLoader();
72 $resource = __DIR__.'/../fixtures/empty-translation.po';
73 $catalogue = $loader->load($resource, 'en', 'domain1');
74
75 $this->assertEquals(array('foo' => ''), $catalogue->all('domain1'));
76 $this->assertEquals('en', $catalogue->getLocale());
77 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
78 }
79}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
new file mode 100644
index 00000000..c1dd7b10
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
@@ -0,0 +1,66 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\QtFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class QtFileLoaderTest 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
26 public function testLoad()
27 {
28 $loader = new QtFileLoader();
29 $resource = __DIR__.'/../fixtures/resources.ts';
30 $catalogue = $loader->load($resource, 'en', 'resources');
31
32 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('resources'));
33 $this->assertEquals('en', $catalogue->getLocale());
34 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
35 }
36
37 /**
38 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
39 */
40 public function testLoadNonExistingResource()
41 {
42 $loader = new QtFileLoader();
43 $resource = __DIR__.'/../fixtures/non-existing.ts';
44 $loader->load($resource, 'en', 'domain1');
45 }
46
47 /**
48 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
49 */
50 public function testLoadNonLocalResource()
51 {
52 $loader = new QtFileLoader();
53 $resource = 'http://domain1.com/resources.ts';
54 $loader->load($resource, 'en', 'domain1');
55 }
56
57 /**
58 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
59 */
60 public function testLoadInvalidResource()
61 {
62 $loader = new QtFileLoader();
63 $resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf';
64 $loader->load($resource, 'en', 'domain1');
65 }
66}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
new file mode 100644
index 00000000..1d58e0ee
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
@@ -0,0 +1,113 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\XliffFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class XliffFileLoaderTest 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
26 public function testLoad()
27 {
28 $loader = new XliffFileLoader();
29 $resource = __DIR__.'/../fixtures/resources.xlf';
30 $catalogue = $loader->load($resource, 'en', 'domain1');
31
32 $this->assertEquals('en', $catalogue->getLocale());
33 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
34 }
35
36 public function testLoadWithResname()
37 {
38 $loader = new XliffFileLoader();
39 $catalogue = $loader->load(__DIR__.'/../fixtures/resname.xlf', 'en', 'domain1');
40
41 $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'), $catalogue->all('domain1'));
42 }
43
44 public function testIncompleteResource()
45 {
46 $loader = new XliffFileLoader();
47 $catalogue = $loader->load(__DIR__.'/../fixtures/resources.xlf', 'en', 'domain1');
48
49 $this->assertEquals(array('foo' => 'bar', 'key' => '', 'test' => 'with'), $catalogue->all('domain1'));
50 $this->assertFalse($catalogue->has('extra', 'domain1'));
51 }
52
53 public function testEncoding()
54 {
55 if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) {
56 $this->markTestSkipped('The iconv and mbstring extensions are not available.');
57 }
58
59 $loader = new XliffFileLoader();
60 $catalogue = $loader->load(__DIR__.'/../fixtures/encoding.xlf', 'en', 'domain1');
61
62 $this->assertEquals(utf8_decode('föö'), $catalogue->get('bar', 'domain1'));
63 $this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1'));
64 }
65
66 /**
67 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
68 */
69 public function testLoadInvalidResource()
70 {
71 $loader = new XliffFileLoader();
72 $loader->load(__DIR__.'/../fixtures/resources.php', 'en', 'domain1');
73 }
74
75 /**
76 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
77 */
78 public function testLoadResourceDoesNotValidate()
79 {
80 $loader = new XliffFileLoader();
81 $loader->load(__DIR__.'/../fixtures/non-valid.xlf', 'en', 'domain1');
82 }
83
84 /**
85 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
86 */
87 public function testLoadNonExistingResource()
88 {
89 $loader = new XliffFileLoader();
90 $resource = __DIR__.'/../fixtures/non-existing.xlf';
91 $loader->load($resource, 'en', 'domain1');
92 }
93
94 /**
95 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
96 */
97 public function testLoadThrowsAnExceptionIfFileNotLocal()
98 {
99 $loader = new XliffFileLoader();
100 $resource = 'http://example.com/resources.xlf';
101 $loader->load($resource, 'en', 'domain1');
102 }
103
104 /**
105 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
106 * @expectedExceptionMessage Document types are not allowed.
107 */
108 public function testDocTypeIsNotAllowed()
109 {
110 $loader = new XliffFileLoader();
111 $loader->load(__DIR__.'/../fixtures/withdoctype.xlf', 'en', 'domain1');
112 }
113}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
new file mode 100644
index 00000000..511b1279
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
@@ -0,0 +1,81 @@
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\Translation\Tests\Loader;
13
14use Symfony\Component\Translation\Loader\YamlFileLoader;
15use Symfony\Component\Config\Resource\FileResource;
16
17class 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}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
new file mode 100644
index 00000000..aa6f8707
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
@@ -0,0 +1,212 @@
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\Translation\Tests;
13
14use Symfony\Component\Translation\MessageCatalogue;
15
16class MessageCatalogueTest extends \PHPUnit_Framework_TestCase
17{
18 public function testGetLocale()
19 {
20 $catalogue = new MessageCatalogue('en');
21
22 $this->assertEquals('en', $catalogue->getLocale());
23 }
24
25 public function testGetDomains()
26 {
27 $catalogue = new MessageCatalogue('en', array('domain1' => array(), 'domain2' => array()));
28
29 $this->assertEquals(array('domain1', 'domain2'), $catalogue->getDomains());
30 }
31
32 public function testAll()
33 {
34 $catalogue = new MessageCatalogue('en', $messages = array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
35
36 $this->assertEquals(array('foo' => 'foo'), $catalogue->all('domain1'));
37 $this->assertEquals(array(), $catalogue->all('domain88'));
38 $this->assertEquals($messages, $catalogue->all());
39 }
40
41 public function testHas()
42 {
43 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
44
45 $this->assertTrue($catalogue->has('foo', 'domain1'));
46 $this->assertFalse($catalogue->has('bar', 'domain1'));
47 $this->assertFalse($catalogue->has('foo', 'domain88'));
48 }
49
50 public function testGetSet()
51 {
52 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
53 $catalogue->set('foo1', 'foo1', 'domain1');
54
55 $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
56 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
57 }
58
59 public function testAdd()
60 {
61 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
62 $catalogue->add(array('foo1' => 'foo1'), 'domain1');
63
64 $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
65 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
66
67 $catalogue->add(array('foo' => 'bar'), 'domain1');
68 $this->assertEquals('bar', $catalogue->get('foo', 'domain1'));
69 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
70
71 $catalogue->add(array('foo' => 'bar'), 'domain88');
72 $this->assertEquals('bar', $catalogue->get('foo', 'domain88'));
73 }
74
75 public function testReplace()
76 {
77 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
78 $catalogue->replace($messages = array('foo1' => 'foo1'), 'domain1');
79
80 $this->assertEquals($messages, $catalogue->all('domain1'));
81 }
82
83 public function testAddCatalogue()
84 {
85 if (!class_exists('Symfony\Component\Config\Loader\Loader')) {
86 $this->markTestSkipped('The "Config" component is not available');
87 }
88
89 $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
90 $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
91
92 $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
93 $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
94
95 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
96 $catalogue->addResource($r);
97
98 $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo1' => 'foo1')));
99 $catalogue1->addResource($r1);
100
101 $catalogue->addCatalogue($catalogue1);
102
103 $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
104 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
105
106 $this->assertEquals(array($r, $r1), $catalogue->getResources());
107 }
108
109 public function testAddFallbackCatalogue()
110 {
111 if (!class_exists('Symfony\Component\Config\Loader\Loader')) {
112 $this->markTestSkipped('The "Config" component is not available');
113 }
114
115 $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
116 $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
117
118 $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
119 $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
120
121 $catalogue = new MessageCatalogue('en_US', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
122 $catalogue->addResource($r);
123
124 $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo' => 'bar', 'foo1' => 'foo1')));
125 $catalogue1->addResource($r1);
126
127 $catalogue->addFallbackCatalogue($catalogue1);
128
129 $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
130 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
131
132 $this->assertEquals(array($r, $r1), $catalogue->getResources());
133 }
134
135 /**
136 * @expectedException LogicException
137 */
138 public function testAddFallbackCatalogueWithCircularReference()
139 {
140 $main = new MessageCatalogue('en_US');
141 $fallback = new MessageCatalogue('fr_FR');
142
143 $fallback->addFallbackCatalogue($main);
144 $main->addFallbackCatalogue($fallback);
145 }
146
147 /**
148 * @expectedException LogicException
149 */
150 public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne()
151 {
152 $catalogue = new MessageCatalogue('en');
153 $catalogue->addCatalogue(new MessageCatalogue('fr', array()));
154 }
155
156 public function testGetAddResource()
157 {
158 if (!class_exists('Symfony\Component\Config\Loader\Loader')) {
159 $this->markTestSkipped('The "Config" component is not available');
160 }
161
162 $catalogue = new MessageCatalogue('en');
163 $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
164 $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
165 $catalogue->addResource($r);
166 $catalogue->addResource($r);
167 $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
168 $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
169 $catalogue->addResource($r1);
170
171 $this->assertEquals(array($r, $r1), $catalogue->getResources());
172 }
173
174 public function testMetadataDelete()
175 {
176 $catalogue = new MessageCatalogue('en');
177 $this->assertEquals(array(), $catalogue->getMetadata('', ''), 'Metadata is empty');
178 $catalogue->deleteMetadata('key', 'messages');
179 $catalogue->deleteMetadata('', 'messages');
180 $catalogue->deleteMetadata();
181 }
182
183 public function testMetadataSetGetDelete()
184 {
185 $catalogue = new MessageCatalogue('en');
186 $catalogue->setMetadata('key', 'value');
187 $this->assertEquals('value', $catalogue->getMetadata('key', 'messages'), "Metadata 'key' = 'value'");
188
189 $catalogue->setMetadata('key2', array());
190 $this->assertEquals(array(), $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 is array');
191
192 $catalogue->deleteMetadata('key2', 'messages');
193 $this->assertEquals(null, $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 should is deleted.');
194
195 $catalogue->deleteMetadata('key2', 'domain');
196 $this->assertEquals(null, $catalogue->getMetadata('key2', 'domain'), 'Metadata key2 should is deleted.');
197 }
198
199 public function testMetadataMerge()
200 {
201 $cat1 = new MessageCatalogue('en');
202 $cat1->setMetadata('a', 'b');
203 $this->assertEquals(array('messages' => array('a' => 'b')), $cat1->getMetadata('', ''), 'Cat1 contains messages metadata.');
204
205 $cat2 = new MessageCatalogue('en');
206 $cat2->setMetadata('b', 'c', 'domain');
207 $this->assertEquals(array('domain' => array('b' => 'c')), $cat2->getMetadata('', ''), 'Cat2 contains domain metadata.');
208
209 $cat1->addCatalogue($cat2);
210 $this->assertEquals(array('messages' => array('a' => 'b'), 'domain' => array('b' => 'c')), $cat1->getMetadata('', ''), 'Cat1 contains merged metadata.');
211 }
212}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php
new file mode 100644
index 00000000..74956294
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php
@@ -0,0 +1,80 @@
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\Translation\Tests;
13
14use Symfony\Component\Translation\MessageSelector;
15
16class MessageSelectorTest extends \PHPUnit_Framework_TestCase
17{
18 /**
19 * @dataProvider getChooseTests
20 */
21 public function testChoose($expected, $id, $number)
22 {
23 $selector = new MessageSelector();
24
25 $this->assertEquals($expected, $selector->choose($id, $number, 'en'));
26 }
27
28 /**
29 * @expectedException InvalidArgumentException
30 */
31 public function testChooseWhenNoEnoughChoices()
32 {
33 $selector = new MessageSelector();
34
35 $selector->choose('foo', 10, 'en');
36 }
37
38 public function getChooseTests()
39 {
40 return array(
41 array('There is no apples', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', 0),
42 array('There is no apples', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', 0),
43 array('There is no apples', '{0}There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', 0),
44
45 array('There is one apple', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', 1),
46
47 array('There is %count% apples', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', 10),
48 array('There is %count% apples', '{0} There is no apples|{1} There is one apple|]1,Inf]There is %count% apples', 10),
49 array('There is %count% apples', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', 10),
50
51 array('There is %count% apples', 'There is one apple|There is %count% apples', 0),
52 array('There is one apple', 'There is one apple|There is %count% apples', 1),
53 array('There is %count% apples', 'There is one apple|There is %count% apples', 10),
54
55 array('There is %count% apples', 'one: There is one apple|more: There is %count% apples', 0),
56 array('There is one apple', 'one: There is one apple|more: There is %count% apples', 1),
57 array('There is %count% apples', 'one: There is one apple|more: There is %count% apples', 10),
58
59 array('There is no apples', '{0} There is no apples|one: There is one apple|more: There is %count% apples', 0),
60 array('There is one apple', '{0} There is no apples|one: There is one apple|more: There is %count% apples', 1),
61 array('There is %count% apples', '{0} There is no apples|one: There is one apple|more: There is %count% apples', 10),
62
63 array('', '{0}|{1} There is one apple|]1,Inf] There is %count% apples', 0),
64 array('', '{0} There is no apples|{1}|]1,Inf] There is %count% apples', 1),
65
66 // Indexed only tests which are Gettext PoFile* compatible strings.
67 array('There are %count% apples', 'There is one apple|There are %count% apples', 0),
68 array('There is one apple', 'There is one apple|There are %count% apples', 1),
69 array('There are %count% apples', 'There is one apple|There are %count% apples', 2),
70
71 // Tests for float numbers
72 array('There is almost one apple', '{0} There is no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple', 0.7),
73 array('There is one apple', '{0} There is no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1),
74 array('There is more than one apple', '{0} There is no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1.7),
75 array('There is no apples', '{0} There is no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0),
76 array('There is no apples', '{0} There is no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0),
77 array('There is no apples', '{0.0} There is no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0),
78 );
79 }
80}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php
new file mode 100644
index 00000000..26f9e2f9
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php
@@ -0,0 +1,124 @@
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\Translation\Tests;
13
14use Symfony\Component\Translation\PluralizationRules;
15
16/**
17 * Test should cover all languages mentioned on http://translate.sourceforge.net/wiki/l10n/pluralforms
18 * and Plural forms mentioned on http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
19 *
20 * See also https://developer.mozilla.org/en/Localization_and_Plurals which mentions 15 rules having a maximum of 6 forms.
21 * The mozilla code is also interesting to check for.
22 *
23 * As mentioned by chx http://drupal.org/node/1273968 we can cover all by testing number from 0 to 199
24 *
25 * The goal to cover all languages is to far fetched so this test case is smaller.
26 *
27 * @author Clemens Tolboom clemens@build2be.nl
28 */
29class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
30{
31
32 /**
33 * We test failed langcode here.
34 *
35 * TODO: The languages mentioned in the data provide need to get fixed somehow within PluralizationRules.
36 *
37 * @dataProvider failingLangcodes
38 */
39 public function testFailedLangcodes($nplural, $langCodes)
40 {
41 $matrix = $this->generateTestData($nplural, $langCodes);
42 $this->validateMatrix($nplural, $matrix, false);
43 }
44
45 /**
46 * @dataProvider successLangcodes
47 */
48 public function testLangcodes($nplural, $langCodes)
49 {
50 $matrix = $this->generateTestData($nplural, $langCodes);
51 $this->validateMatrix($nplural, $matrix);
52 }
53
54 /**
55 * This array should contain all currently known langcodes.
56 *
57 * As it is impossible to have this ever complete we should try as hard as possible to have it almost complete.
58 *
59 * @return type
60 */
61 public function successLangcodes()
62 {
63 return array(
64 array('1' , array('ay','bo', 'cgg','dz','id', 'ja', 'jbo', 'ka','kk','km','ko','ky')),
65 array('2' , array('nl', 'fr', 'en', 'de', 'de_GE')),
66 array('3' , array('be','bs','cs','hr')),
67 array('4' , array('cy','mt', 'sl')),
68 array('5' , array()),
69 array('6' , array('ar')),
70 );
71 }
72
73 /**
74 * This array should be at least empty within the near future.
75 *
76 * This both depends on a complete list trying to add above as understanding
77 * the plural rules of the current failing languages.
78 *
79 * @return array with nplural together with langcodes
80 */
81 public function failingLangcodes()
82 {
83 return array(
84 array('1' , array('fa')),
85 array('2' , array('jbo')),
86 array('3' , array('cbs')),
87 array('4' , array('gd','kw')),
88 array('5' , array('ga')),
89 array('6' , array()),
90 );
91 }
92
93 /**
94 * We validate only on the plural coverage. Thus the real rules is not tested.
95 *
96 * @param string $nplural plural expected
97 * @param array $matrix containing langcodes and their plural index values.
98 * @param boolean $expectSuccess
99 */
100 protected function validateMatrix($nplural, $matrix, $expectSuccess = true)
101 {
102 foreach ($matrix as $langCode => $data) {
103 $indexes = array_flip($data);
104 if ($expectSuccess) {
105 $this->assertEquals($nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
106 } else {
107 $this->assertNotEquals((int) $nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
108 }
109 }
110 }
111
112 protected function generateTestData($plural, $langCodes)
113 {
114 $matrix = array();
115 foreach ($langCodes as $langCode) {
116 for ($count=0; $count<200; $count++) {
117 $plural = PluralizationRules::get($count, $langCode);
118 $matrix[$langCode][$count] = $plural;
119 }
120 }
121
122 return $matrix;
123 }
124}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php
new file mode 100644
index 00000000..fb843d72
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php
@@ -0,0 +1,306 @@
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\Translation\Tests;
13
14use Symfony\Component\Translation\Translator;
15use Symfony\Component\Translation\MessageSelector;
16use Symfony\Component\Translation\Loader\ArrayLoader;
17
18class TranslatorTest extends \PHPUnit_Framework_TestCase
19{
20 public function testSetGetLocale()
21 {
22 $translator = new Translator('en', new MessageSelector());
23
24 $this->assertEquals('en', $translator->getLocale());
25
26 $translator->setLocale('fr');
27 $this->assertEquals('fr', $translator->getLocale());
28 }
29
30 public function testSetFallbackLocales()
31 {
32 $translator = new Translator('en', new MessageSelector());
33 $translator->addLoader('array', new ArrayLoader());
34 $translator->addResource('array', array('foo' => 'foofoo'), 'en');
35 $translator->addResource('array', array('bar' => 'foobar'), 'fr');
36
37 // force catalogue loading
38 $translator->trans('bar');
39
40 $translator->setFallbackLocales(array('fr'));
41 $this->assertEquals('foobar', $translator->trans('bar'));
42 }
43
44 public function testSetFallbackLocalesMultiple()
45 {
46 $translator = new Translator('en', new MessageSelector());
47 $translator->addLoader('array', new ArrayLoader());
48 $translator->addResource('array', array('foo' => 'foo (en)'), 'en');
49 $translator->addResource('array', array('bar' => 'bar (fr)'), 'fr');
50
51 // force catalogue loading
52 $translator->trans('bar');
53
54 $translator->setFallbackLocales(array('fr_FR', 'fr'));
55 $this->assertEquals('bar (fr)', $translator->trans('bar'));
56 }
57
58 public function testTransWithFallbackLocale()
59 {
60 $translator = new Translator('fr_FR', new MessageSelector());
61 $translator->addLoader('array', new ArrayLoader());
62 $translator->addResource('array', array('foo' => 'foofoo'), 'en_US');
63 $translator->addResource('array', array('bar' => 'foobar'), 'en');
64
65 $translator->setFallbackLocales(array('en'));
66
67 $this->assertEquals('foobar', $translator->trans('bar'));
68 }
69
70 public function testAddResourceAfterTrans()
71 {
72 $translator = new Translator('fr', new MessageSelector());
73 $translator->addLoader('array', new ArrayLoader());
74
75 $translator->setFallbackLocale(array('en'));
76
77 $translator->addResource('array', array('foo' => 'foofoo'), 'en');
78 $this->assertEquals('foofoo', $translator->trans('foo'));
79
80 $translator->addResource('array', array('bar' => 'foobar'), 'en');
81 $this->assertEquals('foobar', $translator->trans('bar'));
82 }
83
84 /**
85 * @dataProvider getTransFileTests
86 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
87 */
88 public function testTransWithoutFallbackLocaleFile($format, $loader)
89 {
90 $loaderClass = 'Symfony\\Component\\Translation\\Loader\\'.$loader;
91 $translator = new Translator('en', new MessageSelector());
92 $translator->addLoader($format, new $loaderClass());
93 $translator->addResource($format, __DIR__.'/fixtures/non-existing', 'en');
94 $translator->addResource($format, __DIR__.'/fixtures/resources.'.$format, 'en');
95
96 // force catalogue loading
97 $translator->trans('foo');
98 }
99
100 /**
101 * @dataProvider getTransFileTests
102 */
103 public function testTransWithFallbackLocaleFile($format, $loader)
104 {
105 $loaderClass = 'Symfony\\Component\\Translation\\Loader\\'.$loader;
106 $translator = new Translator('en_GB', new MessageSelector());
107 $translator->addLoader($format, new $loaderClass());
108 $translator->addResource($format, __DIR__.'/fixtures/non-existing', 'en_GB');
109 $translator->addResource($format, __DIR__.'/fixtures/resources.'.$format, 'en', 'resources');
110
111 $this->assertEquals('bar', $translator->trans('foo', array(), 'resources'));
112 }
113
114 public function testTransWithFallbackLocaleBis()
115 {
116 $translator = new Translator('en_US', new MessageSelector());
117 $translator->addLoader('array', new ArrayLoader());
118 $translator->addResource('array', array('foo' => 'foofoo'), 'en_US');
119 $translator->addResource('array', array('bar' => 'foobar'), 'en');
120 $this->assertEquals('foobar', $translator->trans('bar'));
121 }
122
123 public function testTransWithFallbackLocaleTer()
124 {
125 $translator = new Translator('fr_FR', new MessageSelector());
126 $translator->addLoader('array', new ArrayLoader());
127 $translator->addResource('array', array('foo' => 'foo (en_US)'), 'en_US');
128 $translator->addResource('array', array('bar' => 'bar (en)'), 'en');
129
130 $translator->setFallbackLocales(array('en_US', 'en'));
131
132 $this->assertEquals('foo (en_US)', $translator->trans('foo'));
133 $this->assertEquals('bar (en)', $translator->trans('bar'));
134 }
135
136 public function testTransNonExistentWithFallback()
137 {
138 $translator = new Translator('fr', new MessageSelector());
139 $translator->setFallbackLocales(array('en'));
140 $translator->addLoader('array', new ArrayLoader());
141 $this->assertEquals('non-existent', $translator->trans('non-existent'));
142 }
143
144 /**
145 * @expectedException RuntimeException
146 */
147 public function testWhenAResourceHasNoRegisteredLoader()
148 {
149 $translator = new Translator('en', new MessageSelector());
150 $translator->addResource('array', array('foo' => 'foofoo'), 'en');
151
152 $translator->trans('foo');
153 }
154
155 /**
156 * @dataProvider getTransTests
157 */
158 public function testTrans($expected, $id, $translation, $parameters, $locale, $domain)
159 {
160 $translator = new Translator('en', new MessageSelector());
161 $translator->addLoader('array', new ArrayLoader());
162 $translator->addResource('array', array((string) $id => $translation), $locale, $domain);
163
164 $this->assertEquals($expected, $translator->trans($id, $parameters, $domain, $locale));
165 }
166
167 /**
168 * @dataProvider getFlattenedTransTests
169 */
170 public function testFlattenedTrans($expected, $messages, $id)
171 {
172 $translator = new Translator('en', new MessageSelector());
173 $translator->addLoader('array', new ArrayLoader());
174 $translator->addResource('array', $messages, 'fr', '');
175
176 $this->assertEquals($expected, $translator->trans($id, array(), '', 'fr'));
177 }
178
179 /**
180 * @dataProvider getTransChoiceTests
181 */
182 public function testTransChoice($expected, $id, $translation, $number, $parameters, $locale, $domain)
183 {
184 $translator = new Translator('en', new MessageSelector());
185 $translator->addLoader('array', new ArrayLoader());
186 $translator->addResource('array', array((string) $id => $translation), $locale, $domain);
187
188 $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters, $domain, $locale));
189 }
190
191 public function getTransFileTests()
192 {
193 return array(
194 array('csv', 'CsvFileLoader'),
195 array('ini', 'IniFileLoader'),
196 array('mo', 'MoFileLoader'),
197 array('po', 'PoFileLoader'),
198 array('php', 'PhpFileLoader'),
199 array('ts', 'QtFileLoader'),
200 array('xlf', 'XliffFileLoader'),
201 array('yml', 'YamlFileLoader'),
202 );
203 }
204
205 public function getTransTests()
206 {
207 return array(
208 array('Symfony2 est super !', 'Symfony2 is great!', 'Symfony2 est super !', array(), 'fr', ''),
209 array('Symfony2 est awesome !', 'Symfony2 is %what%!', 'Symfony2 est %what% !', array('%what%' => 'awesome'), 'fr', ''),
210 array('Symfony2 est super !', new String('Symfony2 is great!'), 'Symfony2 est super !', array(), 'fr', ''),
211 );
212 }
213
214 public function getFlattenedTransTests()
215 {
216 $messages = array(
217 'symfony2' => array(
218 'is' => array(
219 'great' => 'Symfony2 est super!'
220 )
221 ),
222 'foo' => array(
223 'bar' => array(
224 'baz' => 'Foo Bar Baz'
225 ),
226 'baz' => 'Foo Baz',
227 ),
228 );
229
230 return array(
231 array('Symfony2 est super!', $messages, 'symfony2.is.great'),
232 array('Foo Bar Baz', $messages, 'foo.bar.baz'),
233 array('Foo Baz', $messages, 'foo.baz'),
234 );
235 }
236
237 public function getTransChoiceTests()
238 {
239 return array(
240 array('Il y a 0 pomme', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
241 array('Il y a 1 pomme', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, array('%count%' => 1), 'fr', ''),
242 array('Il y a 10 pommes', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, array('%count%' => 10), 'fr', ''),
243
244 array('Il y a 0 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
245 array('Il y a 1 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 1, array('%count%' => 1), 'fr', ''),
246 array('Il y a 10 pommes', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 10, array('%count%' => 10), 'fr', ''),
247
248 array('Il y a 0 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
249 array('Il y a 1 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1), 'fr', ''),
250 array('Il y a 10 pommes', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10), 'fr', ''),
251
252 array('Il n\'y a aucune pomme', '{0} There is no apple|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
253 array('Il y a 1 pomme', '{0} There is no apple|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1), 'fr', ''),
254 array('Il y a 10 pommes', '{0} There is no apple|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10), 'fr', ''),
255
256 array('Il y a 0 pomme', new String('{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
257 );
258 }
259
260 public function testTransChoiceFallback()
261 {
262 $translator = new Translator('ru', new MessageSelector());
263 $translator->setFallbackLocales(array('en'));
264 $translator->addLoader('array', new ArrayLoader());
265 $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en');
266
267 $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10)));
268 }
269
270 public function testTransChoiceFallbackBis()
271 {
272 $translator = new Translator('ru', new MessageSelector());
273 $translator->setFallbackLocales(array('en_US', 'en'));
274 $translator->addLoader('array', new ArrayLoader());
275 $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en_US');
276
277 $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10)));
278 }
279
280 /**
281 * @expectedException \InvalidArgumentException
282 */
283 public function testTransChoiceFallbackWithNoTranslation()
284 {
285 $translator = new Translator('ru', new MessageSelector());
286 $translator->setFallbackLocales(array('en'));
287 $translator->addLoader('array', new ArrayLoader());
288
289 $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10)));
290 }
291}
292
293class String
294{
295 protected $str;
296
297 public function __construct($str)
298 {
299 $this->str = $str;
300 }
301
302 public function __toString()
303 {
304 return $this->str;
305 }
306}
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.po b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.po
new file mode 100644
index 00000000..ff6f22af
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.po
@@ -0,0 +1,3 @@
1msgid "foo"
2msgstr ""
3
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.csv b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.csv
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.csv
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.ini b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.ini
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.ini
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.mo b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.mo
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.mo
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.po b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.po
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.po
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.yml b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.yml
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/encoding.xlf b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/encoding.xlf
new file mode 100644
index 00000000..6be901bd
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/encoding.xlf
@@ -0,0 +1,15 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="1" resname="foo">
6 <source>foo</source>
7 <target>bär</target>
8 </trans-unit>
9 <trans-unit id="2" resname="bar">
10 <source>bar</source>
11 <target>föö</target>
12 </trans-unit>
13 </body>
14 </file>
15</xliff>
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf
new file mode 100644
index 00000000..7bf6c98b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf
@@ -0,0 +1,23 @@
1<?xml version="1.0" encoding="utf-8"?>
2<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="1">
6 <source>foo</source>
7 <target>bar
8 </trans-unit>
9 <trans-unit id="2">
10 <source>extra</source>
11 </trans-unit>
12 <trans-unit id="3">
13 <source>key</source>
14 <target></target>
15 </trans-unit>
16 <trans-unit id="4">
17 <source>test</source>
18 <target>with</target>
19 <note>note</note>
20 </trans-unit>
21 </body>
22 </file>
23</xliff>
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.xlf b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.xlf
new file mode 100644
index 00000000..734fc97e
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.xlf
@@ -0,0 +1,11 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit>
6 <source>foo</source>
7 <target>bar</target>
8 </trans-unit>
9 </body>
10 </file>
11</xliff>
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.yml b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.yml
new file mode 100644
index 00000000..257cc564
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.yml
@@ -0,0 +1 @@
foo
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.mo b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.mo
new file mode 100644
index 00000000..6445e77b
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.mo
Binary files differ
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.po b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.po
new file mode 100644
index 00000000..439c41ad
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.po
@@ -0,0 +1,5 @@
1msgid "foo"
2msgid_plural "foos"
3msgstr[0] "bar"
4msgstr[1] "bars"
5
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resname.xlf b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resname.xlf
new file mode 100644
index 00000000..2df16af9
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resname.xlf
@@ -0,0 +1,19 @@
1<?xml version="1.0" encoding="utf-8"?>
2<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="1" resname="foo">
6 <source></source>
7 <target>bar</target>
8 </trans-unit>
9 <trans-unit id="2" resname="bar">
10 <source>bar source</source>
11 <target>baz</target>
12 </trans-unit>
13 <trans-unit id="3">
14 <source>baz</source>
15 <target>foo</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/corrupted/resources.dat b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/corrupted/resources.dat
new file mode 100644
index 00000000..391250ca
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/corrupted/resources.dat
@@ -0,0 +1 @@
XXX \ No newline at end of file
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.res b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.res
new file mode 100644
index 00000000..1fc1436d
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.res
Binary files differ
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt
new file mode 100644
index 00000000..c04a4e85
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt
@@ -0,0 +1,3 @@
1en{
2 symfony{"Symfony 2 is great"}
3} \ No newline at end of file
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.res b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.res
new file mode 100644
index 00000000..f5841609
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.res
Binary files differ
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt
new file mode 100644
index 00000000..7e84f67a
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt
@@ -0,0 +1,3 @@
1fr{
2 symfony{"Symfony 2 est génial"}
3} \ No newline at end of file
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/packagelist.txt b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/packagelist.txt
new file mode 100644
index 00000000..c5783ed4
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/packagelist.txt
@@ -0,0 +1,2 @@
1en.res
2fr.res
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/resources.dat b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/resources.dat
new file mode 100644
index 00000000..563b0eae
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/resources.dat
Binary files differ
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/res/en.res b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/res/en.res
new file mode 100644
index 00000000..ad894a92
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/res/en.res
Binary files differ
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources-clean.xlf b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources-clean.xlf
new file mode 100644
index 00000000..464b0792
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources-clean.xlf
@@ -0,0 +1,15 @@
1<?xml version="1.0" encoding="utf-8"?>
2<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="acbd18db4cc2f85cedef654fccc4a4d8" resname="foo">
6 <source>foo</source>
7 <target>bar</target>
8 </trans-unit>
9 <trans-unit id="3c6e0b8a9c15224a8228b9a98ca1531d" resname="key">
10 <source>key</source>
11 <target></target>
12 </trans-unit>
13 </body>
14 </file>
15</xliff>
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.csv b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.csv
new file mode 100644
index 00000000..374b9eb5
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.csv
@@ -0,0 +1,4 @@
1"foo"; "bar"
2#"bar"; "foo"
3"incorrect"; "number"; "columns"; "will"; "be"; "ignored"
4"incorrect" \ No newline at end of file
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ini b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ini
new file mode 100644
index 00000000..4953062e
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ini
@@ -0,0 +1 @@
foo="bar"
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.mo b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.mo
new file mode 100644
index 00000000..0a966025
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.mo
Binary files differ
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.php
new file mode 100644
index 00000000..c2913985
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.php
@@ -0,0 +1,5 @@
1<?php
2
3return array (
4 'foo' => 'bar',
5);
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.po b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.po
new file mode 100644
index 00000000..da0d5f46
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.po
@@ -0,0 +1,2 @@
1msgid "foo"
2msgstr "bar" \ No newline at end of file
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ts b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ts
new file mode 100644
index 00000000..40e18522
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ts
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="utf-8"?>
2<TS>
3 <context>
4 <name>resources</name>
5 <message>
6 <source>foo</source>
7 <translation>bar</translation>
8 </message>
9 </context>
10</TS>
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.xlf b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.xlf
new file mode 100644
index 00000000..b0e59880
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.xlf
@@ -0,0 +1,23 @@
1<?xml version="1.0" encoding="utf-8"?>
2<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="1">
6 <source>foo</source>
7 <target>bar</target>
8 </trans-unit>
9 <trans-unit id="2">
10 <source>extra</source>
11 </trans-unit>
12 <trans-unit id="3">
13 <source>key</source>
14 <target></target>
15 </trans-unit>
16 <trans-unit id="4">
17 <source>test</source>
18 <target>with</target>
19 <note>note</note>
20 </trans-unit>
21 </body>
22 </file>
23</xliff>
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.yml b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.yml
new file mode 100644
index 00000000..20e9ff3f
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.yml
@@ -0,0 +1 @@
foo: bar
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/valid.csv b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/valid.csv
new file mode 100644
index 00000000..59882e5d
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/valid.csv
@@ -0,0 +1,4 @@
1foo;bar
2bar;"foo
3foo"
4"foo;foo";bar
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withdoctype.xlf b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withdoctype.xlf
new file mode 100644
index 00000000..f83e834d
--- /dev/null
+++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withdoctype.xlf
@@ -0,0 +1,12 @@
1<?xml version="1.0"?>
2<!DOCTYPE foo>
3<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
4 <file source-language="en" datatype="plaintext" original="file.ext">
5 <body>
6 <trans-unit id="1">
7 <source>foo</source>
8 <target>bar</target>
9 </trans-unit>
10 </body>
11 </file>
12</xliff>