[PhpUnitBridge] fix replaying skipped tests
This commit is contained in:
parent
13af58c57f
commit
849d1b3845
@ -121,7 +121,7 @@ class SymfonyTestsListenerTrait
|
|||||||
$suiteName = $suite->getName();
|
$suiteName = $suite->getName();
|
||||||
|
|
||||||
foreach ($suite->tests() as $test) {
|
foreach ($suite->tests() as $test) {
|
||||||
if (!($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
|
if (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (null === Test::getPreserveGlobalStateSettings(\get_class($test), $test->getName(false))) {
|
if (null === Test::getPreserveGlobalStateSettings(\get_class($test), $test->getName(false))) {
|
||||||
@ -156,7 +156,7 @@ class SymfonyTestsListenerTrait
|
|||||||
$testSuites = [$suite];
|
$testSuites = [$suite];
|
||||||
for ($i = 0; isset($testSuites[$i]); ++$i) {
|
for ($i = 0; isset($testSuites[$i]); ++$i) {
|
||||||
foreach ($testSuites[$i]->tests() as $test) {
|
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)) {
|
if (!class_exists($test->getName(), false)) {
|
||||||
$testSuites[] = $test;
|
$testSuites[] = $test;
|
||||||
continue;
|
continue;
|
||||||
@ -172,14 +172,21 @@ class SymfonyTestsListenerTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (2 === $this->state) {
|
} elseif (2 === $this->state) {
|
||||||
|
$suites = [$suite];
|
||||||
$skipped = [];
|
$skipped = [];
|
||||||
foreach ($suite->tests() as $test) {
|
while ($s = array_shift($suites)) {
|
||||||
if (!($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)
|
foreach ($s->tests() as $test) {
|
||||||
|| isset($this->wasSkipped[$suiteName]['*'])
|
if ($test instanceof \PHPUnit_Framework_TestSuite || $test instanceof TestSuite) {
|
||||||
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
|
$suites[] = $test;
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)
|
||||||
|
&& isset($this->wasSkipped[\get_class($test)][$test->getName()])
|
||||||
|
) {
|
||||||
$skipped[] = $test;
|
$skipped[] = $test;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$suite->setTests($skipped);
|
$suite->setTests($skipped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,21 +194,13 @@ class SymfonyTestsListenerTrait
|
|||||||
public function addSkippedTest($test, \Exception $e, $time)
|
public function addSkippedTest($test, \Exception $e, $time)
|
||||||
{
|
{
|
||||||
if (0 < $this->state) {
|
if (0 < $this->state) {
|
||||||
if ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase) {
|
$this->isSkipped[\get_class($test)][$test->getName()] = 1;
|
||||||
$class = \get_class($test);
|
|
||||||
$method = $test->getName();
|
|
||||||
} else {
|
|
||||||
$class = $test->getName();
|
|
||||||
$method = '*';
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->isSkipped[$class][$method] = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startTest($test)
|
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
|
// This event is triggered before the test is re-run in isolation
|
||||||
if ($this->willBeIsolated($test)) {
|
if ($this->willBeIsolated($test)) {
|
||||||
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
|
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
|
||||||
@ -291,7 +290,7 @@ class SymfonyTestsListenerTrait
|
|||||||
$this->expectedDeprecations = $this->gatheredDeprecations = [];
|
$this->expectedDeprecations = $this->gatheredDeprecations = [];
|
||||||
$this->previousErrorHandler = null;
|
$this->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)) {
|
if (\in_array('time-sensitive', $groups, true)) {
|
||||||
ClockMock::withClockMock(false);
|
ClockMock::withClockMock(false);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,18 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
|
|||||||
parent::setUp();
|
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
|
* @dataProvider formatTimezoneProvider
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user