update 1.0.8.0

Commits for version update
This commit is contained in:
Manish Verma
2016-10-17 12:02:27 +05:30
parent dec927987b
commit 76e85db070
9674 changed files with 495757 additions and 58922 deletions

View File

@@ -126,14 +126,14 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
} elseif ($catalogue->has($id, $domain)) {
$state = self::MESSAGE_EQUALS_FALLBACK;
$fallbackCatalogue = $catalogue->getFallBackCatalogue();
$fallbackCatalogue = $catalogue->getFallbackCatalogue();
while ($fallbackCatalogue) {
if ($fallbackCatalogue->defines($id, $domain)) {
$locale = $fallbackCatalogue->getLocale();
break;
}
$fallbackCatalogue = $fallbackCatalogue->getFallBackCatalogue();
$fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue();
}
} else {
$state = self::MESSAGE_MISSING;

View File

@@ -37,7 +37,7 @@ class MoFileLoader extends FileLoader
/**
* The size of the header of a MO file in bytes.
*
* @var int Number of bytes.
* @var int Number of bytes
*/
const MO_HEADER_SIZE = 28;

View File

@@ -172,10 +172,16 @@ class XliffFileLoader implements LoaderInterface
{
$internalErrors = libxml_use_internal_errors(true);
$disableEntities = libxml_disable_entity_loader(false);
if (!@$dom->schemaValidateSource($schema)) {
libxml_disable_entity_loader($disableEntities);
throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $file, implode("\n", $this->getXmlErrors($internalErrors))));
}
libxml_disable_entity_loader($disableEntities);
$dom->normalizeDocument();
libxml_clear_errors();

View File

@@ -46,6 +46,20 @@ class XliffFileLoaderTest extends \PHPUnit_Framework_TestCase
libxml_use_internal_errors($internalErrors);
}
public function testLoadWithExternalEntitiesDisabled()
{
$disableEntities = libxml_disable_entity_loader(true);
$loader = new XliffFileLoader();
$resource = __DIR__.'/../fixtures/resources.xlf';
$catalogue = $loader->load($resource, 'en', 'domain1');
libxml_disable_entity_loader($disableEntities);
$this->assertEquals('en', $catalogue->getLocale());
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
}
public function testLoadWithResname()
{
$loader = new XliffFileLoader();

View File

@@ -37,7 +37,7 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
*/
public function testFailedLangcodes($nplural, $langCodes)
{
$matrix = $this->generateTestData($nplural, $langCodes);
$matrix = $this->generateTestData($langCodes);
$this->validateMatrix($nplural, $matrix, false);
}
@@ -46,7 +46,7 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
*/
public function testLangcodes($nplural, $langCodes)
{
$matrix = $this->generateTestData($nplural, $langCodes);
$matrix = $this->generateTestData($langCodes);
$this->validateMatrix($nplural, $matrix);
}
@@ -93,7 +93,7 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
* We validate only on the plural coverage. Thus the real rules is not tested.
*
* @param string $nplural plural expected
* @param array $matrix containing langcodes and their plural index values.
* @param array $matrix containing langcodes and their plural index values
* @param bool $expectSuccess
*/
protected function validateMatrix($nplural, $matrix, $expectSuccess = true)
@@ -108,7 +108,7 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
}
}
protected function generateTestData($plural, $langCodes)
protected function generateTestData($langCodes)
{
$matrix = array();
foreach ($langCodes as $langCode) {

View File

@@ -285,12 +285,12 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
$resources = $translator->getCatalogue('en')->getResources();
$this->assertCount(1, $resources);
$this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
$resources = $translator->getCatalogue('en_GB')->getResources();
$this->assertCount(2, $resources);
$this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources);
$this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources);
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
}
/**