summaryrefslogtreecommitdiff
path: root/vendor/symfony/translation/Tests/Loader
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/translation/Tests/Loader')
-rw-r--r--vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php6
-rw-r--r--vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php79
2 files changed, 80 insertions, 5 deletions
diff --git a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php
index 08f55e9022..f149b8c715 100644
--- a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php
+++ b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php
@@ -23,7 +23,11 @@ class QtFileLoaderTest extends TestCase
$resource = __DIR__.'/../fixtures/resources.ts';
$catalogue = $loader->load($resource, 'en', 'resources');
- $this->assertEquals(['foo' => 'bar'], $catalogue->all('resources'));
+ $this->assertEquals([
+ 'foo' => 'bar',
+ 'foo_bar' => 'foobar',
+ 'bar_foo' => 'barfoo',
+ ], $catalogue->all('resources'));
$this->assertEquals('en', $catalogue->getLocale());
$this->assertEquals([new FileResource($resource)], $catalogue->getResources());
}
diff --git a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php
index 7cb9f54fde..1ca8336d52 100644
--- a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php
+++ b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php
@@ -84,7 +84,17 @@ class XliffFileLoaderTest extends TestCase
$this->assertEquals(utf8_decode('föö'), $catalogue->get('bar', 'domain1'));
$this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1'));
- $this->assertEquals(['notes' => [['content' => utf8_decode('bäz')]], 'id' => '1'], $catalogue->getMetadata('foo', 'domain1'));
+ $this->assertEquals(
+ [
+ 'source' => 'foo',
+ 'notes' => [['content' => utf8_decode('bäz')]],
+ 'id' => '1',
+ 'file' => [
+ 'original' => 'file.ext',
+ ],
+ ],
+ $catalogue->getMetadata('foo', 'domain1')
+ );
}
public function testTargetAttributesAreStoredCorrectly()
@@ -164,11 +174,44 @@ class XliffFileLoaderTest extends TestCase
$loader = new XliffFileLoader();
$catalogue = $loader->load(__DIR__.'/../fixtures/withnote.xlf', 'en', 'domain1');
- $this->assertEquals(['notes' => [['priority' => 1, 'content' => 'foo']], 'id' => '1'], $catalogue->getMetadata('foo', 'domain1'));
+ $this->assertEquals(
+ [
+ 'source' => 'foo',
+ 'notes' => [['priority' => 1, 'content' => 'foo']],
+ 'id' => '1',
+ 'file' => [
+ 'original' => 'file.ext',
+ ],
+ ],
+ $catalogue->getMetadata('foo', 'domain1')
+ );
// message without target
- $this->assertEquals(['notes' => [['content' => 'bar', 'from' => 'foo']], 'id' => '2'], $catalogue->getMetadata('extra', 'domain1'));
+ $this->assertEquals(
+ [
+ 'source' => 'extrasource',
+ 'notes' => [['content' => 'bar', 'from' => 'foo']],
+ 'id' => '2',
+ 'file' => [
+ 'original' => 'file.ext',
+ ],
+ ],
+ $catalogue->getMetadata('extra', 'domain1')
+ );
// message with empty target
- $this->assertEquals(['notes' => [['content' => 'baz'], ['priority' => 2, 'from' => 'bar', 'content' => 'qux']], 'id' => '123'], $catalogue->getMetadata('key', 'domain1'));
+ $this->assertEquals(
+ [
+ 'source' => 'key',
+ 'notes' => [
+ ['content' => 'baz'],
+ ['priority' => 2, 'from' => 'bar', 'content' => 'qux'],
+ ],
+ 'id' => '123',
+ 'file' => [
+ 'original' => 'file.ext',
+ ],
+ ],
+ $catalogue->getMetadata('key', 'domain1')
+ );
}
public function testLoadVersion2()
@@ -257,4 +300,32 @@ class XliffFileLoaderTest extends TestCase
$this->assertSame('processed', $metadata['notes'][0]['category']);
$this->assertSame('true', $metadata['notes'][0]['content']);
}
+
+ public function testLoadWithMultipleFileNodes()
+ {
+ $loader = new XliffFileLoader();
+ $catalogue = $loader->load(__DIR__.'/../fixtures/resources-multi-files.xlf', 'en', 'domain1');
+
+ $this->assertEquals(
+ [
+ 'source' => 'foo',
+ 'id' => '1',
+ 'file' => [
+ 'original' => 'file.ext',
+ ],
+ ],
+ $catalogue->getMetadata('foo', 'domain1')
+ );
+ $this->assertEquals(
+ [
+ 'source' => 'test',
+ 'notes' => [['content' => 'note']],
+ 'id' => '4',
+ 'file' => [
+ 'original' => 'otherfile.ext',
+ ],
+ ],
+ $catalogue->getMetadata('test', 'domain1')
+ );
+ }
}