summaryrefslogtreecommitdiffstats
path: root/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests')
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php73
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php82
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php83
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php33
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php70
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php38
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php32
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php36
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php31
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php32
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php31
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php32
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php41
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php32
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php95
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php48
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php60
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php68
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php55
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php50
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php68
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php22
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php71
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php49
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php96
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php67
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php142
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php70
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php56
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php200
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php98
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php123
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorCacheTest.php231
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php604
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.mobin0 -> 49 bytes
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.po3
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.csv0
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.ini0
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.json0
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.mo0
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.po0
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.xlf0
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.yml0
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/encoding.xlf16
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/escaped-id-plurals.po10
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/escaped-id.po8
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf23
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/malformed.json3
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.xlf11
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.yml1
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.mobin0 -> 74 bytes
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.po5
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resname.xlf19
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/corrupted/resources.dat1
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.resbin0 -> 120 bytes
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt3
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.resbin0 -> 124 bytes
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt3
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/packagelist.txt2
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/resources.datbin0 -> 352 bytes
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/res/en.resbin0 -> 84 bytes
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources-clean.xlf22
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.csv4
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ini1
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.json3
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.mobin0 -> 52 bytes
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.php5
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.po8
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ts10
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.xlf23
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.yml1
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/valid.csv4
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withdoctype.xlf12
-rw-r--r--Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withnote.xlf22
74 files changed, 3142 insertions, 0 deletions
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
new file mode 100644
index 0000000..30c21af
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php
@@ -0,0 +1,73 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Catalogue;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\MessageCatalogueInterface;
+
+abstract class AbstractOperationTest extends \PHPUnit_Framework_TestCase
+{
+ public function testGetEmptyDomains()
+ {
+ $this->assertEquals(
+ array(),
+ $this->createOperation(
+ new MessageCatalogue('en'),
+ new MessageCatalogue('en')
+ )->getDomains()
+ );
+ }
+
+ public function testGetMergedDomains()
+ {
+ $this->assertEquals(
+ array('a', 'b', 'c'),
+ $this->createOperation(
+ new MessageCatalogue('en', array('a' => array(), 'b' => array())),
+ new MessageCatalogue('en', array('b' => array(), 'c' => array()))
+ )->getDomains()
+ );
+ }
+
+ public function testGetMessagesFromUnknownDomain()
+ {
+ $this->setExpectedException('InvalidArgumentException');
+ $this->createOperation(
+ new MessageCatalogue('en'),
+ new MessageCatalogue('en')
+ )->getMessages('domain');
+ }
+
+ public function testGetEmptyMessages()
+ {
+ $this->assertEquals(
+ array(),
+ $this->createOperation(
+ new MessageCatalogue('en', array('a' => array())),
+ new MessageCatalogue('en')
+ )->getMessages('a')
+ );
+ }
+
+ public function testGetEmptyResult()
+ {
+ $this->assertEquals(
+ new MessageCatalogue('en'),
+ $this->createOperation(
+ new MessageCatalogue('en'),
+ new MessageCatalogue('en')
+ )->getResult()
+ );
+ }
+
+ abstract protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target);
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php
new file mode 100644
index 0000000..26bd582
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/DiffOperationTest.php
@@ -0,0 +1,82 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Catalogue;
+
+use Symfony\Component\Translation\Catalogue\DiffOperation;
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\MessageCatalogueInterface;
+
+class DiffOperationTest extends AbstractOperationTest
+{
+ public function testGetMessagesFromSingleDomain()
+ {
+ $operation = $this->createOperation(
+ new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))),
+ new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c')))
+ );
+
+ $this->assertEquals(
+ array('a' => 'old_a', 'c' => 'new_c'),
+ $operation->getMessages('messages')
+ );
+
+ $this->assertEquals(
+ array('c' => 'new_c'),
+ $operation->getNewMessages('messages')
+ );
+
+ $this->assertEquals(
+ array('b' => 'old_b'),
+ $operation->getObsoleteMessages('messages')
+ );
+ }
+
+ public function testGetResultFromSingleDomain()
+ {
+ $this->assertEquals(
+ new MessageCatalogue('en', array(
+ 'messages' => array('a' => 'old_a', 'c' => 'new_c'),
+ )),
+ $this->createOperation(
+ new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))),
+ new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c')))
+ )->getResult()
+ );
+ }
+
+ public function testGetResultWithMetadata()
+ {
+ $leftCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b')));
+ $leftCatalogue->setMetadata('a', 'foo', 'messages');
+ $leftCatalogue->setMetadata('b', 'bar', 'messages');
+ $rightCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'new_b', 'c' => 'new_c')));
+ $rightCatalogue->setMetadata('b', 'baz', 'messages');
+ $rightCatalogue->setMetadata('c', 'qux', 'messages');
+
+ $diffCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'old_b', 'c' => 'new_c')));
+ $diffCatalogue->setMetadata('b', 'bar', 'messages');
+ $diffCatalogue->setMetadata('c', 'qux', 'messages');
+
+ $this->assertEquals(
+ $diffCatalogue,
+ $this->createOperation(
+ $leftCatalogue,
+ $rightCatalogue
+ )->getResult()
+ );
+ }
+
+ protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target)
+ {
+ return new DiffOperation($source, $target);
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php
new file mode 100644
index 0000000..8b51c15
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Catalogue/MergeOperationTest.php
@@ -0,0 +1,83 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Catalogue;
+
+use Symfony\Component\Translation\Catalogue\MergeOperation;
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\MessageCatalogueInterface;
+
+class MergeOperationTest extends AbstractOperationTest
+{
+ public function testGetMessagesFromSingleDomain()
+ {
+ $operation = $this->createOperation(
+ new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))),
+ new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c')))
+ );
+
+ $this->assertEquals(
+ array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'),
+ $operation->getMessages('messages')
+ );
+
+ $this->assertEquals(
+ array('c' => 'new_c'),
+ $operation->getNewMessages('messages')
+ );
+
+ $this->assertEquals(
+ array(),
+ $operation->getObsoleteMessages('messages')
+ );
+ }
+
+ public function testGetResultFromSingleDomain()
+ {
+ $this->assertEquals(
+ new MessageCatalogue('en', array(
+ 'messages' => array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'),
+ )),
+ $this->createOperation(
+ new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))),
+ new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c')))
+ )->getResult()
+ );
+ }
+
+ public function testGetResultWithMetadata()
+ {
+ $leftCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b')));
+ $leftCatalogue->setMetadata('a', 'foo', 'messages');
+ $leftCatalogue->setMetadata('b', 'bar', 'messages');
+ $rightCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'new_b', 'c' => 'new_c')));
+ $rightCatalogue->setMetadata('b', 'baz', 'messages');
+ $rightCatalogue->setMetadata('c', 'qux', 'messages');
+
+ $mergedCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c')));
+ $mergedCatalogue->setMetadata('a', 'foo', 'messages');
+ $mergedCatalogue->setMetadata('b', 'bar', 'messages');
+ $mergedCatalogue->setMetadata('c', 'qux', 'messages');
+
+ $this->assertEquals(
+ $mergedCatalogue,
+ $this->createOperation(
+ $leftCatalogue,
+ $rightCatalogue
+ )->getResult()
+ );
+ }
+
+ protected function createOperation(MessageCatalogueInterface $source, MessageCatalogueInterface $target)
+ {
+ return new MergeOperation($source, $target);
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php
new file mode 100644
index 0000000..29177ff
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/CsvFileDumperTest.php
@@ -0,0 +1,33 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\CsvFileDumper;
+
+class CsvFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar', 'bar' => 'foo
+foo', 'foo;foo' => 'bar'));
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new CsvFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/valid.csv'), file_get_contents($tempDir.'/messages.en.csv'));
+
+ unlink($tempDir.'/messages.en.csv');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php
new file mode 100644
index 0000000..9682089
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php
@@ -0,0 +1,70 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\FileDumper;
+
+class FileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDumpBackupsFileIfExisting()
+ {
+ $tempDir = sys_get_temp_dir();
+ $file = $tempDir.'/messages.en.concrete';
+ $backupFile = $file.'~';
+
+ @touch($file);
+
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $dumper = new ConcreteFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertTrue(file_exists($backupFile));
+
+ @unlink($file);
+ @unlink($backupFile);
+ }
+
+ public function testDumpCreatesNestedDirectoriesAndFile()
+ {
+ $tempDir = sys_get_temp_dir();
+ $translationsDir = $tempDir.'/test/translations';
+ $file = $translationsDir.'/messages.en.concrete';
+
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $dumper = new ConcreteFileDumper();
+ $dumper->setRelativePathTemplate('test/translations/%domain%.%locale%.%extension%');
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertTrue(file_exists($file));
+
+ @unlink($file);
+ @rmdir($translationsDir);
+ }
+}
+
+class ConcreteFileDumper extends FileDumper
+{
+ protected function format(MessageCatalogue $messages, $domain)
+ {
+ return '';
+ }
+
+ protected function getExtension()
+ {
+ return 'concrete';
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php
new file mode 100644
index 0000000..7be7dfb
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IcuResFileDumperTest.php
@@ -0,0 +1,38 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\IcuResFileDumper;
+
+class IcuResFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ if (!function_exists('mb_convert_encoding')) {
+ $this->markTestSkipped('This test requires mbstring to work.');
+ }
+
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $tempDir = sys_get_temp_dir().'/IcuResFileDumperTest';
+ $dumper = new IcuResFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resourcebundle/res/en.res'), file_get_contents($tempDir.'/messages/en.res'));
+
+ @unlink($tempDir.'/messages/en.res');
+ @rmdir($tempDir.'/messages');
+ @rmdir($tempDir);
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php
new file mode 100644
index 0000000..2a2cefd
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/IniFileDumperTest.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\IniFileDumper;
+
+class IniFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new IniFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.ini'), file_get_contents($tempDir.'/messages.en.ini'));
+
+ unlink($tempDir.'/messages.en.ini');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php
new file mode 100644
index 0000000..697cd93
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php
@@ -0,0 +1,36 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\JsonFileDumper;
+
+class JsonFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ if (PHP_VERSION_ID < 50400) {
+ $this->markTestIncomplete('PHP below 5.4 doesn\'t support JSON pretty printing');
+ }
+
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new JsonFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.json'), file_get_contents($tempDir.'/messages.en.json'));
+
+ unlink($tempDir.'/messages.en.json');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php
new file mode 100644
index 0000000..439a25c
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/MoFileDumperTest.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\MoFileDumper;
+
+class MoFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new MoFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.mo'), file_get_contents($tempDir.'/messages.en.mo'));
+
+ unlink($tempDir.'/messages.en.mo');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php
new file mode 100644
index 0000000..18be5a0
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PhpFileDumperTest.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\PhpFileDumper;
+
+class PhpFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new PhpFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.php'), file_get_contents($tempDir.'/messages.en.php'));
+
+ unlink($tempDir.'/messages.en.php');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php
new file mode 100644
index 0000000..0296d6b
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/PoFileDumperTest.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\PoFileDumper;
+
+class PoFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new PoFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.po'), file_get_contents($tempDir.'/messages.en.po'));
+
+ unlink($tempDir.'/messages.en.po');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php
new file mode 100644
index 0000000..d7d8fb7
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/QtFileDumperTest.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\QtFileDumper;
+
+class QtFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'), 'resources');
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new QtFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.ts'), file_get_contents($tempDir.'/resources.en.ts'));
+
+ unlink($tempDir.'/resources.en.ts');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php
new file mode 100644
index 0000000..dff2cc4
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/XliffFileDumperTest.php
@@ -0,0 +1,41 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\XliffFileDumper;
+
+class XliffFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ $catalogue = new MessageCatalogue('en_US');
+ $catalogue->add(array(
+ 'foo' => 'bar',
+ 'key' => '',
+ 'key.with.cdata' => '<source> & <target>',
+ ));
+ $catalogue->setMetadata('foo', array('notes' => array(array('priority' => 1, 'from' => 'bar', 'content' => 'baz'))));
+ $catalogue->setMetadata('key', array('notes' => array(array('content' => 'baz'), array('content' => 'qux'))));
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new XliffFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir, 'default_locale' => 'fr_FR'));
+
+ $this->assertEquals(
+ file_get_contents(__DIR__.'/../fixtures/resources-clean.xlf'),
+ file_get_contents($tempDir.'/messages.en_US.xlf')
+ );
+
+ unlink($tempDir.'/messages.en_US.xlf');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php
new file mode 100644
index 0000000..3c68ade
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Dumper/YamlFileDumperTest.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Dumper;
+
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\Dumper\YamlFileDumper;
+
+class YamlFileDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDump()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->add(array('foo' => 'bar'));
+
+ $tempDir = sys_get_temp_dir();
+ $dumper = new YamlFileDumper();
+ $dumper->dump($catalogue, array('path' => $tempDir));
+
+ $this->assertEquals(file_get_contents(__DIR__.'/../fixtures/resources.yml'), file_get_contents($tempDir.'/messages.en.yml'));
+
+ unlink($tempDir.'/messages.en.yml');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
new file mode 100644
index 0000000..352dd31
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php
@@ -0,0 +1,95 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests;
+
+use Symfony\Component\Intl\Util\IntlTestHelper;
+use Symfony\Component\Translation\IdentityTranslator;
+
+class IdentityTranslatorTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider getTransTests
+ */
+ public function testTrans($expected, $id, $parameters)
+ {
+ $translator = new IdentityTranslator();
+
+ $this->assertEquals($expected, $translator->trans($id, $parameters));
+ }
+
+ /**
+ * @dataProvider getTransChoiceTests
+ */
+ public function testTransChoiceWithExplicitLocale($expected, $id, $number, $parameters)
+ {
+ $translator = new IdentityTranslator();
+ $translator->setLocale('en');
+
+ $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters));
+ }
+
+ /**
+ * @dataProvider getTransChoiceTests
+ */
+ public function testTransChoiceWithDefaultLocale($expected, $id, $number, $parameters)
+ {
+ \Locale::setDefault('en');
+
+ $translator = new IdentityTranslator();
+
+ $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters));
+ }
+
+ public function testGetSetLocale()
+ {
+ $translator = new IdentityTranslator();
+ $translator->setLocale('en');
+
+ $this->assertEquals('en', $translator->getLocale());
+ }
+
+ public function testGetLocaleReturnsDefaultLocaleIfNotSet()
+ {
+ // in order to test with "pt_BR"
+ IntlTestHelper::requireFullIntl($this);
+
+ $translator = new IdentityTranslator();
+
+ \Locale::setDefault('en');
+ $this->assertEquals('en', $translator->getLocale());
+
+ \Locale::setDefault('pt_BR');
+ $this->assertEquals('pt_BR', $translator->getLocale());
+ }
+
+ public function getTransTests()
+ {
+ return array(
+ array('Symfony is great!', 'Symfony is great!', array()),
+ array('Symfony is awesome!', 'Symfony is %what%!', array('%what%' => 'awesome')),
+ );
+ }
+
+ public function getTransChoiceTests()
+ {
+ return array(
+ array('There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0, array('%count%' => 0)),
+ array('There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1, array('%count%' => 1)),
+ array('There are 10 apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10, array('%count%' => 10)),
+ array('There are 0 apples', 'There is 1 apple|There are %count% apples', 0, array('%count%' => 0)),
+ array('There is 1 apple', 'There is 1 apple|There are %count% apples', 1, array('%count%' => 1)),
+ array('There are 10 apples', 'There is 1 apple|There are %count% apples', 10, array('%count%' => 10)),
+ // custom validation messages may be coded with a fixed value
+ array('There are 2 apples', 'There are 2 apples', 2, array('%count%' => 2)),
+ );
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php
new file mode 100644
index 0000000..075c98b
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/IntervalTest.php
@@ -0,0 +1,48 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests;
+
+use Symfony\Component\Translation\Interval;
+
+class IntervalTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider getTests
+ */
+ public function testTest($expected, $number, $interval)
+ {
+ $this->assertEquals($expected, Interval::test($number, $interval));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testTestException()
+ {
+ Interval::test(1, 'foobar');
+ }
+
+ public function getTests()
+ {
+ return array(
+ array(true, 3, '{1,2, 3 ,4}'),
+ array(false, 10, '{1,2, 3 ,4}'),
+ array(false, 3, '[1,2]'),
+ array(true, 1, '[1,2]'),
+ array(true, 2, '[1,2]'),
+ array(false, 1, ']1,2['),
+ array(false, 2, ']1,2['),
+ array(true, log(0), '[-Inf,2['),
+ array(true, -log(0), '[-2,+Inf]'),
+ );
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
new file mode 100644
index 0000000..463d3b5
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/CsvFileLoaderTest.php
@@ -0,0 +1,60 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\CsvFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class CsvFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testLoad()
+ {
+ $loader = new CsvFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.csv';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ public function testLoadDoesNothingIfEmpty()
+ {
+ $loader = new CsvFileLoader();
+ $resource = __DIR__.'/../fixtures/empty.csv';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array(), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new CsvFileLoader();
+ $resource = __DIR__.'/../fixtures/not-exists.csv';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadNonLocalResource()
+ {
+ $loader = new CsvFileLoader();
+ $resource = 'http://example.com/resources.csv';
+ $loader->load($resource, 'en', 'domain1');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
new file mode 100644
index 0000000..ea9643d
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php
@@ -0,0 +1,68 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\IcuDatFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class IcuDatFileLoaderTest extends LocalizedTestCase
+{
+ protected function setUp()
+ {
+ if (!extension_loaded('intl')) {
+ $this->markTestSkipped('This test requires intl extension to work.');
+ }
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadInvalidResource()
+ {
+ $loader = new IcuDatFileLoader();
+ $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2');
+ }
+
+ public function testDatEnglishLoad()
+ {
+ // bundled resource is build using pkgdata command which at least in ICU 4.2 comes in extremely! buggy form
+ // you must specify an temporary build directory which is not the same as current directory and
+ // MUST reside on the same partition. pkgdata -p resources -T /srv -d.packagelist.txt
+ $loader = new IcuDatFileLoader();
+ $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('symfony' => 'Symfony 2 is great'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources());
+ }
+
+ public function testDatFrenchLoad()
+ {
+ $loader = new IcuDatFileLoader();
+ $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources';
+ $catalogue = $loader->load($resource, 'fr', 'domain1');
+
+ $this->assertEquals(array('symfony' => 'Symfony 2 est génial'), $catalogue->all('domain1'));
+ $this->assertEquals('fr', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new IcuDatFileLoader();
+ $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
new file mode 100644
index 0000000..1a935c0
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuResFileLoaderTest.php
@@ -0,0 +1,55 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\IcuResFileLoader;
+use Symfony\Component\Config\Resource\DirectoryResource;
+
+class IcuResFileLoaderTest extends LocalizedTestCase
+{
+ protected function setUp()
+ {
+ if (!extension_loaded('intl')) {
+ $this->markTestSkipped('This test requires intl extension to work.');
+ }
+ }
+
+ public function testLoad()
+ {
+ // resource is build using genrb command
+ $loader = new IcuResFileLoader();
+ $resource = __DIR__.'/../fixtures/resourcebundle/res';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new DirectoryResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new IcuResFileLoader();
+ $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadInvalidResource()
+ {
+ $loader = new IcuResFileLoader();
+ $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted', 'en', 'domain1');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
new file mode 100644
index 0000000..1a5de0e
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IniFileLoaderTest.php
@@ -0,0 +1,50 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\IniFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class IniFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testLoad()
+ {
+ $loader = new IniFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.ini';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ public function testLoadDoesNothingIfEmpty()
+ {
+ $loader = new IniFileLoader();
+ $resource = __DIR__.'/../fixtures/empty.ini';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array(), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new IniFileLoader();
+ $resource = __DIR__.'/../fixtures/non-existing.ini';
+ $loader->load($resource, 'en', 'domain1');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
new file mode 100644
index 0000000..6d4f353
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php
@@ -0,0 +1,68 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\JsonFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class JsonFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!class_exists('Symfony\Component\Config\Loader\Loader')) {
+ $this->markTestSkipped('The "Config" component is not available');
+ }
+ }
+
+ public function testLoad()
+ {
+ $loader = new JsonFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.json';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ public function testLoadDoesNothingIfEmpty()
+ {
+ $loader = new JsonFileLoader();
+ $resource = __DIR__.'/../fixtures/empty.json';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array(), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new JsonFileLoader();
+ $resource = __DIR__.'/../fixtures/non-existing.json';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ * @expectedExceptionMessage Error parsing JSON - Syntax error, malformed JSON
+ */
+ public function testParseException()
+ {
+ $loader = new JsonFileLoader();
+ $resource = __DIR__.'/../fixtures/malformed.json';
+ $loader->load($resource, 'en', 'domain1');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
new file mode 100644
index 0000000..9d7c5d7
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/LocalizedTestCase.php
@@ -0,0 +1,22 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+abstract class LocalizedTestCase extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!extension_loaded('intl')) {
+ $this->markTestSkipped('The "intl" extension is not available');
+ }
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
new file mode 100644
index 0000000..34078d0
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php
@@ -0,0 +1,71 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\MoFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class MoFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testLoad()
+ {
+ $loader = new MoFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.mo';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ public function testLoadPlurals()
+ {
+ $loader = new MoFileLoader();
+ $resource = __DIR__.'/../fixtures/plurals.mo';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar', 'foos' => '{0} bar|{1} bars'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new MoFileLoader();
+ $resource = __DIR__.'/../fixtures/non-existing.mo';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadInvalidResource()
+ {
+ $loader = new MoFileLoader();
+ $resource = __DIR__.'/../fixtures/empty.mo';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ public function testLoadEmptyTranslation()
+ {
+ $loader = new MoFileLoader();
+ $resource = __DIR__.'/../fixtures/empty-translation.mo';
+ $catalogue = $loader->load($resource, 'en', 'message');
+
+ $this->assertEquals(array(), $catalogue->all('message'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
new file mode 100644
index 0000000..0816b0f
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PhpFileLoaderTest.php
@@ -0,0 +1,49 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\PhpFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testLoad()
+ {
+ $loader = new PhpFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.php';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new PhpFileLoader();
+ $resource = __DIR__.'/../fixtures/non-existing.php';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadThrowsAnExceptionIfFileNotLocal()
+ {
+ $loader = new PhpFileLoader();
+ $resource = 'http://example.com/resources.php';
+ $loader->load($resource, 'en', 'domain1');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
new file mode 100644
index 0000000..87090eb
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php
@@ -0,0 +1,96 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\PoFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class PoFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testLoad()
+ {
+ $loader = new PoFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.po';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ public function testLoadPlurals()
+ {
+ $loader = new PoFileLoader();
+ $resource = __DIR__.'/../fixtures/plurals.po';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar', 'foos' => 'bar|bars'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ public function testLoadDoesNothingIfEmpty()
+ {
+ $loader = new PoFileLoader();
+ $resource = __DIR__.'/../fixtures/empty.po';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array(), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new PoFileLoader();
+ $resource = __DIR__.'/../fixtures/non-existing.po';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ public function testLoadEmptyTranslation()
+ {
+ $loader = new PoFileLoader();
+ $resource = __DIR__.'/../fixtures/empty-translation.po';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => ''), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ public function testEscapedId()
+ {
+ $loader = new PoFileLoader();
+ $resource = __DIR__.'/../fixtures/escaped-id.po';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $messages = $catalogue->all('domain1');
+ $this->assertArrayHasKey('escaped "foo"', $messages);
+ $this->assertEquals('escaped "bar"', $messages['escaped "foo"']);
+ }
+
+ public function testEscapedIdPlurals()
+ {
+ $loader = new PoFileLoader();
+ $resource = __DIR__.'/../fixtures/escaped-id-plurals.po';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $messages = $catalogue->all('domain1');
+ $this->assertArrayHasKey('escaped "foo"', $messages);
+ $this->assertArrayHasKey('escaped "foos"', $messages);
+ $this->assertEquals('escaped "bar"', $messages['escaped "foo"']);
+ $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foos"']);
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
new file mode 100644
index 0000000..3aca86a
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php
@@ -0,0 +1,67 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\QtFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class QtFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testLoad()
+ {
+ $loader = new QtFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.ts';
+ $catalogue = $loader->load($resource, 'en', 'resources');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('resources'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new QtFileLoader();
+ $resource = __DIR__.'/../fixtures/non-existing.ts';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadNonLocalResource()
+ {
+ $loader = new QtFileLoader();
+ $resource = 'http://domain1.com/resources.ts';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadInvalidResource()
+ {
+ $loader = new QtFileLoader();
+ $resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ public function testLoadEmptyResource()
+ {
+ $loader = new QtFileLoader();
+ $resource = __DIR__.'/../fixtures/empty.xlf';
+ $this->setExpectedException('Symfony\Component\Translation\Exception\InvalidResourceException', sprintf('Unable to load "%s".', $resource));
+ $loader->load($resource, 'en', 'domain1');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
new file mode 100644
index 0000000..c3d65b4
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
@@ -0,0 +1,142 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\XliffFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class XliffFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testLoad()
+ {
+ $loader = new XliffFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.xlf';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ $this->assertSame(array(), libxml_get_errors());
+ }
+
+ public function testLoadWithInternalErrorsEnabled()
+ {
+ libxml_use_internal_errors(true);
+
+ $this->assertSame(array(), libxml_get_errors());
+
+ $loader = new XliffFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.xlf';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ $this->assertSame(array(), libxml_get_errors());
+ }
+
+ public function testLoadWithResname()
+ {
+ $loader = new XliffFileLoader();
+ $catalogue = $loader->load(__DIR__.'/../fixtures/resname.xlf', 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'), $catalogue->all('domain1'));
+ }
+
+ public function testIncompleteResource()
+ {
+ $loader = new XliffFileLoader();
+ $catalogue = $loader->load(__DIR__.'/../fixtures/resources.xlf', 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar', 'key' => '', 'test' => 'with'), $catalogue->all('domain1'));
+ $this->assertFalse($catalogue->has('extra', 'domain1'));
+ }
+
+ public function testEncoding()
+ {
+ if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) {
+ $this->markTestSkipped('The iconv and mbstring extensions are not available.');
+ }
+
+ $loader = new XliffFileLoader();
+ $catalogue = $loader->load(__DIR__.'/../fixtures/encoding.xlf', 'en', 'domain1');
+
+ $this->assertEquals(utf8_decode('föö'), $catalogue->get('bar', 'domain1'));
+ $this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1'));
+ $this->assertEquals(array('notes' => array(array('content' => utf8_decode('bäz')))), $catalogue->getMetadata('foo', 'domain1'));
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadInvalidResource()
+ {
+ $loader = new XliffFileLoader();
+ $loader->load(__DIR__.'/../fixtures/resources.php', 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadResourceDoesNotValidate()
+ {
+ $loader = new XliffFileLoader();
+ $loader->load(__DIR__.'/../fixtures/non-valid.xlf', 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new XliffFileLoader();
+ $resource = __DIR__.'/../fixtures/non-existing.xlf';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadThrowsAnExceptionIfFileNotLocal()
+ {
+ $loader = new XliffFileLoader();
+ $resource = 'http://example.com/resources.xlf';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ * @expectedExceptionMessage Document types are not allowed.
+ */
+ public function testDocTypeIsNotAllowed()
+ {
+ $loader = new XliffFileLoader();
+ $loader->load(__DIR__.'/../fixtures/withdoctype.xlf', 'en', 'domain1');
+ }
+
+ public function testParseEmptyFile()
+ {
+ $loader = new XliffFileLoader();
+ $resource = __DIR__.'/../fixtures/empty.xlf';
+ $this->setExpectedException('Symfony\Component\Translation\Exception\InvalidResourceException', sprintf('Unable to load "%s":', $resource));
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ public function testLoadNotes()
+ {
+ $loader = new XliffFileLoader();
+ $catalogue = $loader->load(__DIR__.'/../fixtures/withnote.xlf', 'en', 'domain1');
+
+ $this->assertEquals(array('notes' => array(array('priority' => 1, 'content' => 'foo'))), $catalogue->getMetadata('foo', 'domain1'));
+ // message without target
+ $this->assertNull($catalogue->getMetadata('extra', 'domain1'));
+ $this->assertEquals(array('notes' => array(array('content' => 'baz'), array('priority' => 2, 'from' => 'bar', 'content' => 'qux'))), $catalogue->getMetadata('key', 'domain1'));
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
new file mode 100644
index 0000000..00f7163
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/YamlFileLoaderTest.php
@@ -0,0 +1,70 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests\Loader;
+
+use Symfony\Component\Translation\Loader\YamlFileLoader;
+use Symfony\Component\Config\Resource\FileResource;
+
+class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testLoad()
+ {
+ $loader = new YamlFileLoader();
+ $resource = __DIR__.'/../fixtures/resources.yml';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ public function testLoadDoesNothingIfEmpty()
+ {
+ $loader = new YamlFileLoader();
+ $resource = __DIR__.'/../fixtures/empty.yml';
+ $catalogue = $loader->load($resource, 'en', 'domain1');
+
+ $this->assertEquals(array(), $catalogue->all('domain1'));
+ $this->assertEquals('en', $catalogue->getLocale());
+ $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testLoadNonExistingResource()
+ {
+ $loader = new YamlFileLoader();
+ $resource = __DIR__.'/../fixtures/non-existing.yml';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadThrowsAnExceptionIfFileNotLocal()
+ {
+ $loader = new YamlFileLoader();
+ $resource = 'http://example.com/resources.yml';
+ $loader->load($resource, 'en', 'domain1');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
+ */
+ public function testLoadThrowsAnExceptionIfNotAnArray()
+ {
+ $loader = new YamlFileLoader();
+ $resource = __DIR__.'/../fixtures/non-valid.yml';
+ $loader->load($resource, 'en', 'domain1');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php
new file mode 100644
index 0000000..ab98d72
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php
@@ -0,0 +1,56 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests;
+
+use Symfony\Component\Translation\Translator;
+use Symfony\Component\Translation\LoggingTranslator;
+use Symfony\Component\Translation\Loader\ArrayLoader;
+
+class LoggingTranslatorTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!interface_exists('Psr\Log\LoggerInterface')) {
+ $this->markTestSkipped('The "LoggerInterface" is not available');
+ }
+ }
+
+ public function testTransWithNoTranslationIsLogged()
+ {
+ $logger = $this->getMock('Psr\Log\LoggerInterface');
+ $logger->expects($this->exactly(2))
+ ->method('warning')
+ ->with('Translation not found.')
+ ;
+
+ $translator = new Translator('ar');
+ $loggableTranslator = new LoggingTranslator($translator, $logger);
+ $loggableTranslator->transChoice('some_message2', 10, array('%count%' => 10));
+ $loggableTranslator->trans('bar');
+ }
+
+ public function testTransChoiceFallbackIsLogged()
+ {
+ $logger = $this->getMock('Psr\Log\LoggerInterface');
+ $logger->expects($this->once())
+ ->method('debug')
+ ->with('Translation use fallback catalogue.')
+ ;
+
+ $translator = new Translator('ar');
+ $translator->setFallbackLocales(array('en'));
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en');
+ $loggableTranslator = new LoggingTranslator($translator, $logger);
+ $loggableTranslator->transChoice('some_message2', 10, array('%count%' => 10));
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
new file mode 100644
index 0000000..7d95655
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
@@ -0,0 +1,200 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests;
+
+use Symfony\Component\Translation\MessageCatalogue;
+
+class MessageCatalogueTest extends \PHPUnit_Framework_TestCase
+{
+ public function testGetLocale()
+ {
+ $catalogue = new MessageCatalogue('en');
+
+ $this->assertEquals('en', $catalogue->getLocale());
+ }
+
+ public function testGetDomains()
+ {
+ $catalogue = new MessageCatalogue('en', array('domain1' => array(), 'domain2' => array()));
+
+ $this->assertEquals(array('domain1', 'domain2'), $catalogue->getDomains());
+ }
+
+ public function testAll()
+ {
+ $catalogue = new MessageCatalogue('en', $messages = array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
+
+ $this->assertEquals(array('foo' => 'foo'), $catalogue->all('domain1'));
+ $this->assertEquals(array(), $catalogue->all('domain88'));
+ $this->assertEquals($messages, $catalogue->all());
+ }
+
+ public function testHas()
+ {
+ $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
+
+ $this->assertTrue($catalogue->has('foo', 'domain1'));
+ $this->assertFalse($catalogue->has('bar', 'domain1'));
+ $this->assertFalse($catalogue->has('foo', 'domain88'));
+ }
+
+ public function testGetSet()
+ {
+ $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
+ $catalogue->set('foo1', 'foo1', 'domain1');
+
+ $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
+ $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
+ }
+
+ public function testAdd()
+ {
+ $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
+ $catalogue->add(array('foo1' => 'foo1'), 'domain1');
+
+ $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
+ $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
+
+ $catalogue->add(array('foo' => 'bar'), 'domain1');
+ $this->assertEquals('bar', $catalogue->get('foo', 'domain1'));
+ $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
+
+ $catalogue->add(array('foo' => 'bar'), 'domain88');
+ $this->assertEquals('bar', $catalogue->get('foo', 'domain88'));
+ }
+
+ public function testReplace()
+ {
+ $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
+ $catalogue->replace($messages = array('foo1' => 'foo1'), 'domain1');
+
+ $this->assertEquals($messages, $catalogue->all('domain1'));
+ }
+
+ public function testAddCatalogue()
+ {
+ $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
+ $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
+
+ $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
+ $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
+
+ $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
+ $catalogue->addResource($r);
+
+ $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo1' => 'foo1')));
+ $catalogue1->addResource($r1);
+
+ $catalogue->addCatalogue($catalogue1);
+
+ $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
+ $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
+
+ $this->assertEquals(array($r, $r1), $catalogue->getResources());
+ }
+
+ public function testAddFallbackCatalogue()
+ {
+ $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
+ $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
+
+ $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
+ $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
+
+ $catalogue = new MessageCatalogue('en_US', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
+ $catalogue->addResource($r);
+
+ $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo' => 'bar', 'foo1' => 'foo1')));
+ $catalogue1->addResource($r1);
+
+ $catalogue->addFallbackCatalogue($catalogue1);
+
+ $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
+ $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
+
+ $this->assertEquals(array($r, $r1), $catalogue->getResources());
+ }
+
+ /**
+ * @expectedException \LogicException
+ */
+ public function testAddFallbackCatalogueWithCircularReference()
+ {
+ $main = new MessageCatalogue('en_US');
+ $fallback = new MessageCatalogue('fr_FR');
+
+ $fallback->addFallbackCatalogue($main);
+ $main->addFallbackCatalogue($fallback);
+ }
+
+ /**
+ * @expectedException \LogicException
+ */
+ public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->addCatalogue(new MessageCatalogue('fr', array()));
+ }
+
+ public function testGetAddResource()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $r = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
+ $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
+ $catalogue->addResource($r);
+ $catalogue->addResource($r);
+ $r1 = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
+ $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
+ $catalogue->addResource($r1);
+
+ $this->assertEquals(array($r, $r1), $catalogue->getResources());
+ }
+
+ public function testMetadataDelete()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $this->assertEquals(array(), $catalogue->getMetadata('', ''), 'Metadata is empty');
+ $catalogue->deleteMetadata('key', 'messages');
+ $catalogue->deleteMetadata('', 'messages');
+ $catalogue->deleteMetadata();
+ }
+
+ public function testMetadataSetGetDelete()
+ {
+ $catalogue = new MessageCatalogue('en');
+ $catalogue->setMetadata('key', 'value');
+ $this->assertEquals('value', $catalogue->getMetadata('key', 'messages'), "Metadata 'key' = 'value'");
+
+ $catalogue->setMetadata('key2', array());
+ $this->assertEquals(array(), $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 is array');
+
+ $catalogue->deleteMetadata('key2', 'messages');
+ $this->assertEquals(null, $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 should is deleted.');
+
+ $catalogue->deleteMetadata('key2', 'domain');
+ $this->assertEquals(null, $catalogue->getMetadata('key2', 'domain'), 'Metadata key2 should is deleted.');
+ }
+
+ public function testMetadataMerge()
+ {
+ $cat1 = new MessageCatalogue('en');
+ $cat1->setMetadata('a', 'b');
+ $this->assertEquals(array('messages' => array('a' => 'b')), $cat1->getMetadata('', ''), 'Cat1 contains messages metadata.');
+
+ $cat2 = new MessageCatalogue('en');
+ $cat2->setMetadata('b', 'c', 'domain');
+ $this->assertEquals(array('domain' => array('b' => 'c')), $cat2->getMetadata('', ''), 'Cat2 contains domain metadata.');
+
+ $cat1->addCatalogue($cat2);
+ $this->assertEquals(array('messages' => array('a' => 'b'), 'domain' => array('b' => 'c')), $cat1->getMetadata('', ''), 'Cat1 contains merged metadata.');
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php
new file mode 100644
index 0000000..d5a4f3e
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/MessageSelectorTest.php
@@ -0,0 +1,98 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests;
+
+use Symfony\Component\Translation\MessageSelector;
+
+class MessageSelectorTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider getChooseTests
+ */
+ public function testChoose($expected, $id, $number)
+ {
+ $selector = new MessageSelector();
+
+ $this->assertEquals($expected, $selector->choose($id, $number, 'en'));
+ }
+
+ public function testReturnMessageIfExactlyOneStandardRuleIsGiven()
+ {
+ $selector = new MessageSelector();
+
+ $this->assertEquals('There are two apples', $selector->choose('There are two apples', 2, 'en'));
+ }
+
+ /**
+ * @dataProvider getNonMatchingMessages
+ * @expectedException \InvalidArgumentException
+ */
+ public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number)
+ {
+ $selector = new MessageSelector();
+
+ $selector->choose($id, $number, 'en');
+ }
+
+ public function getNonMatchingMessages()
+ {
+ return array(
+ array('{0} There are no apples|{1} There is one apple', 2),
+ array('{1} There is one apple|]1,Inf] There are %count% apples', 0),
+ array('{1} There is one apple|]2,Inf] There are %count% apples', 2),
+ array('{0} There are no apples|There is one apple', 2),
+ );
+ }
+
+ public function getChooseTests()
+ {
+ return array(
+ array('There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0),
+ array('There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0),
+ array('There are no apples', '{0}There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0),
+
+ array('There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1),
+
+ array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10),
+ array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf]There are %count% apples', 10),
+ array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10),
+
+ array('There are %count% apples', 'There is one apple|There are %count% apples', 0),
+ array('There is one apple', 'There is one apple|There are %count% apples', 1),
+ array('There are %count% apples', 'There is one apple|There are %count% apples', 10),
+
+ array('There are %count% apples', 'one: There is one apple|more: There are %count% apples', 0),
+ array('There is one apple', 'one: There is one apple|more: There are %count% apples', 1),
+ array('There are %count% apples', 'one: There is one apple|more: There are %count% apples', 10),
+
+ array('There are no apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 0),
+ array('There is one apple', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 1),
+ array('There are %count% apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 10),
+
+ array('', '{0}|{1} There is one apple|]1,Inf] There are %count% apples', 0),
+ array('', '{0} There are no apples|{1}|]1,Inf] There are %count% apples', 1),
+
+ // Indexed only tests which are Gettext PoFile* compatible strings.
+ array('There are %count% apples', 'There is one apple|There are %count% apples', 0),
+ array('There is one apple', 'There is one apple|There are %count% apples', 1),
+ array('There are %count% apples', 'There is one apple|There are %count% apples', 2),
+
+ // Tests for float numbers
+ array('There is almost one apple', '{0} There are no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple', 0.7),
+ array('There is one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1),
+ array('There is more than one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1.7),
+ array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0),
+ array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0),
+ array('There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0),
+ );
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php
new file mode 100644
index 0000000..1e8ee70
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/PluralizationRulesTest.php
@@ -0,0 +1,123 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests;
+
+use Symfony\Component\Translation\PluralizationRules;
+
+/**
+ * Test should cover all languages mentioned on http://translate.sourceforge.net/wiki/l10n/pluralforms
+ * and Plural forms mentioned on http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms.
+ *
+ * See also https://developer.mozilla.org/en/Localization_and_Plurals which mentions 15 rules having a maximum of 6 forms.
+ * The mozilla code is also interesting to check for.
+ *
+ * As mentioned by chx http://drupal.org/node/1273968 we can cover all by testing number from 0 to 199
+ *
+ * The goal to cover all languages is to far fetched so this test case is smaller.
+ *
+ * @author Clemens Tolboom clemens@build2be.nl
+ */
+class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * We test failed langcode here.
+ *
+ * TODO: The languages mentioned in the data provide need to get fixed somehow within PluralizationRules.
+ *
+ * @dataProvider failingLangcodes
+ */
+ public function testFailedLangcodes($nplural, $langCodes)
+ {
+ $matrix = $this->generateTestData($nplural, $langCodes);
+ $this->validateMatrix($nplural, $matrix, false);
+ }
+
+ /**
+ * @dataProvider successLangcodes
+ */
+ public function testLangcodes($nplural, $langCodes)
+ {
+ $matrix = $this->generateTestData($nplural, $langCodes);
+ $this->validateMatrix($nplural, $matrix);
+ }
+
+ /**
+ * This array should contain all currently known langcodes.
+ *
+ * As it is impossible to have this ever complete we should try as hard as possible to have it almost complete.
+ *
+ * @return array
+ */
+ public function successLangcodes()
+ {
+ return array(
+ array('1', array('ay','bo', 'cgg','dz','id', 'ja', 'jbo', 'ka','kk','km','ko','ky')),
+ array('2', array('nl', 'fr', 'en', 'de', 'de_GE')),
+ array('3', array('be','bs','cs','hr')),
+ array('4', array('cy','mt', 'sl')),
+ array('5', array()),
+ array('6', array('ar')),
+ );
+ }
+
+ /**
+ * This array should be at least empty within the near future.
+ *
+ * This both depends on a complete list trying to add above as understanding
+ * the plural rules of the current failing languages.
+ *
+ * @return array with nplural together with langcodes
+ */
+ public function failingLangcodes()
+ {
+ return array(
+ array('1', array('fa')),
+ array('2', array('jbo')),
+ array('3', array('cbs')),
+ array('4', array('gd','kw')),
+ array('5', array('ga')),
+ array('6', array()),
+ );
+ }
+
+ /**
+ * We validate only on the plural coverage. Thus the real rules is not tested.
+ *
+ * @param string $nplural plural expected
+ * @param array $matrix containing langcodes and their plural index values.
+ * @param bool $expectSuccess
+ */
+ protected function validateMatrix($nplural, $matrix, $expectSuccess = true)
+ {
+ foreach ($matrix as $langCode => $data) {
+ $indexes = array_flip($data);
+ if ($expectSuccess) {
+ $this->assertEquals($nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
+ } else {
+ $this->assertNotEquals((int) $nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
+ }
+ }
+ }
+
+ protected function generateTestData($plural, $langCodes)
+ {
+ $matrix = array();
+ foreach ($langCodes as $langCode) {
+ for ($count = 0; $count < 200; $count++) {
+ $plural = PluralizationRules::get($count, $langCode);
+ $matrix[$langCode][$count] = $plural;
+ }
+ }
+
+ return $matrix;
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
new file mode 100644
index 0000000..8b913f3
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
@@ -0,0 +1,231 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests;
+
+use Symfony\Component\Translation\Translator;
+use Symfony\Component\Translation\MessageCatalogue;
+use Symfony\Component\Translation\MessageSelector;
+
+class TranslatorCacheTest extends \PHPUnit_Framework_TestCase
+{
+ protected $tmpDir;
+
+ protected function setUp()
+ {
+ $this->tmpDir = sys_get_temp_dir().'/sf2_translation';
+ $this->deleteTmpDir();
+ }
+
+ protected function tearDown()
+ {
+ $this->deleteTmpDir();
+ }
+
+ protected function deleteTmpDir()
+ {
+ if (!file_exists($dir = $this->tmpDir)) {
+ return;
+ }
+
+ $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->tmpDir), \RecursiveIteratorIterator::CHILD_FIRST);
+ foreach ($iterator as $path) {
+ if (preg_match('#[/\\\\]\.\.?$#', $path->__toString())) {
+ continue;
+ }
+ if ($path->isDir()) {
+ rmdir($path->__toString());
+ } else {
+ unlink($path->__toString());
+ }
+ }
+ rmdir($this->tmpDir);
+ }
+
+ public function testTransWithoutCaching()
+ {
+ $translator = $this->getTranslator($this->getLoader());
+ $translator->setLocale('fr');
+ $translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR', 'fr.UTF-8', 'sr@latin'));
+
+ $this->assertEquals('foo (FR)', $translator->trans('foo'));
+ $this->assertEquals('bar (EN)', $translator->trans('bar'));
+ $this->assertEquals('foobar (ES)', $translator->trans('foobar'));
+ $this->assertEquals('choice 0 (EN)', $translator->transChoice('choice', 0));
+ $this->assertEquals('no translation', $translator->trans('no translation'));
+ $this->assertEquals('foobarfoo (PT-PT)', $translator->trans('foobarfoo'));
+ $this->assertEquals('other choice 1 (PT-BR)', $translator->transChoice('other choice', 1));
+ $this->assertEquals('foobarbaz (fr.UTF-8)', $translator->trans('foobarbaz'));
+ $this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
+ }
+
+ public function testTransWithCaching()
+ {
+ // prime the cache
+ $translator = $this->getTranslator($this->getLoader(), $this->tmpDir);
+ $translator->setLocale('fr');
+ $translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR', 'fr.UTF-8', 'sr@latin'));
+
+ $this->assertEquals('foo (FR)', $translator->trans('foo'));
+ $this->assertEquals('bar (EN)', $translator->trans('bar'));
+ $this->assertEquals('foobar (ES)', $translator->trans('foobar'));
+ $this->assertEquals('choice 0 (EN)', $translator->transChoice('choice', 0));
+ $this->assertEquals('no translation', $translator->trans('no translation'));
+ $this->assertEquals('foobarfoo (PT-PT)', $translator->trans('foobarfoo'));
+ $this->assertEquals('other choice 1 (PT-BR)', $translator->transChoice('other choice', 1));
+ $this->assertEquals('foobarbaz (fr.UTF-8)', $translator->trans('foobarbaz'));
+ $this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
+
+ // do it another time as the cache is primed now
+ $loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
+ $translator = $this->getTranslator($loader, $this->tmpDir);
+ $translator->setLocale('fr');
+ $translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR', 'fr.UTF-8', 'sr@latin'));
+
+ $this->assertEquals('foo (FR)', $translator->trans('foo'));
+ $this->assertEquals('bar (EN)', $translator->trans('bar'));
+ $this->assertEquals('foobar (ES)', $translator->trans('foobar'));
+ $this->assertEquals('choice 0 (EN)', $translator->transChoice('choice', 0));
+ $this->assertEquals('no translation', $translator->trans('no translation'));
+ $this->assertEquals('foobarfoo (PT-PT)', $translator->trans('foobarfoo'));
+ $this->assertEquals('other choice 1 (PT-BR)', $translator->transChoice('other choice', 1));
+ $this->assertEquals('foobarbaz (fr.UTF-8)', $translator->trans('foobarbaz'));
+ $this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
+ }
+
+ public function testTransWithCachingWithInvalidLocale()
+ {
+ $loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
+ $translator = $this->getTranslator($loader, $this->tmpDir, 'Symfony\Component\Translation\Tests\TranslatorWithInvalidLocale');
+
+ $translator->setLocale('invalid locale');
+
+ try {
+ $translator->trans('foo');
+ $this->fail();
+ } catch (\InvalidArgumentException $e) {
+ $this->assertFalse(file_exists($this->tmpDir.'/catalogue.invalid locale.php'));
+ }
+ }
+
+ public function testLoadCatalogueWithCachingWithInvalidLocale()
+ {
+ $loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
+ $translator = $this->getTranslator($loader, $this->tmpDir, 'Symfony\Component\Translation\Tests\TranslatorWithInvalidLocale');
+
+ try {
+ $translator->proxyLoadCatalogue('invalid locale');
+ $this->fail();
+ } catch (\InvalidArgumentException $e) {
+ $this->assertFalse(file_exists($this->tmpDir.'/catalogue.invalid locale.php'));
+ }
+ }
+
+ protected function getCatalogue($locale, $messages)
+ {
+ $catalogue = new MessageCatalogue($locale);
+ foreach ($messages as $key => $translation) {
+ $catalogue->set($key, $translation);
+ }
+
+ return $catalogue;
+ }
+
+ protected function getLoader()
+ {
+ $loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
+ $loader
+ ->expects($this->at(0))
+ ->method('load')
+ ->will($this->returnValue($this->getCatalogue('fr', array(
+ 'foo' => 'foo (FR)',
+ ))))
+ ;
+ $loader
+ ->expects($this->at(1))
+ ->method('load')
+ ->will($this->returnValue($this->getCatalogue('en', array(
+ 'foo' => 'foo (EN)',
+ 'bar' => 'bar (EN)',
+ 'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)',
+ ))))
+ ;
+ $loader
+ ->expects($this->at(2))
+ ->method('load')
+ ->will($this->returnValue($this->getCatalogue('es', array(
+ 'foobar' => 'foobar (ES)',
+ ))))
+ ;
+ $loader
+ ->expects($this->at(3))
+ ->method('load')
+ ->will($this->returnValue($this->getCatalogue('pt-PT', array(
+ 'foobarfoo' => 'foobarfoo (PT-PT)',
+ ))))
+ ;
+ $loader
+ ->expects($this->at(4))
+ ->method('load')
+ ->will($this->returnValue($this->getCatalogue('pt_BR', array(
+ 'other choice' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR)',
+ ))))
+ ;
+ $loader
+ ->expects($this->at(5))
+ ->method('load')
+ ->will($this->returnValue($this->getCatalogue('fr.UTF-8', array(
+ 'foobarbaz' => 'foobarbaz (fr.UTF-8)',
+ ))))
+ ;
+ $loader
+ ->expects($this->at(6))
+ ->method('load')
+ ->will($this->returnValue($this->getCatalogue('sr@latin', array(
+ 'foobarbax' => 'foobarbax (sr@latin)',
+ ))))
+ ;
+
+ return $loader;
+ }
+
+ public function getTranslator($loader, $cacheDir = null, $translatorClass = '\Symfony\Component\Translation\Translator')
+ {
+ $translator = new $translatorClass('fr', new MessageSelector(), $cacheDir);
+
+ $translator->addLoader('loader', $loader);
+ $translator->addResource('loader', 'foo', 'fr');
+ $translator->addResource('loader', 'foo', 'en');
+ $translator->addResource('loader', 'foo', 'es');
+ $translator->addResource('loader', 'foo', 'pt-PT'); // European Portuguese
+ $translator->addResource('loader', 'foo', 'pt_BR'); // Brazilian Portuguese
+ $translator->addResource('loader', 'foo', 'fr.UTF-8');
+ $translator->addResource('loader', 'foo', 'sr@latin'); // Latin Serbian
+
+ return $translator;
+ }
+}
+
+class TranslatorWithInvalidLocale extends Translator
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function setLocale($locale)
+ {
+ $this->locale = $locale;
+ }
+
+ public function proxyLoadCatalogue($locale)
+ {
+ $this->loadCatalogue($locale);
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php
new file mode 100644
index 0000000..e60d8fa
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/TranslatorTest.php
@@ -0,0 +1,604 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Tests;
+
+use Symfony\Component\Translation\Translator;
+use Symfony\Component\Translation\MessageSelector;
+use Symfony\Component\Translation\Loader\ArrayLoader;
+use Symfony\Component\Translation\MessageCatalogue;
+
+class TranslatorTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider getInvalidLocalesTests
+ * @expectedException \InvalidArgumentException
+ */
+ public function testConstructorInvalidLocale($locale)
+ {
+ $translator = new Translator($locale, new MessageSelector());
+ }
+
+ /**
+ * @dataProvider getValidLocalesTests
+ */
+ public function testConstructorValidLocale($locale)
+ {
+ $translator = new Translator($locale, new MessageSelector());
+
+ $this->assertEquals($locale, $translator->getLocale());
+ }
+
+ public function testConstructorWithoutLocale()
+ {
+ $translator = new Translator(null, new MessageSelector());
+
+ $this->assertNull($translator->getLocale());
+ }
+
+ public function testSetGetLocale()
+ {
+ $translator = new Translator('en');
+
+ $this->assertEquals('en', $translator->getLocale());
+
+ $translator->setLocale('fr');
+ $this->assertEquals('fr', $translator->getLocale());
+ }
+
+ /**
+ * @dataProvider getInvalidLocalesTests
+ * @expectedException \InvalidArgumentException
+ */
+ public function testSetInvalidLocale($locale)
+ {
+ $translator = new Translator('fr', new MessageSelector());
+ $translator->setLocale($locale);
+ }
+
+ /**
+ * @dataProvider getValidLocalesTests
+ */
+ public function testSetValidLocale($locale)
+ {
+ $translator = new Translator($locale, new MessageSelector());
+ $translator->setLocale($locale);
+
+ $this->assertEquals($locale, $translator->getLocale());
+ }
+
+ public function testGetCatalogue()
+ {
+ $translator = new Translator('en');
+
+ $this->assertEquals(new MessageCatalogue('en'), $translator->getCatalogue());
+
+ $translator->setLocale('fr');
+ $this->assertEquals(new MessageCatalogue('fr'), $translator->getCatalogue('fr'));
+ }
+
+ public function testSetFallbackLocales()
+ {
+ $translator = new Translator('en');
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en');
+ $translator->addResource('array', array('bar' => 'foobar'), 'fr');
+
+ // force catalogue loading
+ $translator->trans('bar');
+
+ $translator->setFallbackLocales(array('fr'));
+ $this->assertEquals('foobar', $translator->trans('bar'));
+ }
+
+ public function testSetFallbackLocalesMultiple()
+ {
+ $translator = new Translator('en');
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foo (en)'), 'en');
+ $translator->addResource('array', array('bar' => 'bar (fr)'), 'fr');
+
+ // force catalogue loading
+ $translator->trans('bar');
+
+ $translator->setFallbackLocales(array('fr_FR', 'fr'));
+ $this->assertEquals('bar (fr)', $translator->trans('bar'));
+ }
+
+ /**
+ * @dataProvider getInvalidLocalesTests
+ * @expectedException \InvalidArgumentException
+ */
+ public function testSetFallbackInvalidLocales($locale)
+ {
+ $translator = new Translator('fr', new MessageSelector());
+ $translator->setFallbackLocales(array('fr', $locale));
+ }
+
+ /**
+ * @dataProvider getValidLocalesTests
+ */
+ public function testSetFallbackValidLocales($locale)
+ {
+ $translator = new Translator($locale, new MessageSelector());
+ $translator->setFallbackLocales(array('fr', $locale));
+ // no assertion. this method just asserts that no exception is thrown
+ }
+
+ public function testTransWithFallbackLocale()
+ {
+ $translator = new Translator('fr_FR');
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en_US');
+ $translator->addResource('array', array('bar' => 'foobar'), 'en');
+
+ $translator->setFallbackLocales(array('en'));
+
+ $this->assertEquals('foobar', $translator->trans('bar'));
+ }
+
+ /**
+ * @dataProvider getInvalidLocalesTests
+ * @expectedException \InvalidArgumentException
+ */
+ public function testAddResourceInvalidLocales($locale)
+ {
+ $translator = new Translator('fr', new MessageSelector());
+ $translator->addResource('array', array('foo' => 'foofoo'), $locale);
+ }
+
+ /**
+ * @dataProvider getValidLocalesTests
+ */
+ public function testAddResourceValidLocales($locale)
+ {
+ $translator = new Translator('fr', new MessageSelector());
+ $translator->addResource('array', array('foo' => 'foofoo'), $locale);
+ // no assertion. this method just asserts that no exception is thrown
+ }
+
+ public function testAddResourceAfterTrans()
+ {
+ $translator = new Translator('fr');
+ $translator->addLoader('array', new ArrayLoader());
+
+ $translator->setFallbackLocales(array('en'));
+
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en');
+ $this->assertEquals('foofoo', $translator->trans('foo'));
+
+ $translator->addResource('array', array('bar' => 'foobar'), 'en');
+ $this->assertEquals('foobar', $translator->trans('bar'));
+ }
+
+ /**
+ * @dataProvider getTransFileTests
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
+ */
+ public function testTransWithoutFallbackLocaleFile($format, $loader)
+ {
+ $loaderClass = 'Symfony\\Component\\Translation\\Loader\\'.$loader;
+ $translator = new Translator('en');
+ $translator->addLoader($format, new $loaderClass());
+ $translator->addResource($format, __DIR__.'/fixtures/non-existing', 'en');
+ $translator->addResource($format, __DIR__.'/fixtures/resources.'.$format, 'en');
+
+ // force catalogue loading
+ $translator->trans('foo');
+ }
+
+ /**
+ * @dataProvider getTransFileTests
+ */
+ public function testTransWithFallbackLocaleFile($format, $loader)
+ {
+ $loaderClass = 'Symfony\\Component\\Translation\\Loader\\'.$loader;
+ $translator = new Translator('en_GB');
+ $translator->addLoader($format, new $loaderClass());
+ $translator->addResource($format, __DIR__.'/fixtures/non-existing', 'en_GB');
+ $translator->addResource($format, __DIR__.'/fixtures/resources.'.$format, 'en', 'resources');
+
+ $this->assertEquals('bar', $translator->trans('foo', array(), 'resources'));
+ }
+
+ public function testTransWithFallbackLocaleBis()
+ {
+ $translator = new Translator('en_US');
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en_US');
+ $translator->addResource('array', array('bar' => 'foobar'), 'en');
+ $this->assertEquals('foobar', $translator->trans('bar'));
+ }
+
+ public function testTransWithFallbackLocaleTer()
+ {
+ $translator = new Translator('fr_FR');
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foo (en_US)'), 'en_US');
+ $translator->addResource('array', array('bar' => 'bar (en)'), 'en');
+
+ $translator->setFallbackLocales(array('en_US', 'en'));
+
+ $this->assertEquals('foo (en_US)', $translator->trans('foo'));
+ $this->assertEquals('bar (en)', $translator->trans('bar'));
+ }
+
+ public function testTransNonExistentWithFallback()
+ {
+ $translator = new Translator('fr');
+ $translator->setFallbackLocales(array('en'));
+ $translator->addLoader('array', new ArrayLoader());
+ $this->assertEquals('non-existent', $translator->trans('non-existent'));
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ */
+ public function testWhenAResourceHasNoRegisteredLoader()
+ {
+ $translator = new Translator('en');
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en');
+
+ $translator->trans('foo');
+ }
+
+ /**
+ * @dataProvider getTransTests
+ */
+ public function testTrans($expected, $id, $translation, $parameters, $locale, $domain)
+ {
+ $translator = new Translator('en');
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array((string) $id => $translation), $locale, $domain);
+
+ $this->assertEquals($expected, $translator->trans($id, $parameters, $domain, $locale));
+ }
+
+ /**
+ * @dataProvider getInvalidLocalesTests
+ * @expectedException \InvalidArgumentException
+ */
+ public function testTransInvalidLocale($locale)
+ {
+ $translator = new Translator('en', new MessageSelector());
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en');
+
+ $translator->trans('foo', array(), '', $locale);
+ }
+
+ /**
+ * @dataProvider getValidLocalesTests
+ */
+ public function testTransValidLocale($locale)
+ {
+ $translator = new Translator('en', new MessageSelector());
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en');
+
+ $translator->trans('foo', array(), '', $locale);
+ // no assertion. this method just asserts that no exception is thrown
+ }
+
+ /**
+ * @dataProvider getFlattenedTransTests
+ */
+ public function testFlattenedTrans($expected, $messages, $id)
+ {
+ $translator = new Translator('en');
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', $messages, 'fr', '');
+
+ $this->assertEquals($expected, $translator->trans($id, array(), '', 'fr'));
+ }
+
+ /**
+ * @dataProvider getTransChoiceTests
+ */
+ public function testTransChoice($expected, $id, $translation, $number, $parameters, $locale, $domain)
+ {
+ $translator = new Translator('en');
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array((string) $id => $translation), $locale, $domain);
+
+ $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters, $domain, $locale));
+ }
+
+ /**
+ * @dataProvider getInvalidLocalesTests
+ * @expectedException \InvalidArgumentException
+ */
+ public function testTransChoiceInvalidLocale($locale)
+ {
+ $translator = new Translator('en', new MessageSelector());
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en');
+
+ $translator->transChoice('foo', 1, array(), '', $locale);
+ }
+
+ /**
+ * @dataProvider getValidLocalesTests
+ */
+ public function testTransChoiceValidLocale($locale)
+ {
+ $translator = new Translator('en', new MessageSelector());
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('foo' => 'foofoo'), 'en');
+
+ $translator->transChoice('foo', 1, array(), '', $locale);
+ // no assertion. this method just asserts that no exception is thrown
+ }
+
+ public function getTransFileTests()
+ {
+ return array(
+ array('csv', 'CsvFileLoader'),
+ array('ini', 'IniFileLoader'),
+ array('mo', 'MoFileLoader'),
+ array('po', 'PoFileLoader'),
+ array('php', 'PhpFileLoader'),
+ array('ts', 'QtFileLoader'),
+ array('xlf', 'XliffFileLoader'),
+ array('yml', 'YamlFileLoader'),
+ array('json', 'JsonFileLoader'),
+ );
+ }
+
+ public function getTransTests()
+ {
+ return array(
+ array('Symfony est super !', 'Symfony is great!', 'Symfony est super !', array(), 'fr', ''),
+ array('Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', array('%what%' => 'awesome'), 'fr', ''),
+ array('Symfony est super !', new StringClass('Symfony is great!'), 'Symfony est super !', array(), 'fr', ''),
+ );
+ }
+
+ public function getFlattenedTransTests()
+ {
+ $messages = array(
+ 'symfony' => array(
+ 'is' => array(
+ 'great' => 'Symfony est super!',
+ ),
+ ),
+ 'foo' => array(
+ 'bar' => array(
+ 'baz' => 'Foo Bar Baz',
+ ),
+ 'baz' => 'Foo Baz',
+ ),
+ );
+
+ return array(
+ array('Symfony est super!', $messages, 'symfony.is.great'),
+ array('Foo Bar Baz', $messages, 'foo.bar.baz'),
+ array('Foo Baz', $messages, 'foo.baz'),
+ );
+ }
+
+ public function getTransChoiceTests()
+ {
+ return array(
+ array('Il y a 0 pomme', '{0} There are no appless|{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', ''),
+ array('Il y a 1 pomme', '{0} There are no appless|{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', ''),
+ array('Il y a 10 pommes', '{0} There are no appless|{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', ''),
+
+ 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', ''),
+ 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', ''),
+ 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', ''),
+
+ 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', ''),
+ 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', ''),
+ 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', ''),
+
+ array('Il n\'y a aucune pomme', '{0} There are no apples|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', ''),
+ array('Il y a 1 pomme', '{0} There are no apples|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', ''),
+ array('Il y a 10 pommes', '{0} There are no apples|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', ''),
+
+ array('Il y a 0 pomme', new StringClass('{0} There are no appless|{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', ''),
+ );
+ }
+
+ public function getInvalidLocalesTests()
+ {
+ return array(
+ array('fr FR'),
+ array('français'),
+ array('fr+en'),
+ array('utf#8'),
+ array('fr&en'),
+ array('fr~FR'),
+ array(' fr'),
+ array('fr '),
+ array('fr*'),
+ array('fr/FR'),
+ array('fr\\FR'),
+ );
+ }
+
+ public function getValidLocalesTests()
+ {
+ return array(
+ array(''),
+ array(null),
+ array('fr'),
+ array('francais'),
+ array('FR'),
+ array('frFR'),
+ array('fr-FR'),
+ array('fr_FR'),
+ array('fr.FR'),
+ array('fr-FR.UTF8'),
+ array('sr@latin'),
+ );
+ }
+
+ public function testTransChoiceFallback()
+ {
+ $translator = new Translator('ru');
+ $translator->setFallbackLocales(array('en'));
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en');
+
+ $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10)));
+ }
+
+ public function testTransChoiceFallbackBis()
+ {
+ $translator = new Translator('ru');
+ $translator->setFallbackLocales(array('en_US', 'en'));
+ $translator->addLoader('array', new ArrayLoader());
+ $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en_US');
+
+ $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10)));
+ }
+
+ public function testTransChoiceFallbackWithNoTranslation()
+ {
+ $translator = new Translator('ru');
+ $translator->setFallbackLocales(array('en'));
+ $translator->addLoader('array', new ArrayLoader());
+
+ // consistent behavior with Translator::trans(), which returns the string
+ // unchanged if it can't be found
+ $this->assertEquals('some_message2', $translator->transChoice('some_message2', 10, array('%count%' => 10)));
+ }
+
+ /**
+ * @dataProvider dataProviderGetMessages
+ */
+ public function testGetMessages($resources, $locale, $expected)
+ {
+ $locales = array_keys($resources);
+ $_locale = !is_null($locale) ? $locale : reset($locales);
+ $locales = array_slice($locales, 0, array_search($_locale, $locales));
+
+ $translator = new Translator($_locale, new MessageSelector());
+ $translator->setFallbackLocales(array_reverse($locales));
+ $translator->addLoader('array', new ArrayLoader());
+ foreach ($resources as $_locale => $domainMessages) {
+ foreach ($domainMessages as $domain => $messages) {
+ $translator->addResource('array', $messages, $_locale, $domain);
+ }
+ }
+ $result = $translator->getMessages($locale);
+
+ $this->assertEquals($expected, $result);
+ }
+
+ public function dataProviderGetMessages()
+ {
+ $resources = array(
+ 'en' => array(
+ 'jsmessages' => array(
+ 'foo' => 'foo (EN)',
+ 'bar' => 'bar (EN)',
+ ),
+ 'messages' => array(
+ 'foo' => 'foo messages (EN)',
+ ),
+ 'validators' => array(
+ 'int' => 'integer (EN)',
+ ),
+ ),
+ 'pt-PT' => array(
+ 'messages' => array(
+ 'foo' => 'foo messages (PT)',
+ ),
+ 'validators' => array(
+ 'str' => 'integer (PT)',
+ ),
+ ),
+ 'pt_BR' => array(
+ 'validators' => array(
+ 'int' => 'integer (BR)',
+ ),
+ ),
+ );
+
+ return array(
+ array($resources, null,
+ array(
+ 'jsmessages' => array(
+ 'foo' => 'foo (EN)',
+ 'bar' => 'bar (EN)',
+ ),
+ 'messages' => array(
+ 'foo' => 'foo messages (EN)',
+ ),
+ 'validators' => array(
+ 'int' => 'integer (EN)',
+ ),
+ ),
+ ),
+ array($resources, 'en',
+ array(
+ 'jsmessages' => array(
+ 'foo' => 'foo (EN)',
+ 'bar' => 'bar (EN)',
+ ),
+ 'messages' => array(
+ 'foo' => 'foo messages (EN)',
+ ),
+ 'validators' => array(
+ 'int' => 'integer (EN)',
+ ),
+ ),
+ ),
+ array($resources, 'pt-PT',
+ array(
+ 'jsmessages' => array(
+ 'foo' => 'foo (EN)',
+ 'bar' => 'bar (EN)',
+ ),
+ 'messages' => array(
+ 'foo' => 'foo messages (PT)',
+ ),
+ 'validators' => array(
+ 'int' => 'integer (EN)',
+ 'str' => 'integer (PT)',
+ ),
+ ),
+ ),
+ array($resources, 'pt_BR',
+ array(
+ 'jsmessages' => array(
+ 'foo' => 'foo (EN)',
+ 'bar' => 'bar (EN)',
+ ),
+ 'messages' => array(
+ 'foo' => 'foo messages (PT)',
+ ),
+ 'validators' => array(
+ 'int' => 'integer (BR)',
+ 'str' => 'integer (PT)',
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class StringClass
+{
+ protected $str;
+
+ public function __construct($str)
+ {
+ $this->str = $str;
+ }
+
+ public function __toString()
+ {
+ return $this->str;
+ }
+}
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.mo b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.mo
new file mode 100644
index 0000000..ed01000
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.mo
Binary files differ
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.po b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.po
new file mode 100644
index 0000000..ff6f22a
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty-translation.po
@@ -0,0 +1,3 @@
+msgid "foo"
+msgstr ""
+
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.csv b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.csv
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.csv
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.ini b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.ini
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.ini
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.json b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.json
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.json
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.mo b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.mo
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.mo
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.po b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.po
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.po
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.xlf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.xlf
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.yml b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.yml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/empty.yml
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/encoding.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/encoding.xlf
new file mode 100644
index 0000000..0a88f92
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/encoding.xlf
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="1" resname="foo">
+ <source>foo</source>
+ <target>bär</target>
+ <note>bäz</note>
+ </trans-unit>
+ <trans-unit id="2" resname="bar">
+ <source>bar</source>
+ <target>föö</target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/escaped-id-plurals.po b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/escaped-id-plurals.po
new file mode 100644
index 0000000..c412aa2
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/escaped-id-plurals.po
@@ -0,0 +1,10 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: en\n"
+
+msgid "escaped \"foo\""
+msgid_plural "escaped \"foos\""
+msgstr[0] "escaped \"bar\""
+msgstr[1] "escaped \"bars\""
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/escaped-id.po b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/escaped-id.po
new file mode 100644
index 0000000..308eadd
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/escaped-id.po
@@ -0,0 +1,8 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: en\n"
+
+msgid "escaped \"foo\""
+msgstr "escaped \"bar\""
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf
new file mode 100644
index 0000000..7bf6c98
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="1">
+ <source>foo</source>
+ <target>bar
+ </trans-unit>
+ <trans-unit id="2">
+ <source>extra</source>
+ </trans-unit>
+ <trans-unit id="3">
+ <source>key</source>
+ <target></target>
+ </trans-unit>
+ <trans-unit id="4">
+ <source>test</source>
+ <target>with</target>
+ <note>note</note>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/malformed.json b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/malformed.json
new file mode 100644
index 0000000..1ee47ff
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/malformed.json
@@ -0,0 +1,3 @@
+{
+ "foo": "bar" "
+} \ No newline at end of file
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.xlf
new file mode 100644
index 0000000..734fc97
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.xlf
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit>
+ <source>foo</source>
+ <target>bar</target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.yml b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.yml
new file mode 100644
index 0000000..257cc56
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/non-valid.yml
@@ -0,0 +1 @@
+foo
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.mo b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.mo
new file mode 100644
index 0000000..6445e77
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.mo
Binary files differ
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.po b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.po
new file mode 100644
index 0000000..439c41a
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/plurals.po
@@ -0,0 +1,5 @@
+msgid "foo"
+msgid_plural "foos"
+msgstr[0] "bar"
+msgstr[1] "bars"
+
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resname.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resname.xlf
new file mode 100644
index 0000000..2df16af
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resname.xlf
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="1" resname="foo">
+ <source></source>
+ <target>bar</target>
+ </trans-unit>
+ <trans-unit id="2" resname="bar">
+ <source>bar source</source>
+ <target>baz</target>
+ </trans-unit>
+ <trans-unit id="3">
+ <source>baz</source>
+ <target>foo</target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/corrupted/resources.dat b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/corrupted/resources.dat
new file mode 100644
index 0000000..391250c
--- /dev/null
+++ b/Aufgabe06/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/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.res b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.res
new file mode 100644
index 0000000..1fc1436
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.res
Binary files differ
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt
new file mode 100644
index 0000000..3d9e9ea
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt
@@ -0,0 +1,3 @@
+en{
+ symfony{"Symfony is great"}
+} \ No newline at end of file
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.res b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.res
new file mode 100644
index 0000000..f584160
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.res
Binary files differ
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt
new file mode 100644
index 0000000..182d0a0
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt
@@ -0,0 +1,3 @@
+fr{
+ symfony{"Symfony est génial"}
+} \ No newline at end of file
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/packagelist.txt b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/packagelist.txt
new file mode 100644
index 0000000..c5783ed
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/packagelist.txt
@@ -0,0 +1,2 @@
+en.res
+fr.res
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/resources.dat b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/resources.dat
new file mode 100644
index 0000000..563b0ea
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/resources.dat
Binary files differ
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/res/en.res b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/res/en.res
new file mode 100644
index 0000000..ad894a9
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resourcebundle/res/en.res
Binary files differ
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources-clean.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources-clean.xlf
new file mode 100644
index 0000000..4ce15af
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources-clean.xlf
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
+ <file source-language="fr-FR" target-language="en-US" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="acbd18db4cc2f85cedef654fccc4a4d8" resname="foo">
+ <source>foo</source>
+ <target>bar</target>
+ <note priority="1" from="bar">baz</note>
+ </trans-unit>
+ <trans-unit id="3c6e0b8a9c15224a8228b9a98ca1531d" resname="key">
+ <source>key</source>
+ <target></target>
+ <note>baz</note>
+ <note>qux</note>
+ </trans-unit>
+ <trans-unit id="18e6a493872558d949b4c16ea1fa6ab6" resname="key.with.cdata">
+ <source>key.with.cdata</source>
+ <target><![CDATA[<source> & <target>]]></target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.csv b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.csv
new file mode 100644
index 0000000..374b9eb
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.csv
@@ -0,0 +1,4 @@
+"foo"; "bar"
+#"bar"; "foo"
+"incorrect"; "number"; "columns"; "will"; "be"; "ignored"
+"incorrect" \ No newline at end of file
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ini b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ini
new file mode 100644
index 0000000..4953062
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ini
@@ -0,0 +1 @@
+foo="bar"
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.json b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.json
new file mode 100644
index 0000000..8a79687
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.json
@@ -0,0 +1,3 @@
+{
+ "foo": "bar"
+} \ No newline at end of file
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.mo b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.mo
new file mode 100644
index 0000000..0a96602
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.mo
Binary files differ
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.php b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.php
new file mode 100644
index 0000000..c291398
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.php
@@ -0,0 +1,5 @@
+<?php
+
+return array (
+ 'foo' => 'bar',
+);
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.po b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.po
new file mode 100644
index 0000000..ccfce6b
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.po
@@ -0,0 +1,8 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: en\n"
+
+msgid "foo"
+msgstr "bar" \ No newline at end of file
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ts b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ts
new file mode 100644
index 0000000..40e1852
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.ts
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TS>
+ <context>
+ <name>resources</name>
+ <message>
+ <source>foo</source>
+ <translation>bar</translation>
+ </message>
+ </context>
+</TS>
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.xlf
new file mode 100644
index 0000000..b0e5988
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.xlf
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="1">
+ <source>foo</source>
+ <target>bar</target>
+ </trans-unit>
+ <trans-unit id="2">
+ <source>extra</source>
+ </trans-unit>
+ <trans-unit id="3">
+ <source>key</source>
+ <target></target>
+ </trans-unit>
+ <trans-unit id="4">
+ <source>test</source>
+ <target>with</target>
+ <note>note</note>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.yml b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.yml
new file mode 100644
index 0000000..20e9ff3
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/resources.yml
@@ -0,0 +1 @@
+foo: bar
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/valid.csv b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/valid.csv
new file mode 100644
index 0000000..59882e5
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/valid.csv
@@ -0,0 +1,4 @@
+foo;bar
+bar;"foo
+foo"
+"foo;foo";bar
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withdoctype.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withdoctype.xlf
new file mode 100644
index 0000000..f83e834
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withdoctype.xlf
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE foo>
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="1">
+ <source>foo</source>
+ <target>bar</target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
diff --git a/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withnote.xlf b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withnote.xlf
new file mode 100644
index 0000000..b1d3f83
--- /dev/null
+++ b/Aufgabe06/vendor/symfony/translation/Symfony/Component/Translation/Tests/fixtures/withnote.xlf
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
+ <file source-language="en" datatype="plaintext" original="file.ext">
+ <body>
+ <trans-unit id="1">
+ <source>foo</source>
+ <target>bar</target>
+ <note priority="1">foo</note>
+ </trans-unit>
+ <trans-unit id="2">
+ <source>extra</source>
+ <note from="foo">bar</note>
+ </trans-unit>
+ <trans-unit id="3">
+ <source>key</source>
+ <target></target>
+ <note>baz</note>
+ <note priority="2" from="bar">qux</note>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>