This is a functionality of PHPUnit, not of MediaWiki. The idea is that each
test case (or function) is considered the most basic unit of testing. So
setUp() and tearDown() have to be called before and after each function to
ensure the testing environment is clean for the test.

*--*
*Tyler Romeo*
Stevens Institute of Technology, Class of 2015
Major in Computer Science
www.whizkidztech.com | tylerro...@gmail.com



On Mon, Sep 24, 2012 at 12:18 AM, Niklas Laxström <niklas.laxst...@gmail.com
> wrote:

> 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
>
> --
> Niklas Laxström
>
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to