gallery: Fix phan annotation for ImageGalleryBase::getImages
[mediawiki.git] / tests / phpunit / includes / upload / UploadStashTest.php
blob4ff5cb44492dd9890e735902a1f2662b23b7d823
1 <?php
3 use MediaWiki\Request\FauxRequest;
5 /**
6 * @group Database
8 * @covers \UploadStash
9 */
10 class UploadStashTest extends MediaWikiIntegrationTestCase {
11 /**
12 * @var string
14 private $tmpFile;
16 protected function setUp(): void {
17 parent::setUp();
19 $this->tmpFile = $this->getNewTempFile();
20 file_put_contents( $this->tmpFile, "\x00" );
23 public static function provideInvalidRequests() {
24 return [
25 'Check failure on bad wpFileKey' =>
26 [ new FauxRequest( [ 'wpFileKey' => 'foo' ] ) ],
27 'Check failure on bad wpSessionKey' =>
28 [ new FauxRequest( [ 'wpSessionKey' => 'foo' ] ) ],
32 /**
33 * @dataProvider provideInvalidRequests
35 public function testValidRequestWithInvalidRequests( $request ) {
36 $this->assertFalse( UploadFromStash::isValidRequest( $request ) );
39 public static function provideValidRequests() {
40 return [
41 'Check good wpFileKey' =>
42 [ new FauxRequest( [ 'wpFileKey' => 'testkey-test.test' ] ) ],
43 'Check good wpSessionKey' =>
44 [ new FauxRequest( [ 'wpFileKey' => 'testkey-test.test' ] ) ],
45 'Check key precedence' =>
46 [ new FauxRequest( [
47 'wpFileKey' => 'testkey-test.test',
48 'wpSessionKey' => 'foo'
49 ] ) ],
53 /**
54 * @dataProvider provideValidRequests
56 public function testValidRequestWithValidRequests( $request ) {
57 $this->assertTrue( UploadFromStash::isValidRequest( $request ) );