[Bridge/PhpUnit] Fix disabling global state preservation
This commit is contained in:
parent
fde2874c51
commit
82b36e42bf
@ -97,6 +97,15 @@ class SymfonyTestsListenerTrait
|
|||||||
$suiteName = $suite->getName();
|
$suiteName = $suite->getName();
|
||||||
$this->testsWithWarnings = array();
|
$this->testsWithWarnings = array();
|
||||||
|
|
||||||
|
foreach ($suite->tests() as $test) {
|
||||||
|
if (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
|
||||||
|
$test->setPreserveGlobalState(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (-1 === $this->state) {
|
if (-1 === $this->state) {
|
||||||
echo "Testing $suiteName\n";
|
echo "Testing $suiteName\n";
|
||||||
$this->state = 0;
|
$this->state = 0;
|
||||||
@ -132,10 +141,6 @@ class SymfonyTestsListenerTrait
|
|||||||
if (in_array('dns-sensitive', $groups, true)) {
|
if (in_array('dns-sensitive', $groups, true)) {
|
||||||
DnsMock::register($test->getName());
|
DnsMock::register($test->getName());
|
||||||
}
|
}
|
||||||
} elseif (!($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase)) {
|
|
||||||
// no-op
|
|
||||||
} elseif (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
|
|
||||||
$test->setPreserveGlobalState(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,8 +151,6 @@ class SymfonyTestsListenerTrait
|
|||||||
|| isset($this->wasSkipped[$suiteName]['*'])
|
|| isset($this->wasSkipped[$suiteName]['*'])
|
||||||
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
|
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
|
||||||
$skipped[] = $test;
|
$skipped[] = $test;
|
||||||
} elseif (null === $Test::getPreserveGlobalStateSettings(get_class($test), $test->getName(false))) {
|
|
||||||
$test->setPreserveGlobalState(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$suite->setTests($skipped);
|
$suite->setTests($skipped);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Please update when phpunit needs to be reinstalled with fresh deps:
|
// Please update when phpunit needs to be reinstalled with fresh deps:
|
||||||
// Cache-Id-Version: 2017-11-22 09:00 UTC
|
// Cache-Id-Version: 2017-11-22 09:30 UTC
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user