Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[PhpUnitBridge] fix replaying skipped tests #38971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[PhpUnitBridge] fix replaying skipped tests
  • Loading branch information
nicolas-grekas committed Nov 3, 2020
commit 849d1b3845a4ed2dc59a1a3eac1c55368b256b05
35 changes: 17 additions & 18 deletions 35 src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function startTestSuite($suite)
$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))) {
Expand Down Expand Up @@ -156,7 +156,7 @@ public function startTestSuite($suite)
$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;
Expand All @@ -172,12 +172,19 @@ public function startTestSuite($suite)
}
}
} 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);
Expand All @@ -187,21 +194,13 @@ public function startTestSuite($suite)
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');
Expand Down Expand Up @@ -291,7 +290,7 @@ public function endTest($test, $time)
$this->expectedDeprecations = $this->gatheredDeprecations = [];
$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)) {
ClockMock::withClockMock(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ protected function setUp(): void
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
*/
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.