Merge branch '3.4' into 4.3

* 3.4:
  cleanups
  Disable PHPUnit result cache on the CI
  [Translation] Highlight invalid translation status
This commit is contained in:
Nicolas Grekas 2019-08-10 22:47:15 +02:00
commit 9d9f5582b2
10 changed files with 22 additions and 9 deletions

View File

@ -12,6 +12,7 @@ init:
- SET SYMFONY_DEPRECATIONS_HELPER=strict
- SET "SYMFONY_REQUIRE=>=4.2"
- SET ANSICON=121x90 (121x90)
- SET SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
- REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f
install:

View File

@ -21,6 +21,7 @@ env:
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
- MESSENGER_AMQP_DSN=amqp://localhost/%2f/messages
- MESSENGER_REDIS_DSN=redis://127.0.0.1:7001/messages
- SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
matrix:
include:

View File

@ -166,6 +166,14 @@ EOPHP
global $argv, $argc;
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
if ($PHPUNIT_VERSION < 8.0) {
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; });
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
$argv[] = '--do-not-cache-result';
++$argc;
}
$components = array();
$cmd = array_map('escapeshellarg', $argv);
$exit = 0;

View File

@ -47,7 +47,7 @@
},
"conflict": {
"symfony/console": "<3.4",
"symfony/form": "<4.3",
"symfony/form": "<4.3.4",
"symfony/http-foundation": "<4.3",
"symfony/translation": "<4.2",
"symfony/workflow": "<4.3"

View File

@ -366,9 +366,9 @@ abstract class BaseNode implements NodeInterface
/**
* Normalizes the value before any other normalization is applied.
*
* @param $value
* @param mixed $value
*
* @return The normalized array value
* @return mixed The normalized array value
*/
protected function preNormalize($value)
{

View File

@ -282,7 +282,6 @@ class ValidateEnvPlaceholdersPassTest extends TestCase
$container = new ContainerBuilder();
$container->registerExtension(new EnvExtension(new ConfigurationWithArrayNodeRequiringOneElement()));
$container->loadFromExtension('env_extension', []);
$container->loadFromExtension('env_extension', []);
$this->doProcess($container);

View File

@ -1539,7 +1539,6 @@ class RequestTest extends TestCase
$request = new Request();
$request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
$this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages());
$this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages());
$request = new Request();
$request->headers->set('Accept-language', 'zh, en-us; q=0.6, en; q=0.8');

View File

@ -533,7 +533,6 @@ class ResponseTest extends ResponseTestCase
$response->prepare($request);
$this->assertEquals('', $response->getContent());
$this->assertFalse($response->headers->has('Content-Type'));
$this->assertFalse($response->headers->has('Content-Type'));
$response->setContent('content');
$response->setStatusCode(304);

View File

@ -27,7 +27,7 @@ use Symfony\Component\Intl\Exception\RuntimeException;
class LanguageDataGenerator extends AbstractDataGenerator
{
/**
* Source: https://iso639-3.sil.org/code_tables/639/data
* Source: https://iso639-3.sil.org/code_tables/639/data.
*/
private static $preferredAlpha2ToAlpha3Mapping = [
'ak' => 'aka',

View File

@ -167,8 +167,9 @@ function printTable($translations, $verboseOutput)
$longestLocaleNameLength = max(array_map('strlen', array_keys($translations)));
foreach ($translations as $locale => $translation) {
$isTranslationCompleted = $translation['translated'] === $translation['total'];
if ($isTranslationCompleted) {
if ($translation['translated'] > $translation['total']) {
textColorRed();
} elseif ($translation['translated'] === $translation['total']) {
textColorGreen();
}
@ -194,6 +195,11 @@ function textColorGreen()
echo "\033[32m";
}
function textColorRed()
{
echo "\033[31m";
}
function textColorNormal()
{
echo "\033[0m";