8000 Validate XLIFF translation files by javiereguiluz · Pull Request #17903 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Validate XLIFF translation files #17903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

8000
Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Final refactor
  • Loading branch information
javiereguiluz committed Feb 23, 2016
commit b56e9c2bafa6f41804f7a5a6d06a0a092793282b
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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\Form\Tests\Resources;

class TranslationFilesTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFilesAreValid($filePath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, this test concerns a single file, so you should use a singular in the test name (yeah, this is nit-picking 😄 )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done the renaming.

{
try {
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} catch (\PHPUnit_Framework_Exception $e) {
$this->fail($e->getMessage());
}
}

public function provideTranslationFiles()
{
return array_map(
function ($filePath) { return (array) $filePath; },
glob(__DIR__.'/../../Resources/translations/*.xlf')
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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\Form\Tests\Resources;

class TranslationFilesTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFilesAreValid($filePath)
{
try {
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} catch (\PHPUnit_Framework_Exception $e) {
$this->fail($e->getMessage());
}
}

public function provideTranslationFiles()
{
return array_map(
function ($filePath) { return (array) $filePath; },
glob(__DIR__.'/../../Resources/translations/*.xlf')
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class TranslationFilesTest extends \PHPUnit_Framework_TestCase
*/
public function testTranslationFilesAreValid($filePath)
{
libxml_use_internal_errors(true);
libxml_clear_errors();
simplexml_load_file($filePath);

$this->assertSame(array(), libxml_get_errors());
try {
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} catch (\PHPUnit_Framework_Exception $e) {
$this->fail($e->getMessage());
}
}

public function provideTranslationFiles()
Expand Down
0