first commit
This commit is contained in:
30
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php
vendored
Normal file
30
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\CsvFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class CsvFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar', 'bar' => 'foo
|
||||
foo', 'foo;foo' => 'bar']);
|
||||
|
||||
$dumper = new CsvFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/valid.csv', $dumper->formatCatalogue($catalogue, 'messages'));
|
||||
}
|
||||
}
|
||||
89
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php
vendored
Normal file
89
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\FileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class FileDumperTest extends TestCase
|
||||
{
|
||||
public function testDump()
|
||||
{
|
||||
$tempDir = sys_get_temp_dir();
|
||||
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar']);
|
||||
|
||||
$dumper = new ConcreteFileDumper();
|
||||
$dumper->dump($catalogue, ['path' => $tempDir]);
|
||||
|
||||
$this->assertFileExists($tempDir.'/messages.en.concrete');
|
||||
|
||||
@unlink($tempDir.'/messages.en.concrete');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testDumpBackupsFileIfExisting()
|
||||
{
|
||||
$tempDir = sys_get_temp_dir();
|
||||
$file = $tempDir.'/messages.en.concrete';
|
||||
$backupFile = $file.'~';
|
||||
|
||||
@touch($file);
|
||||
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar']);
|
||||
|
||||
$dumper = new ConcreteFileDumper();
|
||||
$dumper->dump($catalogue, ['path' => $tempDir]);
|
||||
|
||||
$this->assertFileExists($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(['foo' => 'bar']);
|
||||
|
||||
$dumper = new ConcreteFileDumper();
|
||||
$dumper->setRelativePathTemplate('test/translations/%domain%.%locale%.%extension%');
|
||||
$dumper->dump($catalogue, ['path' => $tempDir]);
|
||||
|
||||
$this->assertFileExists($file);
|
||||
|
||||
@unlink($file);
|
||||
@rmdir($translationsDir);
|
||||
}
|
||||
}
|
||||
|
||||
class ConcreteFileDumper extends FileDumper
|
||||
{
|
||||
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = [])
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function getExtension()
|
||||
{
|
||||
return 'concrete';
|
||||
}
|
||||
}
|
||||
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php
vendored
Normal file
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\IcuResFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class IcuResFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar']);
|
||||
|
||||
$dumper = new IcuResFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/resourcebundle/res/en.res', $dumper->formatCatalogue($catalogue, 'messages'));
|
||||
}
|
||||
}
|
||||
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php
vendored
Normal file
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\IniFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class IniFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar']);
|
||||
|
||||
$dumper = new IniFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.ini', $dumper->formatCatalogue($catalogue, 'messages'));
|
||||
}
|
||||
}
|
||||
39
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php
vendored
Normal file
39
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\JsonFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class JsonFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar']);
|
||||
|
||||
$dumper = new JsonFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.json', $dumper->formatCatalogue($catalogue, 'messages'));
|
||||
}
|
||||
|
||||
public function testDumpWithCustomEncoding()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => '"bar"']);
|
||||
|
||||
$dumper = new JsonFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', ['json_encoding' => \JSON_HEX_QUOT]));
|
||||
}
|
||||
}
|
||||
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php
vendored
Normal file
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\MoFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class MoFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar']);
|
||||
|
||||
$dumper = new MoFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.mo', $dumper->formatCatalogue($catalogue, 'messages'));
|
||||
}
|
||||
}
|
||||
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php
vendored
Normal file
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\PhpFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class PhpFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar']);
|
||||
|
||||
$dumper = new PhpFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.php', $dumper->formatCatalogue($catalogue, 'messages'));
|
||||
}
|
||||
}
|
||||
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php
vendored
Normal file
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\PoFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class PoFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar', 'bar' => 'foo']);
|
||||
|
||||
$dumper = new PoFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.po', $dumper->formatCatalogue($catalogue, 'messages'));
|
||||
}
|
||||
}
|
||||
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php
vendored
Normal file
29
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\QtFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class QtFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add(['foo' => 'bar'], 'resources');
|
||||
|
||||
$dumper = new QtFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.ts', $dumper->formatCatalogue($catalogue, 'resources'));
|
||||
}
|
||||
}
|
||||
115
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php
vendored
Normal file
115
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\XliffFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class XliffFileDumperTest extends TestCase
|
||||
{
|
||||
public function testFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en_US');
|
||||
$catalogue->add([
|
||||
'foo' => 'bar',
|
||||
'key' => '',
|
||||
'key.with.cdata' => '<source> & <target>',
|
||||
]);
|
||||
$catalogue->setMetadata('foo', ['notes' => [['priority' => 1, 'from' => 'bar', 'content' => 'baz']]]);
|
||||
$catalogue->setMetadata('key', ['notes' => [['content' => 'baz'], ['content' => 'qux']]]);
|
||||
|
||||
$dumper = new XliffFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(
|
||||
__DIR__.'/../fixtures/resources-clean.xlf',
|
||||
$dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR'])
|
||||
);
|
||||
}
|
||||
|
||||
public function testFormatCatalogueXliff2()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en_US');
|
||||
$catalogue->add([
|
||||
'foo' => 'bar',
|
||||
'key' => '',
|
||||
'key.with.cdata' => '<source> & <target>',
|
||||
]);
|
||||
$catalogue->setMetadata('key', ['target-attributes' => ['order' => 1]]);
|
||||
|
||||
$dumper = new XliffFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(
|
||||
__DIR__.'/../fixtures/resources-2.0-clean.xlf',
|
||||
$dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR', 'xliff_version' => '2.0'])
|
||||
);
|
||||
}
|
||||
|
||||
public function testFormatCatalogueWithCustomToolInfo()
|
||||
{
|
||||
$options = [
|
||||
'default_locale' => 'en_US',
|
||||
'tool_info' => ['tool-id' => 'foo', 'tool-name' => 'foo', 'tool-version' => '0.0', 'tool-company' => 'Foo'],
|
||||
];
|
||||
|
||||
$catalogue = new MessageCatalogue('en_US');
|
||||
$catalogue->add(['foo' => 'bar']);
|
||||
|
||||
$dumper = new XliffFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(
|
||||
__DIR__.'/../fixtures/resources-tool-info.xlf',
|
||||
$dumper->formatCatalogue($catalogue, 'messages', $options)
|
||||
);
|
||||
}
|
||||
|
||||
public function testFormatCatalogueWithTargetAttributesMetadata()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en_US');
|
||||
$catalogue->add([
|
||||
'foo' => 'bar',
|
||||
]);
|
||||
$catalogue->setMetadata('foo', ['target-attributes' => ['state' => 'needs-translation']]);
|
||||
|
||||
$dumper = new XliffFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(
|
||||
__DIR__.'/../fixtures/resources-target-attributes.xlf',
|
||||
$dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR'])
|
||||
);
|
||||
}
|
||||
|
||||
public function testFormatCatalogueWithNotesMetadata()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en_US');
|
||||
$catalogue->add([
|
||||
'foo' => 'bar',
|
||||
'baz' => 'biz',
|
||||
]);
|
||||
$catalogue->setMetadata('foo', ['notes' => [
|
||||
['category' => 'state', 'content' => 'new'],
|
||||
['category' => 'approved', 'content' => 'true'],
|
||||
['category' => 'section', 'content' => 'user login', 'priority' => '1'],
|
||||
]]);
|
||||
$catalogue->setMetadata('baz', ['notes' => [
|
||||
['id' => 'x', 'content' => 'x_content'],
|
||||
['appliesTo' => 'target', 'category' => 'quality', 'content' => 'Fuzzy'],
|
||||
]]);
|
||||
|
||||
$dumper = new XliffFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(
|
||||
__DIR__.'/../fixtures/resources-notes-meta.xlf',
|
||||
$dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR', 'xliff_version' => '2.0'])
|
||||
);
|
||||
}
|
||||
}
|
||||
45
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php
vendored
Normal file
45
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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 PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Dumper\YamlFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class YamlFileDumperTest extends TestCase
|
||||
{
|
||||
public function testTreeFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add([
|
||||
'foo.bar1' => 'value1',
|
||||
'foo.bar2' => 'value2',
|
||||
]);
|
||||
|
||||
$dumper = new YamlFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', ['as_tree' => true, 'inline' => 999]));
|
||||
}
|
||||
|
||||
public function testLinearFormatCatalogue()
|
||||
{
|
||||
$catalogue = new MessageCatalogue('en');
|
||||
$catalogue->add([
|
||||
'foo.bar1' => 'value1',
|
||||
'foo.bar2' => 'value2',
|
||||
]);
|
||||
|
||||
$dumper = new YamlFileDumper();
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__.'/../fixtures/messages_linear.yml', $dumper->formatCatalogue($catalogue, 'messages'));
|
||||
}
|
||||
}
|
||||
11
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/index.php
vendored
Normal file
11
modules/inpostshipping/vendor/symfony/translation/Tests/Dumper/index.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
Reference in New Issue
Block a user