Commit graph

306 commits

Author SHA1 Message Date
Antoine Musso
2fad923859 split tests for ArticleTest 2011-07-03 17:51:11 +00:00
Antoine Musso
cde767dd89 throw an exception on !is_executable( $wgExiv2Command ) 2011-07-01 18:34:50 +00:00
Chad Horohoe
85a5f0eb85 Merge ApiTestSetup into ApiTestCase and update all subclasses. The amount of duplication here was nasty, and also lets us get rid of a bunch of useless require_once()s.
./phpunit.php --filter Api currently gives me: Tests: 24, Assertions: 107, Incomplete: 1, Skipped: 2.
2011-07-01 16:34:02 +00:00
Antoine Musso
23a14b810a test that wfUrlencode() encodes apostrophe 2011-06-30 21:14:33 +00:00
Chad Horohoe
25bf6f5b43 Fixed a long-standing broken test:
1) ApiUploadTest::testUploadStash
Failed asserting that <boolean:true> is false.

Did this by copying the correct stuff from $_SESSION to our local $session we're using for the test. Not sure if this is strictly correct, but hey it passes ;-)

Currently at: Tests: 1622, Assertions: 32090, Incomplete: 8, Skipped: 5.
2011-06-30 20:11:45 +00:00
Sam Reed
35205cfd4e Followup r91087, rename directory 2011-06-30 16:41:50 +00:00
Aaron Schulz
930ccf282c * Split off WikiPage class from Article, WikiFilePage class from ImagePage, and WikiCategoryPage from CategoryPage.
* WikiPage functions/fields are "magically" part of Article when accessed for b/c. Magic is kind of ugly but there are too many callers to make breaking changes atm. Some functions are just wrappers for WikiPage ones (were magic won't work).
* Added newFromID() to each WikiPage subclass (works around pre-existing inheritance problem).
* Added Page class for convenient type hinting and changed hints from Article -> Page. This lets things use WikiPage objects without getting type errors.
* Updated FlaggedPage to extend WikiPage. Worked around getOldIdFromRequest().
* Added setTimestamp() to WikiPage and moved some timestamp setting code from ParserCache to Article.
* Removed ampersands from $dbw arguments.
* @TODO: dependency inject user objects for WikiPage

The idea is to migrate things to use WikiPage, as the run-of-the-mill "new Article()" call doesn't care about $oldid and $wgRequest. After that, Article, ImagePage, and CategoryPage can be rewritten as an Action class or something sane (a Viewer class of sorts).
2011-06-29 22:09:51 +00:00
Antoine Musso
67540f8ee4 basic tests for wfUrlencode
Please note this function use a static variable based on the value
of $GLOBALS[’SERVER_SOFTWARE'].  With PHP 5.2 and PHPUnit 3.5.x, there
is currently now way to reset the static variable :-/   Tests relying on
a change of SERVER_SOFTWARE are thus skipped, still the framework is there
for later use.
2011-06-29 20:28:43 +00:00
Bryan Tong Minh
c87574b7b4 Add wfUnserialize() wrapper around unserialize to prevent E_NOTICE and use it in ExifBitmap.php. There are probably many more places that could use this. This should fix Platonides' problem at r90421, but also added a check for $wgShowExif to prevent the test from failing. 2011-06-29 20:24:53 +00:00
Antoine Musso
cf2cfce087 Move global functions tests to their own directory.
Will let us create a test file for each functions which is easier to handle
in the long time.
2011-06-29 17:59:50 +00:00
Platonides
eadb8a3e73 Delay expansion of XmlSelect options until getting the HTML.
Setting the default after adding options now works.
Enabled testSetDefaultAfterAddingOptions().
2011-06-29 14:15:47 +00:00
Platonides
eded6a8db8 Make BitmapMetadataHandlerTest incomplete if $wgShowEXIF is not set.
It was throwing 'MWException: Internal error: exif_read_data not present. $wgShowEXIF may be incorrectly set or not checked by an extension.'
Fixed typo in LocalSettings.
2011-06-29 13:45:57 +00:00
Alexandre Emsenhuber
f82b49e02b Pass the Title object to Parser::transformMsg() 2011-06-29 10:58:54 +00:00
Chad Horohoe
9d2a5d2b30 Basic first round of testing for the InstallDocFormatter 2011-06-29 01:26:56 +00:00
Chad Horohoe
7edadc1e78 Remove superfluous NewDBTest, doesn't test anything afaict 2011-06-28 23:03:41 +00:00
Chad Horohoe
41b8ec6031 Merge SearchDbTest into SearchEngineTest. No real need for two classes here anymore, and it's kind of confusing if you try to run the stub by itself.
Also did some misc. cleanup while I was here

Results: OK (5 tests, 16 assertions)
2011-06-28 22:26:22 +00:00
Mark A. Hershberger
780ba99ac8 random eol w/s annoys me. 2011-06-26 20:04:38 +00:00
Brian Wolff
cf32ccd072 Per CR on r86169, start adding unit tests for metadata extraction.
This is just some initial tests that really only cover png's. I plan
to add more soon.

Also well I'm here, fix the svn prop on broken_exif_date.jpg from r90421.
2011-06-23 23:25:49 +00:00
Antoine Musso
940f3d5f93 update tests for Xml::label which now support 'title' attribute
follow up r90669
2011-06-23 20:05:32 +00:00
Matěj Grabovský
09da27efa2 wfArrayToCGI() and wfCgiToArray() now handle nested and associative arrays almost correctly
The only problem is that all the indexes have to be set, thus "key[]=value" won't get parsed correctly and array( 'key' => array( 'value' ) ) will transform to "key[0]=value".

Related bug 28928 and bug 22989.
2011-06-23 15:25:07 +00:00
Sam Reed
042dd2f008 require_once dirname( dirname( __FILE__ ) ) . '/api/ApiSetup.php';
Followup r90607
2011-06-22 22:11:31 +00:00
Sam Reed
2adda03fed Move upload tests to upload folder 2011-06-22 21:34:18 +00:00
Sam Reed
7f3098b07d Kill var_dump from r90603 2011-06-22 21:32:42 +00:00
Platonides
4a6f236904 Readd r90538, this time with the missing global $wgHooks; 2011-06-22 21:02:07 +00:00
Alexandre Emsenhuber
44574b23b0 Removed hidden usage of $wgTitle in parser and the workarround in ExtraParserTest.php 2011-06-22 17:45:31 +00:00
Chad Horohoe
65e2d85048 Provisional revert of r90538. I can't replicate the failures, but CI's been complaining since this commit 2011-06-22 00:01:15 +00:00
Chad Horohoe
c22e9c06aa *grumble grumble* stupid fime on r90192 2011-06-21 21:38:29 +00:00
Platonides
1d7f09a4f7 UploadTest::testTitleValidation accessed the database to fetch the interwikis.
phase3/includes/upload/UploadBase.php:620
phase3/tests/phpunit/includes/UploadTest.php:120
phase3/tests/phpunit/includes/UploadTest.php:55
phase3/tests/phpunit/includes/UploadTest.php:35

$wgContLang not needed, TitlePermissionTest.php changes the language, inheriting from MediaWikiLangTestCase
2011-06-21 17:41:25 +00:00
Platonides
f5dec1eefa Revert r90483, if tesla has problems, it should get proper permissions to the affected folders (or change the test to use a temp folder)
The test was not consistent, since first time it would use the svn file, which renames it... and on next run it would be missing!
I added the '.' to the unlik() step so it properly cleans up. Opened bug 29512 for the strange UploadStash behavior.

However, although it passes now most of the times, it sometimes fails with the strange exception:
Only variables should be passed by reference

phase3/includes/upload/UploadStash.php:143
phase3/tests/phpunit/includes/upload/UploadStashTest.php:22
phase3/tests/phpunit/MediaWikiTestCase.php:64
phase3/tests/phpunit/MediaWikiPHPUnitCommand.php:20
phase3/tests/phpunit/phpunit.php:60
2011-06-21 15:06:59 +00:00
Neil Kandalgaonkar
7c44f1821b create images with orientation (had to use exiv2 hack, imagemagick not helpful) 2011-06-21 03:40:53 +00:00
Chad Horohoe
d12cc8a163 Mark test incomplete for a legitimate reason like trying to serialize a PDO object--rather than imaginary ones such as blaming memory_limit being too low when the test was being stupid and lowering it for us. 2011-06-20 20:24:53 +00:00
Bryan Tong Minh
f66a1c1bb9 (bug 29471) Exception thrown for files with invalid date in metadata
MediaWiki doesn't handle BC dates nicely, so check for that.
2011-06-19 21:38:58 +00:00
Chad Horohoe
81ad5dc1c5 Remove another empty test, courtesy of r65504. 2011-06-19 18:46:03 +00:00
Max Semenik
94035c764f Follow-up r90356 & r90363: test deleteJoin() on SQLite 2011-06-18 20:37:02 +00:00
Bryan Tong Minh
1e40ea1a75 Follow-up r90340: just add the test file to SVN, which hopefully fixes the cruisecontrol problems. 2011-06-18 17:27:32 +00:00
Bryan Tong Minh
9bbe0bc566 (bug 29408) Key 'something.' is not in a proper format
Fixed this by relaxing the stash key regex. For some files MediaWiki is simply not able to guess an extension. If the wiki has been configured to allow them, we should just let them pass in the stash as well.
2011-06-18 14:56:14 +00:00
Neil Kandalgaonkar
89cbb38778 fix invocation of static function 2011-06-18 03:36:44 +00:00
Neil Kandalgaonkar
5c540ab621 generate random triangles (so we can test EXIF orientation, eventually) 2011-06-17 23:26:45 +00:00
Ryan Kaldari
a392d14dae skip gzip tests if gzip is turned off 2011-06-17 21:15:24 +00:00
Sam Reed
8bfd19b451 Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits (3/3), so hopefully reviewable in CR...
2011-06-17 16:05:35 +00:00
Platonides
efbd16e825 Copy teardownUploadDir(),deleteFiles(),deleteDirs() from parserTest.inc Move down teardownGlobals()
This almost fixes the issue of hundreds of leaking mwParser-*-images files at temp dir.
For some unknown reason, there's still one instance left, though.

PS: I thought I had committed this time ago...
2011-06-16 21:07:37 +00:00
Platonides
807ea51cb3 Mark as needing a db.
Remove double data insertion
2011-06-16 21:06:11 +00:00
Sam Reed
f2875b43f3 Fix indenting 2011-06-16 20:57:31 +00:00
Brion Vibber
13b1da185e * (bug 29426) Fix wrong use of Block::load's second parameter in BlockTest
It was accidentally passing a username where it should have passed a user ID, causing PostgreSQL's stricter comparisons to fail, while MySQL's allowed it to run without complaint but returned bad results.
Of course that bug got hidden by the test.... testing the wrong thing... :)

Now correctly loads using the user id instead of name, checks the proper return values, and actually compares the right object.
2011-06-16 17:58:26 +00:00
Tim Starling
b4311ca022 Fixes for r90105, r90193:
* Actually removed $wgProto.
* Per Aryeh's suggestions on the future of $wgServer: made $wgServer detection in DefaultSettings.php more permanent by merging it with the new code from r90105. This means that bug 14977 is properly fixed now. 
* Require entry points to set up the autoloader before including DefaultSettings.php. Comments on bug 14977 indicate that at some point in the past, this may have broken something. Anything that breaks now should just be fixed, we need the autoloader. Tested the most common entry points.
* Since the detection code has moved from Installer to WebRequest, I also moved the relevant test file and updated the test. The function under test is now public static, so r90154 is superseded.
2011-06-16 05:52:16 +00:00
Chad Horohoe
860cdbc0ff Followup to r89452, remove ftp test cases since Http::isValidUri() doesn't do ftp anymore 2011-06-16 02:58:00 +00:00
Chad Horohoe
9293607412 Another stub test file...this one has been like this since r72258 2011-06-15 23:24:23 +00:00
Chad Horohoe
739cecd548 Another empty "Has not been implemented" test 2011-06-15 23:17:11 +00:00
Platonides
bbc37da45b Followup 90161 (which breaks the test). Need to hack around to avoid a reload from db. 2011-06-15 21:32:08 +00:00
Platonides
7035bb4034 r87164 removed mDataLoaded and broke this test databaseless nature. 2011-06-15 21:22:08 +00:00