I'm writing unit tests for one of Translate classes.
In the setUp I need to create few pages, but I need to also control the user ids of the revisions. This seems to work well except for two things: * dataProvider methods are called *before* setUp, so I cannot use the user ids I have stored in setUp. * setUp and tearDown are called for *every* item in the dataProvider. This seems very wasteful - no wonder the tests takes minutes or so to run.
This just doesn't make any sense to me. I'm considering to stop using @dataProvider in this case - any other ideas?
The code in setUp is something like this:
$title = Title::makeTitle( NS_MEDIAWIKI, 'Key1/fi' ); $user = User::newFromName( 'Translate test user 1' ); $user->addToDatabase(); WikiPage::factory( $title )->doEdit( 'trans1', __METHOD__, 0, false, $user ); $this->user1 = $user;
-Niklas