Merge "tests: ensure __destruct is never doubled with anythingBut"

This commit is contained in:
jenkins-bot 2021-05-22 19:54:27 +00:00 committed by Gerrit Code Review
commit c32f07ed6a

View file

@ -24,6 +24,11 @@ trait MediaWikiTestCaseTrait {
* @return Constraint
*/
protected function anythingBut( ...$values ) {
if ( !in_array( '__destruct', $values, true ) ) {
// Ensure that __destruct is always included. PHPUnit will fail very hard with no
// useful output if __destruct ends up being called (T280780).
$values[] = '__destruct';
}
return $this->logicalNot( $this->logicalOr(
...array_map( [ $this, 'identicalTo' ], $values )
) );