Merge branch '4.4' into 5.1

* 4.4:
  [PhpUnitBridge] fix replaying skipped tests
  Switch nightly run to 8.0snapshot
This commit is contained in:
Nicolas Grekas 2020-11-03 12:59:17 +01:00
commit 298422c844
3 changed files with 34 additions and 23 deletions

View File

@ -28,11 +28,11 @@ matrix:
env: deps=high
- php: 7.4
env: deps=low
- php: nightly
- php: 8.0snapshot
services: [memcached]
fast_finish: true
allow_failures:
- php: nightly
- php: 8.0snapshot
services: [memcached]
cache:
@ -140,7 +140,7 @@ before_install:
echo session.gc_probability = 0 >> $INI
echo opcache.enable_cli = 1 >> $INI
echo apc.enable_cli = 1 >> $INI
if [[ $PHP != nightly ]]; then
if [[ $PHP != 8.* ]]; then
echo extension = memcached.so >> $INI
fi
done
@ -156,7 +156,7 @@ before_install:
if ! php --ri sodium > /dev/null; then
tfold ext.libsodium tpecl libsodium sodium.so $INI
fi
if [[ $PHP = nightly ]]; then
if [[ $PHP = 8.* ]]; then
tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
else
tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI
@ -234,7 +234,7 @@ install:
- |
# Set composer's platform to php 7.4 if we're on php 8.
if [[ $PHP = nightly ]]; then
if [[ $PHP = 8.* ]]; then
composer config platform.php 7.4.99
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
fi

View File

@ -123,7 +123,7 @@ class SymfonyTestsListenerTrait
$suiteName = $suite->getName();
foreach ($suite->tests() as $test) {
if (!($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
if (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
continue;
}
if (null === Test::getPreserveGlobalStateSettings(\get_class($test), $test->getName(false))) {
@ -158,7 +158,7 @@ class SymfonyTestsListenerTrait
$testSuites = [$suite];
for ($i = 0; isset($testSuites[$i]); ++$i) {
foreach ($testSuites[$i]->tests() as $test) {
if ($test instanceof TestSuite) {
if ($test instanceof \PHPUnit_Framework_TestSuite || $test instanceof TestSuite) {
if (!class_exists($test->getName(), false)) {
$testSuites[] = $test;
continue;
@ -174,12 +174,19 @@ class SymfonyTestsListenerTrait
}
}
} elseif (2 === $this->state) {
$suites = [$suite];
$skipped = [];
foreach ($suite->tests() as $test) {
if (!($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)
|| isset($this->wasSkipped[$suiteName]['*'])
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
$skipped[] = $test;
while ($s = array_shift($suites)) {
foreach ($s->tests() as $test) {
if ($test instanceof \PHPUnit_Framework_TestSuite || $test instanceof TestSuite) {
$suites[] = $test;
continue
}
if (($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)
&& isset($this->wasSkipped[\get_class($test)][$test->getName()])
) {
$skipped[] = $test;
}
}
}
$suite->setTests($skipped);
@ -189,21 +196,13 @@ class SymfonyTestsListenerTrait
public function addSkippedTest($test, \Exception $e, $time)
{
if (0 < $this->state) {
if ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase) {
$class = \get_class($test);
$method = $test->getName();
} else {
$class = $test->getName();
$method = '*';
}
$this->isSkipped[$class][$method] = 1;
$this->isSkipped[\get_class($test)][$test->getName()] = 1;
}
}
public function startTest($test)
{
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
if (-2 < $this->state && ($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
// This event is triggered before the test is re-run in isolation
if ($this->willBeIsolated($test)) {
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
@ -313,7 +312,7 @@ class SymfonyTestsListenerTrait
self::$expectedDeprecations = self::$gatheredDeprecations = [];
self::$previousErrorHandler = null;
}
if (!$this->runsInSeparateProcess && -2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
if (!$this->runsInSeparateProcess && -2 < $this->state && ($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
if (\in_array('time-sensitive', $groups, true)) {
ClockMock::withClockMock(false);
}

View File

@ -30,6 +30,18 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
parent::setUp();
}
/**
* @dataProvider formatProvider
*/
public function testFormat($pattern, $timestamp, $expected)
{
if (\PHP_VERSION_ID < 70105 && $timestamp instanceof \DateTimeImmutable) {
$this->markTestSkipped('PHP >= 7.1.5 required for DateTimeImmutable.');
}
parent::testFormat($pattern, $timestamp, $expected);
}
/**
* @dataProvider formatTimezoneProvider
*/