merged branch vicentgodella/master (PR #6755)
This PR was merged into the master branch. Commits -------1c5d74c
Fixed coding standards issues in invalid-xml-resources.xlf file.552a806
Fixed coding standards issues.293991d
[Translation] Added some tests to QtFileLoader. Discussion ---------- [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. QtFileLoader has now 100% code coverage. Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes License of the code: MIT
This commit is contained in:
commit
8c62123533
@ -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');
|
||||
}
|
||||
}
|
||||
|
23
src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf
vendored
Normal file
23
src/Symfony/Component/Translation/Tests/fixtures/invalid-xml-resources.xlf
vendored
Normal file
@ -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>
|
Reference in New Issue
Block a user