Page MenuHomePhabricator

Using expectException to check for php notices or deprecations is deprecated in phpunit 9
Closed, ResolvedPublic

Description

Using

use PHPUnit\Framework\Error\Notice;
[...]
$this->expectException( Notice::class );

in tests gets deprecated in phpunit 9 - https://thephp.cc/news/2020/02/migrating-to-phpunit-9 - and should be replaced with:

$this->expectNotice();

which is already available with at least phpunit 8.5

Some places to do:
https://codesearch.wmcloud.org/search/?q=PHPUnit%5C%5CFramework%5C%5CError&i=nope&files=&repos=

Event Timeline

Change 653543 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[IPSet@master] Use expectWarning() in phpunit tests

https://gerrit.wikimedia.org/r/653543

Change 653544 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[AhoCorasick@master] Use expectWarning() in phpunit tests

https://gerrit.wikimedia.org/r/653544

Change 653547 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/Wikibase@master] Use expectWarning() in phpunit tests

https://gerrit.wikimedia.org/r/653547

Change 653551 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@master] Use expectWarning() in phpunit tests

https://gerrit.wikimedia.org/r/653551

Change 653543 merged by jenkins-bot:
[IPSet@master] Use expectWarning() in phpunit tests

https://gerrit.wikimedia.org/r/653543

Change 653544 merged by jenkins-bot:
[AhoCorasick@master] Use expectWarning() in phpunit tests

https://gerrit.wikimedia.org/r/653544

Change 653547 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Use expectWarning() in phpunit tests

https://gerrit.wikimedia.org/r/653547

Change 653551 merged by jenkins-bot:
[mediawiki/core@master] Use expectWarning/Deprecation/Notice/Error() in phpunit tests

https://gerrit.wikimedia.org/r/653551

Umherirrender claimed this task.
Umherirrender triaged this task as Medium priority.