Fix @dataProvider with PHPUnit 3.5.8+
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 5 Feb 2011 16:25:18 +0000 (16:25 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 5 Feb 2011 16:25:18 +0000 (16:25 +0000)
MediaWikiTestCase duplicates code from PHPUnit constructor. It worked
fine until PHPUnit 3.5.8 made FrameWork_TestCase attributes private,
thus the children class is no more able to update them ($data for example)
The change break any tests making use of the @dataProvider helper.

PHPUnit commit:
https://github.com/sebastianbergmann/phpunit/commit/0b85d08c39ce689bc7320ebc03e7e5a4bfdbcbac

TESTS:
3.5.7  : OK -> OK
3.5.8  : KO -> OK
3.5.10 : KO -> OK

make databaseless
Tests: 486, Assertions: 73986, Incomplete: 1, Skipped: 3.

(skipped tests are SQLite related)

tests/phpunit/MediaWikiTestCase.php

index 48b6212..da02fe7 100644 (file)
@@ -23,13 +23,8 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
        );
 
        function  __construct( $name = null, array $data = array(), $dataName = '' ) {
-               if ($name !== null) {
-                       $this->setName($name);
-               }
+               parent::__construct( $name, $data, $dataName );
 
-               $this->data = $data;
-               $this->dataName = $dataName;
-               
                $this->backupGlobals = false;
         $this->backupStaticAttributes = false;
        }