Merge branch '2.7' into 2.8

* 2.7:
  [ci] Fix tests requirements
  [ci] SymfonyTestsListener is now auto-registered
  adds validation messages missing italian translations
  [Console] fixed progress bar format on edge cases
  fix bug with set max count, by start method in progress bar

Conflicts:
	src/Symfony/Component/Form/Tests/Extension/Core/EventListener/TrimListenerTest.php
	src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php
	src/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php
	src/Symfony/Component/Security/Acl/Tests/Dbal/AclProviderTest.php
	src/Symfony/Component/Security/Acl/Tests/Dbal/MutableAclProviderTest.php
This commit is contained in:
Nicolas Grekas 2015-10-12 11:25:14 +02:00
commit 38ee8b34c4
9 changed files with 102 additions and 26 deletions

View File

@ -32,7 +32,7 @@ before_install:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then phpenv config-rm xdebug.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" =~ 5.[34] ]]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" =~ 5.[34] ]]; then echo -e "extension = apc.so\napc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi;
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini); fi;
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = ldap.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;

View File

@ -26,8 +26,8 @@ install:
- IF %PHP%==1 cd ext
- IF %PHP%==1 appveyor DownloadFile http://nebm.ist.utl.pt/~glopes/misc/intl_win/php_intl-3.0.0-5.3-nts-vc9-x86.zip
- IF %PHP%==1 7z x php_intl-3.0.0-5.3-nts-vc9-x86.zip -y > 7z.log
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apc/3.1.13/php_apc-3.1.13-5.3-nts-vc9-x86.zip
- IF %PHP%==1 7z x php_apc-3.1.13-5.3-nts-vc9-x86.zip -y > 7z.log
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apcu/4.0.7/php_apcu-4.0.7-5.3-nts-vc9-x86.zip
- IF %PHP%==1 7z x php_apcu-4.0.7-5.3-nts-vc9-x86.zip -y > 7z.log
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/php_memcache-3.0.8-5.3-nts-vc9-x86.zip
- IF %PHP%==1 7z x php_memcache-3.0.8-5.3-nts-vc9-x86.zip -y > 7z.log
- IF %PHP%==1 cd ..
@ -38,7 +38,8 @@ install:
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min
- IF %PHP%==1 copy /Y php.ini-min php.ini-max
- IF %PHP%==1 echo extension=php_apc.dll >> php.ini-max
- IF %PHP%==1 echo extension=php_apcu.dll >> php.ini-max
- IF %PHP%==1 echo apc.enable_cli=1 >> php.ini-max
- IF %PHP%==1 echo extension=php_intl.dll >> php.ini-max
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini-max
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini-max

View File

@ -21,10 +21,10 @@ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
$this->markTestSkipped('The apc extension is available, but not enabled.');
} else {
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
apc_clear_cache('user');
} else {
$this->markTestSkipped('APC is not enabled.');
}
}

View File

@ -28,7 +28,8 @@ class ProgressBar
private $barChar;
private $emptyBarChar = '-';
private $progressChar = '>';
private $format = null;
private $format;
private $internalFormat;
private $redrawFreq = 1;
/**
@ -73,8 +74,6 @@ class ProgressBar
}
}
$this->setFormat($this->determineBestFormat());
$this->startTime = time();
}
@ -311,16 +310,8 @@ class ProgressBar
*/
public function setFormat($format)
{
// try to use the _nomax variant if available
if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
$this->format = self::getFormatDefinition($format.'_nomax');
} elseif (null !== self::getFormatDefinition($format)) {
$this->format = self::getFormatDefinition($format);
} else {
$this->format = $format;
}
$this->formatLineCount = substr_count($this->format, "\n");
$this->format = null;
$this->internalFormat = $format;
}
/**
@ -442,6 +433,10 @@ class ProgressBar
return;
}
if (null === $this->format) {
$this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
}
// these 3 variables can be removed in favor of using $this in the closure when support for PHP 5.3 will be dropped.
$self = $this;
$output = $this->output;
@ -476,9 +471,32 @@ class ProgressBar
return;
}
if (null === $this->format) {
$this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
}
$this->overwrite(str_repeat("\n", $this->formatLineCount));
}
/**
* Sets the progress bar format.
*
* @param string $format The format
*/
private function setRealFormat($format)
{
// try to use the _nomax variant if available
if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
$this->format = self::getFormatDefinition($format.'_nomax');
} elseif (null !== self::getFormatDefinition($format)) {
$this->format = self::getFormatDefinition($format);
} else {
$this->format = $format;
}
$this->formatLineCount = substr_count($this->format, "\n");
}
/**
* Sets the progress bar maximal steps.
*

View File

@ -106,6 +106,53 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
);
}
public function testFormat()
{
$expected =
$this->generateOutput(' 0/10 [>---------------------------] 0%').
$this->generateOutput(' 10/10 [============================] 100%').
$this->generateOutput(' 10/10 [============================] 100%')
;
// max in construct, no format
$bar = new ProgressBar($output = $this->getOutputStream(), 10);
$bar->start();
$bar->advance(10);
$bar->finish();
rewind($output->getStream());
$this->assertEquals($expected, stream_get_contents($output->getStream()));
// max in start, no format
$bar = new ProgressBar($output = $this->getOutputStream());
$bar->start(10);
$bar->advance(10);
$bar->finish();
rewind($output->getStream());
$this->assertEquals($expected, stream_get_contents($output->getStream()));
// max in construct, explicit format before
$bar = new ProgressBar($output = $this->getOutputStream(), 10);
$bar->setFormat('normal');
$bar->start();
$bar->advance(10);
$bar->finish();
rewind($output->getStream());
$this->assertEquals($expected, stream_get_contents($output->getStream()));
// max in start, explicit format before
$bar = new ProgressBar($output = $this->getOutputStream());
$bar->setFormat('normal');
$bar->start(10);
$bar->advance(10);
$bar->finish();
rewind($output->getStream());
$this->assertEquals($expected, stream_get_contents($output->getStream()));
}
public function testCustomizations()
{
$bar = new ProgressBar($output = $this->getOutputStream(), 10);

View File

@ -138,7 +138,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
try {
$m->invoke($this->storage);
} catch (\MongoConnectionException $e) {
$this->storage = null;
$this->markTestSkipped('A MongoDB server on localhost is required.');
}
$this->storage->purge();
@ -146,8 +146,6 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
protected function tearDown()
{
if ($this->storage) {
$this->storage->purge();
}
$this->storage->purge();
}
}

View File

@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage;
/**
* @group legacy
* @requires extensin pdo_sqlite
* @requires extension pdo_sqlite
*/
class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
{

View File

@ -302,6 +302,18 @@
<source>An empty file is not allowed.</source>
<target>Un file vuoto non è consentito.</target>
</trans-unit>
<trans-unit id="79">
<source>The host could not be resolved.</source>
<target>L'host non può essere risolto.</target>
</trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Questo valore non corrisponde al charset {{ charset }}.</target>
</trans-unit>
<trans-unit id="81">
<source>This is not a valid Business Identifier Code (BIC).</source>
<target>Questo valore non è un codice BIC valido.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -21,7 +21,7 @@ class LegacyApcCacheTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!ini_get('apc.enable') || !ini_get('apc.enable_cli')) {
if (!ini_get('apc.enabled') || !ini_get('apc.enable_cli')) {
$this->markTestSkipped('APC is not enabled.');
}
}