Skip to content

[PhpUnitBridge] remove deprecated features #22792

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
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
13 changes: 13 additions & 0 deletions src/Symfony/Bridge/PhpUnit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CHANGELOG
=========

4.0.0
-----

* support for the `testLegacy` prefix in method names to mark a test as legacy
has been dropped, use the `@group legacy` notation instead
* support for the `Legacy` prefix in class names to mark tests as legacy has
been dropped, use the `@group legacy` notation instead
* support for passing an array of mocked namespaces not indexed by the mock
feature to the constructor of the `SymfonyTestsListenerTrait` class was
dropped
25 changes: 0 additions & 25 deletions src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,10 @@ public function __construct(array $mockedNamespaces = array())
Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 1;
}

$warn = false;
foreach ($mockedNamespaces as $type => $namespaces) {
if (!is_array($namespaces)) {
$namespaces = array($namespaces);
}
if (is_int($type)) {
// @deprecated BC with v2.8 to v3.0
$type = 'time-sensitive';
$warn = true;
}
if ('time-sensitive' === $type) {
foreach ($namespaces as $ns) {
ClockMock::register($ns.'\DummyClass');
Expand All @@ -81,9 +75,6 @@ public function __construct(array $mockedNamespaces = array())
$this->state = -2;
} else {
self::$globallyEnabled = true;
if ($warn) {
echo "Clock-mocked namespaces for SymfonyTestsListener need to be nested in a \"time-sensitive\" key. This will be enforced in Symfony 4.0.\n";
}
}
}

Expand Down Expand Up @@ -285,22 +276,6 @@ public function endTest($test, $time)
DnsMock::withMockedHosts(array());
}
}

if (($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase) && 0 === strpos($test->getName(), 'testLegacy') && !isset($this->testsWithWarnings[$test->getName()]) && !in_array('legacy', $groups, true)) {
$result = $test->getTestResultObject();

if (method_exists($result, 'addWarning')) {
$result->addWarning($test, new $Warning('Using the "testLegacy" prefix to mark tests as legacy is deprecated since version 3.3 and will be removed in 4.0. Use the "@group legacy" notation instead to add the test to the legacy group.'), $time);
}
}

if (($test instanceof \PHPUnit_Framework_TestCase || $test instanceof TestCase) && strpos($className, '\Legacy') && !isset($this->testsWithWarnings[$test->getName()]) && !in_array('legacy', $classGroups, true)) {
$result = $test->getTestResultObject();

if (method_exists($result, 'addWarning')) {
$result->addWarning($test, new $Warning('Using the "Legacy" prefix to mark all tests of a class as legacy is deprecated since version 3.3 and will be removed in 4.0. Use the "@group legacy" notation instead to add the test to the legacy group.'), $time);
}
}
}

public function handleError($type, $msg, $file, $line, $context)
Expand Down