23 file_put_contents( $this->tmpFile,
"\x00" );
27 'Uploadstashtestsysop',
28 'Upload Stash Test Sysop',
29 'upload_stash_test_sysop@example.com',
33 'Uploadstashtestuser',
34 'Upload Stash Test User',
35 'upload_stash_test_user@example.com',
45 $this->
setMwGlobals(
'wgUser', self::$users[
'uploader']->getUser() );
51 $file = $stash->stashFile( $this->tmpFile );
53 $this->assertTrue(
true,
'Unrecognized file without extension' );
55 $stash->removeFile( $file->getFileKey() );
60 'Check failure on bad wpFileKey' =>
62 'Check failure on bad wpSessionKey' =>
76 'Check good wpFileKey' =>
77 [
new FauxRequest( [
'wpFileKey' =>
'testkey-test.test' ] ) ],
78 'Check good wpSessionKey' =>
79 [
new FauxRequest( [
'wpFileKey' =>
'testkey-test.test' ] ) ],
80 'Check key precedence' =>
82 'wpFileKey' =>
'testkey-test.test',
83 'wpSessionKey' =>
'foo'
95 $mockRepoStoreStatusResult = Status::newFatal(
'TEST_ERROR' );
96 $mockRepo = $this->getMockBuilder( FileRepo::class )
97 ->disableOriginalConstructor()
99 $mockRepo->expects( $this->once() )
100 ->method(
'storeTemp' )
101 ->willReturn( $mockRepoStoreStatusResult );
105 $stash->stashFile( $this->tmpFile );
106 $this->fail(
'Expected UploadStashFileException not thrown' );
108 $this->assertInstanceOf( ILocalizedException::class,
$e );
109 }
catch ( Exception
$e ) {
110 $this->fail(
'Unexpected exception class ' . get_class(
$e ) );
WebRequest clone which takes values from a provided array.
static singleton()
Get a RepoGroup instance.
Wraps the user object, so we can also retain full access to properties like password if we log in via...
static isValidRequest( $request)
testValidRequestWithValidRequests( $request)
provideValidRequests
testExceptionWhenStoreTempFails()
testValidRequestWithInvalidRequests( $request)
provideInvalidRequests
static provideInvalidRequests()
static provideValidRequests()
static TestUser[] $users
Array of UploadStashTestUser.
UploadStash is intended to accomplish a few things:
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
returning false will NOT prevent logging $e