From 35706f4206936a2f92648f86e5668b1f96e71a88 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Wed, 17 Aug 2011 04:05:11 +0000 Subject: [PATCH] follow-up r94601 - add unit tests for stripping the File: prefix from upload, and test handling illegal characters in upload title (thing that caused the issue in r94601) (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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/phpunit/includes/upload/UploadTest.php b/tests/phpunit/includes/upload/UploadTest.php index 21204ffbc9..69c2903294 100644 --- a/tests/phpunit/includes/upload/UploadTest.php +++ b/tests/phpunit/includes/upload/UploadTest.php @@ -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, -- 2.20.1