follow-up r94601 - add unit tests for stripping the File: prefix from upload, and...
authorBrian Wolff <bawolff@users.mediawiki.org>
Wed, 17 Aug 2011 04:05:11 +0000 (04:05 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Wed, 17 Aug 2011 04:05:11 +0000 (04:05 +0000)
(I have no idea if things like this (unit-tests) should be tagged 1.18, I assume no but am unsure)

tests/phpunit/includes/upload/UploadTest.php

index 21204ff..69c2903 100644 (file)
@@ -41,6 +41,16 @@ class UploadTest extends MediaWikiTestCase {
                        'A-B.jpg', UploadBase::OK,
                        'upload title with colon' );
 
+               /* Stripping leading File: prefix */
+               $this->assertUploadTitleAndCode( 'File:C.jpg',
+                       'C.jpg', UploadBase::OK,
+                       'upload title with File prefix' );
+
+               /* Test illegal suggested title (r94601) */
+               $this->assertUploadTitleAndCode( '%281%29.JPG',
+                       null, UploadBase::ILLEGAL_FILENAME,
+                       'illegal title for upload' );
+
                /* A title without extension */
                $this->assertUploadTitleAndCode( 'A',
                        null, UploadBase::FILETYPE_MISSING,