From 293991df7b2be308c721a94c7493616e356329ed Mon Sep 17 00:00:00 2001 From: Vicent Date: Wed, 16 Jan 2013 00:45:18 +0100 Subject: [PATCH 1/3] [Translation] Added some tests to QtFileLoader. Added one test for testing exception is thrown if resource is not local. Added one test for testing exception is thrown if xml resource is invalid. --- .../Tests/Loader/QtFileLoaderTest.php | 20 ++++++++++++++++ .../Tests/fixtures/invalid-xml-resources.xlf | 23 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf diff --git a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php index 56f5d6ddd4..17f3cc15e8 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php @@ -43,4 +43,24 @@ class QtFileLoaderTest extends \PHPUnit_Framework_TestCase $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'); + } } diff --git a/src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf b/src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf new file mode 100644 index 0000000000..a726ed5699 --- /dev/null +++ b/src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf @@ -0,0 +1,23 @@ + + + + + + foo + bar + + + extra + + + key + + + + test + with + note + + + + From 552a8067621e248a14ec91668fb7a2dface60eed Mon Sep 17 00:00:00 2001 From: Vicent Date: Wed, 16 Jan 2013 01:28:01 +0100 Subject: [PATCH 2/3] Fixed coding standards issues. --- .../Tests/Loader/QtFileLoaderTest.php | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php index 17f3cc15e8..c1dd7b1058 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/QtFileLoaderTest.php @@ -43,24 +43,24 @@ class QtFileLoaderTest extends \PHPUnit_Framework_TestCase $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'); - } + /** + * @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'); + } } From 1c5d74c891e256373ee5ea1d399459e12ce15b1b Mon Sep 17 00:00:00 2001 From: vicentgodella Date: Wed, 16 Jan 2013 09:33:58 +0100 Subject: [PATCH 3/3] Fixed coding standards issues in invalid-xml-resources.xlf file. --- .../Tests/fixtures/invalid-xml-resources.xlf | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf b/src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf index a726ed5699..7bf6c98ba3 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf +++ b/src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf @@ -1,23 +1,23 @@ - - - - foo - bar - - - extra - - - key - - - - test - with - note - - - + + + + foo + bar + + + extra + + + key + + + + test + with + note + + +