diff options
author | Paul Copperman <pcopp@users.mediawiki.org> | 2011-04-07 14:54:38 +0000 |
---|---|---|
committer | Paul Copperman <pcopp@users.mediawiki.org> | 2011-04-07 14:54:38 +0000 |
commit | f7e6dfb4a33b2fd4dabf613d69e1824e39772aa6 (patch) | |
tree | 8c969f75c6c19f34e37244a2abe1dfdcb8a50322 /tests/phpunit | |
parent | 672e9f6a2ad2cd6b859d6c435529dc5c06b83240 (diff) | |
download | mediawikicore-f7e6dfb4a33b2fd4dabf613d69e1824e39772aa6.tar.gz mediawikicore-f7e6dfb4a33b2fd4dabf613d69e1824e39772aa6.zip |
Various fixes for PHPUnit tests:
* Block.php: Set mExpiry to the value we store in the database, so that Block::equals() returns true. Fixes BlockTest::testInitializerFunctionsReturnCorrectBlock.
* In Title::checkUserBlock(): Convert message parameters to plain strings to make strict comparisons work. Fixes TitlePermissionTest::testUserBlock().
* ApiBlock.php: Follow-Up r85166, add 'Confirm' parameter to data array. Fixes ApiBlockTest::testMakeNormalBlock().
* ApiQueryTest.php: Use $wgMetaNamespace instead of $wgSitename to account for customizations.
* RandomImageGenerator.php: Use default value for constructor param to prevent fatals.
* ApiTestCaseUpload.php:
** Fix undefined variable $fileName.
** Remove stray ini_set statements, they don't belong there. Especially ini_set( 'error_reporting', 1 ) will effectively disable all reporting, which makes errors hard to track.
* ArticleTablesTest.php: Put testbug14404() in group Broken, as the fix for the bug has been reverted in r83868.
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/85618
Diffstat (limited to 'tests/phpunit')
-rw-r--r-- | tests/phpunit/includes/ArticleTablesTest.php | 5 | ||||
-rw-r--r-- | tests/phpunit/includes/TitlePermissionTest.php | 4 | ||||
-rw-r--r-- | tests/phpunit/includes/api/ApiQueryTest.php | 4 | ||||
-rw-r--r-- | tests/phpunit/includes/api/ApiTestCaseUpload.php | 6 | ||||
-rw-r--r-- | tests/phpunit/includes/api/RandomImageGenerator.php | 2 |
5 files changed, 10 insertions, 11 deletions
diff --git a/tests/phpunit/includes/ArticleTablesTest.php b/tests/phpunit/includes/ArticleTablesTest.php index 3db0b5510950..a35af50e41bf 100644 --- a/tests/phpunit/includes/ArticleTablesTest.php +++ b/tests/phpunit/includes/ArticleTablesTest.php @@ -18,7 +18,10 @@ class ArticleTablesTest extends MediaWikiTestCase { $wgContLang = new StubContLang; $wgLang = new StubUserLang; } - + + /** + * @group Broken + */ function testbug14404() { global $wgUser, $wgContLang, $wgLanguageCode, $wgLang; diff --git a/tests/phpunit/includes/TitlePermissionTest.php b/tests/phpunit/includes/TitlePermissionTest.php index 07c76e511475..2b675d58b71e 100644 --- a/tests/phpunit/includes/TitlePermissionTest.php +++ b/tests/phpunit/includes/TitlePermissionTest.php @@ -625,7 +625,7 @@ class TitlePermissionTest extends MediaWikiTestCase { $this->user->mBlock->mTimestamp = 0; $this->assertEquals( array( array( 'autoblockedtext', '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1', - 'Useruser', 0, 'infinite', '127.0.8.1', + 'Useruser', null, 'infinite', '127.0.8.1', $wgLang->timeanddate( wfTimestamp( TS_MW, $prev ), true ) ) ), $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); @@ -639,7 +639,7 @@ class TitlePermissionTest extends MediaWikiTestCase { $this->user->mBlock = new Block( '127.0.8.1', 2, 1, 'no reason given', $now, 0, 10 ); $this->assertEquals( array( array( 'blockedtext', '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1', - 'Useruser', 0, '23:00, 31 December 1969', '127.0.8.1', + 'Useruser', null, '23:00, 31 December 1969', '127.0.8.1', $wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ) ), $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); diff --git a/tests/phpunit/includes/api/ApiQueryTest.php b/tests/phpunit/includes/api/ApiQueryTest.php index 9e857048868f..5c9ef93b9bc1 100644 --- a/tests/phpunit/includes/api/ApiQueryTest.php +++ b/tests/phpunit/includes/api/ApiQueryTest.php @@ -14,7 +14,7 @@ class ApiQueryTest extends ApiTestSetup { function testTitlesGetNormalized() { - global $wgSitename; + global $wgMetaNamespace; $data = $this->doApiRequest( array( 'action' => 'query', @@ -27,7 +27,7 @@ class ApiQueryTest extends ApiTestSetup { $this->assertEquals( array( 'from' => 'Project:articleA', - 'to' => $wgSitename . ':ArticleA' + 'to' => $wgMetaNamespace . ':ArticleA' ), $data[0]['query']['normalized'][0] ); diff --git a/tests/phpunit/includes/api/ApiTestCaseUpload.php b/tests/phpunit/includes/api/ApiTestCaseUpload.php index a7fc9bd3d356..7703a7ef10d9 100644 --- a/tests/phpunit/includes/api/ApiTestCaseUpload.php +++ b/tests/phpunit/includes/api/ApiTestCaseUpload.php @@ -18,10 +18,6 @@ abstract class ApiTestCaseUpload extends ApiTestCase { $wgEnableAPI = true; wfSetupSession(); - ini_set( 'log_errors', 1 ); - ini_set( 'error_reporting', 1 ); - ini_set( 'display_errors', 1 ); - $this->clearFakeUploads(); } @@ -51,7 +47,7 @@ abstract class ApiTestCaseUpload extends ApiTestCase { $article->doDeleteArticle( "removing for test" ); // see if it now doesn't exist; reload - $title = Title::newFromText( $fileName, NS_FILE ); + $title = Title::newFromText( $title->getText(), NS_FILE ); } return ! ( $title && $title instanceof Title && $title->exists() ); } diff --git a/tests/phpunit/includes/api/RandomImageGenerator.php b/tests/phpunit/includes/api/RandomImageGenerator.php index 6bb9d00feebf..169d39dda93c 100644 --- a/tests/phpunit/includes/api/RandomImageGenerator.php +++ b/tests/phpunit/includes/api/RandomImageGenerator.php @@ -34,7 +34,7 @@ class RandomImageGenerator { private $circlesToDraw = 5; private $imageWriteMethod; - public function __construct( $options ) { + public function __construct( $options = array() ) { global $wgUseImageMagick, $wgImageMagickConvertCommand; foreach ( array( 'dictionaryFile', 'minWidth', 'minHeight', 'maxHeight', 'circlesToDraw' ) as $property ) { if ( isset( $options[$property] ) ) { |