Merge branch '2.7' into 2.8
* 2.7: Use PHPUnit 6.0 on PHP 7.* test lines
This commit is contained in:
commit
5db127bf1b
5
phpunit
5
phpunit
@ -1,11 +1,14 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/d3157d942a4590121dfd23f9cadf519ca6ad4ac7
|
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/2a45e94c3cde63d8cdfa729e51b80f85b1ab37f6
|
||||||
|
|
||||||
if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
|
if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
|
||||||
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
|
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
if (PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
|
||||||
|
putenv('SYMFONY_PHPUNIT_VERSION=6.0');
|
||||||
|
}
|
||||||
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
|
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
|
||||||
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
|
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/stopwatch": "~2.2|~3.0.0",
|
"symfony/stopwatch": "~2.2|~3.0.0",
|
||||||
"symfony/dependency-injection": "~2.2|~3.0.0",
|
"symfony/dependency-injection": "~2.2|~3.0.0",
|
||||||
"symfony/form": "~2.8.5|~3.0.5",
|
"symfony/form": "^2.8.18|~3.2.5",
|
||||||
"symfony/http-kernel": "~2.2|~3.0.0",
|
"symfony/http-kernel": "~2.2|~3.0.0",
|
||||||
"symfony/property-access": "~2.3|~3.0.0",
|
"symfony/property-access": "~2.3|~3.0.0",
|
||||||
"symfony/property-info": "~2.8|3.0",
|
"symfony/property-info": "~2.8|3.0",
|
||||||
"symfony/security": "~2.2|~3.0.0",
|
"symfony/security": "~2.2|~3.0.0",
|
||||||
"symfony/expression-language": "~2.2|~3.0.0",
|
"symfony/expression-language": "~2.2|~3.0.0",
|
||||||
"symfony/validator": "^2.5.5|~3.0.0",
|
"symfony/validator": "~2.7.25|^2.8.18|~3.2.5",
|
||||||
"symfony/translation": "^2.0.5|~3.0.0",
|
"symfony/translation": "^2.0.5|~3.0.0",
|
||||||
"doctrine/data-fixtures": "1.0.*",
|
"doctrine/data-fixtures": "1.0.*",
|
||||||
"doctrine/dbal": "~2.4",
|
"doctrine/dbal": "~2.4",
|
||||||
|
@ -18,6 +18,19 @@ require_once __DIR__.'/../../bootstrap.php';
|
|||||||
|
|
||||||
@trigger_error('root deprecation', E_USER_DEPRECATED);
|
@trigger_error('root deprecation', E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
eval(<<<'EOPHP'
|
||||||
|
namespace PHPUnit\Util;
|
||||||
|
|
||||||
|
class Test
|
||||||
|
{
|
||||||
|
public static function getGroups()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOPHP
|
||||||
|
);
|
||||||
|
|
||||||
class PHPUnit_Util_Test
|
class PHPUnit_Util_Test
|
||||||
{
|
{
|
||||||
public static function getGroups()
|
public static function getGroups()
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/asset": "~2.7|~3.0.0",
|
"symfony/asset": "~2.7|~3.0.0",
|
||||||
"symfony/finder": "~2.3|~3.0.0",
|
"symfony/finder": "~2.3|~3.0.0",
|
||||||
"symfony/form": "^2.8.16",
|
"symfony/form": "^2.8.18",
|
||||||
"symfony/http-kernel": "~2.8|~3.0.0",
|
"symfony/http-kernel": "~2.8|~3.0.0",
|
||||||
"symfony/polyfill-intl-icu": "~1.0",
|
"symfony/polyfill-intl-icu": "~1.0",
|
||||||
"symfony/routing": "~2.2|~3.0.0",
|
"symfony/routing": "~2.2|~3.0.0",
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"symfony/event-dispatcher": "~2.8|~3.0.0",
|
"symfony/event-dispatcher": "~2.8|~3.0.0",
|
||||||
"symfony/finder": "^2.0.5|~3.0.0",
|
"symfony/finder": "^2.0.5|~3.0.0",
|
||||||
"symfony/http-foundation": "~2.7",
|
"symfony/http-foundation": "~2.7",
|
||||||
"symfony/http-kernel": "^2.8.16",
|
"symfony/http-kernel": "^2.8.18",
|
||||||
"symfony/polyfill-mbstring": "~1.0",
|
"symfony/polyfill-mbstring": "~1.0",
|
||||||
"symfony/filesystem": "~2.3|~3.0.0",
|
"symfony/filesystem": "~2.3|~3.0.0",
|
||||||
"symfony/routing": "^2.8.17",
|
"symfony/routing": "^2.8.17",
|
||||||
@ -43,7 +43,7 @@
|
|||||||
"symfony/dom-crawler": "^2.0.5|~3.0.0",
|
"symfony/dom-crawler": "^2.0.5|~3.0.0",
|
||||||
"symfony/polyfill-intl-icu": "~1.0",
|
"symfony/polyfill-intl-icu": "~1.0",
|
||||||
"symfony/security": "~2.6|~3.0.0",
|
"symfony/security": "~2.6|~3.0.0",
|
||||||
"symfony/form": "^2.8.16",
|
"symfony/form": "^2.8.18",
|
||||||
"symfony/expression-language": "~2.6|~3.0.0",
|
"symfony/expression-language": "~2.6|~3.0.0",
|
||||||
"symfony/process": "^2.0.5|~3.0.0",
|
"symfony/process": "^2.0.5|~3.0.0",
|
||||||
"symfony/validator": "~2.5|~3.0.0",
|
"symfony/validator": "~2.5|~3.0.0",
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
"php": ">=5.3.9",
|
"php": ">=5.3.9",
|
||||||
"symfony/security": "~2.8|~3.0.0",
|
"symfony/security": "~2.8|~3.0.0",
|
||||||
"symfony/security-acl": "~2.7|~3.0.0",
|
"symfony/security-acl": "~2.7|~3.0.0",
|
||||||
"symfony/http-kernel": "~2.2|~3.0.0",
|
"symfony/http-kernel": "~2.7|~3.0.0",
|
||||||
"symfony/polyfill-php70": "~1.0"
|
"symfony/polyfill-php70": "~1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
@ -28,8 +28,8 @@
|
|||||||
"symfony/css-selector": "^2.0.5|~3.0.0",
|
"symfony/css-selector": "^2.0.5|~3.0.0",
|
||||||
"symfony/dom-crawler": "^2.0.5|~3.0.0",
|
"symfony/dom-crawler": "^2.0.5|~3.0.0",
|
||||||
"symfony/form": "~2.8",
|
"symfony/form": "~2.8",
|
||||||
"symfony/framework-bundle": "~2.8",
|
"symfony/framework-bundle": "^2.8.18",
|
||||||
"symfony/http-foundation": "~2.4|~3.0.0",
|
"symfony/http-foundation": "~2.7|~3.0.0",
|
||||||
"symfony/twig-bundle": "~2.7|~3.1.0",
|
"symfony/twig-bundle": "~2.7|~3.1.0",
|
||||||
"symfony/twig-bridge": "^2.7.4|~3.1.0",
|
"symfony/twig-bridge": "^2.7.4|~3.1.0",
|
||||||
"symfony/process": "^2.0.5|~3.0.0",
|
"symfony/process": "^2.0.5|~3.0.0",
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Console\Tests\Logger;
|
namespace Symfony\Component\Console\Tests\Logger;
|
||||||
|
|
||||||
use Psr\Log\Test\LoggerInterfaceTest;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Psr\Log\LogLevel;
|
use Psr\Log\LogLevel;
|
||||||
use Symfony\Component\Console\Logger\ConsoleLogger;
|
use Symfony\Component\Console\Logger\ConsoleLogger;
|
||||||
use Symfony\Component\Console\Tests\Fixtures\DummyOutput;
|
use Symfony\Component\Console\Tests\Fixtures\DummyOutput;
|
||||||
@ -21,8 +22,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
* Console logger test.
|
* Console logger test.
|
||||||
*
|
*
|
||||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
*/
|
*/
|
||||||
class ConsoleLoggerTest extends LoggerInterfaceTest
|
class ConsoleLoggerTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var DummyOutput
|
* @var DummyOutput
|
||||||
@ -30,7 +32,7 @@ class ConsoleLoggerTest extends LoggerInterfaceTest
|
|||||||
protected $output;
|
protected $output;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* @return LoggerInterface
|
||||||
*/
|
*/
|
||||||
public function getLogger()
|
public function getLogger()
|
||||||
{
|
{
|
||||||
@ -49,10 +51,121 @@ class ConsoleLoggerTest extends LoggerInterfaceTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* Return the log messages in order.
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getLogs()
|
public function getLogs()
|
||||||
{
|
{
|
||||||
return $this->output->getLogs();
|
return $this->output->getLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testImplements()
|
||||||
|
{
|
||||||
|
$this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideLevelsAndMessages
|
||||||
|
*/
|
||||||
|
public function testLogsAtAllLevels($level, $message)
|
||||||
|
{
|
||||||
|
$logger = $this->getLogger();
|
||||||
|
$logger->{$level}($message, array('user' => 'Bob'));
|
||||||
|
$logger->log($level, $message, array('user' => 'Bob'));
|
||||||
|
|
||||||
|
$expected = array(
|
||||||
|
$level.' message of level '.$level.' with context: Bob',
|
||||||
|
$level.' message of level '.$level.' with context: Bob',
|
||||||
|
);
|
||||||
|
$this->assertEquals($expected, $this->getLogs());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideLevelsAndMessages()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
|
||||||
|
LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
|
||||||
|
LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
|
||||||
|
LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
|
||||||
|
LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
|
||||||
|
LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
|
||||||
|
LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
|
||||||
|
LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \Psr\Log\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testThrowsOnInvalidLevel()
|
||||||
|
{
|
||||||
|
$logger = $this->getLogger();
|
||||||
|
$logger->log('invalid level', 'Foo');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testContextReplacement()
|
||||||
|
{
|
||||||
|
$logger = $this->getLogger();
|
||||||
|
$logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
|
||||||
|
|
||||||
|
$expected = array('info {Message {nothing} Bob Bar a}');
|
||||||
|
$this->assertEquals($expected, $this->getLogs());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testObjectCastToString()
|
||||||
|
{
|
||||||
|
if (method_exists($this, 'createPartialMock')) {
|
||||||
|
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString'));
|
||||||
|
} else {
|
||||||
|
$dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString'));
|
||||||
|
}
|
||||||
|
$dummy->expects($this->once())
|
||||||
|
->method('__toString')
|
||||||
|
->will($this->returnValue('DUMMY'));
|
||||||
|
|
||||||
|
$this->getLogger()->warning($dummy);
|
||||||
|
|
||||||
|
$expected = array('warning DUMMY');
|
||||||
|
$this->assertEquals($expected, $this->getLogs());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testContextCanContainAnything()
|
||||||
|
{
|
||||||
|
$context = array(
|
||||||
|
'bool' => true,
|
||||||
|
'null' => null,
|
||||||
|
'string' => 'Foo',
|
||||||
|
'int' => 0,
|
||||||
|
'float' => 0.5,
|
||||||
|
'nested' => array('with object' => new DummyTest()),
|
||||||
|
'object' => new \DateTime(),
|
||||||
|
'resource' => fopen('php://memory', 'r'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->getLogger()->warning('Crazy context data', $context);
|
||||||
|
|
||||||
|
$expected = array('warning Crazy context data');
|
||||||
|
$this->assertEquals($expected, $this->getLogs());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testContextExceptionKeyCanBeExceptionOrOtherValues()
|
||||||
|
{
|
||||||
|
$logger = $this->getLogger();
|
||||||
|
$logger->warning('Random message', array('exception' => 'oops'));
|
||||||
|
$logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
|
||||||
|
|
||||||
|
$expected = array(
|
||||||
|
'warning Random message',
|
||||||
|
'critical Uncaught Exception!',
|
||||||
|
);
|
||||||
|
$this->assertEquals($expected, $this->getLogs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DummyTest
|
||||||
|
{
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.9",
|
"php": ">=5.3.9",
|
||||||
"symfony/event-dispatcher": "~2.1|~3.0.0",
|
"symfony/event-dispatcher": "~2.1|~3.0.0",
|
||||||
"symfony/intl": "~2.4|~3.0.0",
|
"symfony/intl": "~2.7.25|^2.8.18|~3.2.5",
|
||||||
"symfony/options-resolver": "~2.6",
|
"symfony/options-resolver": "~2.6",
|
||||||
"symfony/polyfill-mbstring": "~1.0",
|
"symfony/polyfill-mbstring": "~1.0",
|
||||||
"symfony/property-access": "~2.3|~3.0.0"
|
"symfony/property-access": "~2.3|~3.0.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/collections": "~1.0",
|
"doctrine/collections": "~1.0",
|
||||||
"symfony/validator": "~2.8|~3.0.0",
|
"symfony/validator": "^2.8.18|~3.2.5",
|
||||||
"symfony/dependency-injection": "~2.3|~3.0.0",
|
"symfony/dependency-injection": "~2.3|~3.0.0",
|
||||||
"symfony/http-foundation": "~2.2|~3.0.0",
|
"symfony/http-foundation": "~2.2|~3.0.0",
|
||||||
"symfony/http-kernel": "~2.4|~3.0.0",
|
"symfony/http-kernel": "~2.4|~3.0.0",
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.9",
|
"php": ">=5.3.9",
|
||||||
"symfony/intl": "~2.7|~3.0.0"
|
"symfony/intl": "~2.7.25|^2.8.18|~3.2.5"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": { "Symfony\\Component\\Locale\\": "" },
|
"psr-4": { "Symfony\\Component\\Locale\\": "" },
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
"symfony/expression-language": "~2.6|~3.0.0",
|
"symfony/expression-language": "~2.6|~3.0.0",
|
||||||
"symfony/http-foundation": "~2.4|~3.0.0",
|
"symfony/http-foundation": "~2.4|~3.0.0",
|
||||||
"symfony/ldap": "~2.8|~3.0.0",
|
"symfony/ldap": "~2.8|~3.0.0",
|
||||||
"symfony/validator": "^2.5.9|~3.0.0",
|
"symfony/validator": "~2.7.25|^2.8.18|~3.2.5",
|
||||||
"psr/log": "~1.0"
|
"psr/log": "~1.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
"symfony/finder": "~2.3|~3.0.0",
|
"symfony/finder": "~2.3|~3.0.0",
|
||||||
"symfony/polyfill-intl-icu": "~1.0",
|
"symfony/polyfill-intl-icu": "~1.0",
|
||||||
"symfony/routing": "~2.2|~3.0.0",
|
"symfony/routing": "~2.2|~3.0.0",
|
||||||
"symfony/validator": "^2.5.9|~3.0.0",
|
"symfony/validator": "~2.7.25|^2.8.18|~3.2.5",
|
||||||
"psr/log": "~1.0",
|
"psr/log": "~1.0",
|
||||||
"symfony/expression-language": "~2.6|~3.0.0",
|
"symfony/expression-language": "~2.6|~3.0.0",
|
||||||
"symfony/ldap": "~2.8|~3.0.0"
|
"symfony/ldap": "~2.8|~3.0.0"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/config": "~2.8",
|
"symfony/config": "~2.8",
|
||||||
"symfony/intl": "~2.4|~3.0.0",
|
"symfony/intl": "~2.7.25|^2.8.18|~3.2.5",
|
||||||
"symfony/yaml": "~2.2|~3.0.0",
|
"symfony/yaml": "~2.2|~3.0.0",
|
||||||
"psr/log": "~1.0"
|
"psr/log": "~1.0"
|
||||||
},
|
},
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/http-foundation": "~2.3|~3.0.0",
|
"symfony/http-foundation": "~2.3|~3.0.0",
|
||||||
"symfony/intl": "~2.7.4|~2.8|~3.0.0",
|
"symfony/intl": "~2.7.25|^2.8.18|~3.2.5",
|
||||||
"symfony/yaml": "^2.0.5|~3.0.0",
|
"symfony/yaml": "^2.0.5|~3.0.0",
|
||||||
"symfony/config": "~2.2|~3.0.0",
|
"symfony/config": "~2.2|~3.0.0",
|
||||||
"symfony/property-access": "~2.3|~3.0.0",
|
"symfony/property-access": "~2.3|~3.0.0",
|
||||||
|
Reference in New Issue
Block a user