Page MenuHomePhabricator

Disallow using setFakeTime() in PHPUnit data providers
Closed, ResolvedPublic

Description

The problem in T371460 happened because a data provider called ConvertibleTimestamp::setFakeTime( ... );, affecting data providers for other tests that called wfTimestamp( ... ) and expected to see the real current time.

We should disallow using setFakeTime() in PHPUnit data providers. See also T358451: Disallow access to globals and MediaWikiServices during the execution of PHPUnit data providers, which is the same idea, but for MediaWiki's various pieces of global state.

Event Timeline

Change #1058578 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] tests: Disallow using setFakeTime() in PHPUnit data providers

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

Change #1058578 merged by jenkins-bot:

[mediawiki/core@master] tests: Disallow using setFakeTime() in PHPUnit data providers

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

Krinkle assigned this task to matmarex.
Krinkle removed a project: Patch-For-Review.
Krinkle moved this task from Inbox to PHPUnit on the MediaWiki-Core-Tests board.