Merge branch '5.1' into 5.x
* 5.1: Validate XLIFF files in tests using the XSD
This commit is contained in:
commit
86e5c563f1
@ -12,7 +12,7 @@
|
||||
namespace Symfony\Component\Form\Tests\Resources;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Util\Xml\Loader;
|
||||
use Symfony\Component\Translation\Util\XliffUtils;
|
||||
|
||||
class TranslationFilesTest extends TestCase
|
||||
{
|
||||
@ -21,13 +21,12 @@ class TranslationFilesTest extends TestCase
|
||||
*/
|
||||
public function testTranslationFileIsValid($filePath)
|
||||
{
|
||||
$loader = class_exists(Loader::class)
|
||||
? [new Loader(), 'loadFile']
|
||||
: ['PHPUnit\Util\XML', 'loadfile'];
|
||||
$document = new \DOMDocument();
|
||||
$document->loadXML(file_get_contents($filePath));
|
||||
|
||||
$loader($filePath, false, false, true);
|
||||
$errors = XliffUtils::validateSchema($document);
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
$this->assertCount(0, $errors, sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message'))));
|
||||
}
|
||||
|
||||
public function provideTranslationFiles()
|
||||
|
@ -12,7 +12,7 @@
|
||||
namespace Symfony\Component\Security\Core\Tests\Resources;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Util\Xml\Loader;
|
||||
use Symfony\Component\Translation\Util\XliffUtils;
|
||||
|
||||
class TranslationFilesTest extends TestCase
|
||||
{
|
||||
@ -21,13 +21,12 @@ class TranslationFilesTest extends TestCase
|
||||
*/
|
||||
public function testTranslationFileIsValid($filePath)
|
||||
{
|
||||
$loader = class_exists(Loader::class)
|
||||
? [new Loader(), 'loadFile']
|
||||
: ['PHPUnit\Util\XML', 'loadfile'];
|
||||
$document = new \DOMDocument();
|
||||
$document->loadXML(file_get_contents($filePath));
|
||||
|
||||
$loader($filePath, false, false, true);
|
||||
$errors = XliffUtils::validateSchema($document);
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
$this->assertCount(0, $errors, sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message'))));
|
||||
}
|
||||
|
||||
public function provideTranslationFiles()
|
||||
|
@ -28,6 +28,7 @@
|
||||
"symfony/expression-language": "^4.4|^5.0",
|
||||
"symfony/http-foundation": "^4.4|^5.0",
|
||||
"symfony/ldap": "^4.4|^5.0",
|
||||
"symfony/translation": "^4.4|^5.0",
|
||||
"symfony/validator": "^5.2",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
|
@ -12,7 +12,7 @@
|
||||
namespace Symfony\Component\Validator\Tests\Resources;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Util\Xml\Loader;
|
||||
use Symfony\Component\Translation\Util\XliffUtils;
|
||||
|
||||
class TranslationFilesTest extends TestCase
|
||||
{
|
||||
@ -21,13 +21,12 @@ class TranslationFilesTest extends TestCase
|
||||
*/
|
||||
public function testTranslationFileIsValid($filePath)
|
||||
{
|
||||
$loader = class_exists(Loader::class)
|
||||
? [new Loader(), 'loadFile']
|
||||
: ['PHPUnit\Util\XML', 'loadfile'];
|
||||
$document = new \DOMDocument();
|
||||
$document->loadXML(file_get_contents($filePath));
|
||||
|
||||
$loader($filePath, false, false, true);
|
||||
$errors = XliffUtils::validateSchema($document);
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
$this->assertCount(0, $errors, sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message'))));
|
||||
}
|
||||
|
||||
public function provideTranslationFiles()
|
||||
|
Reference in New Issue
Block a user