3 use MediaWiki\Request\FauxRequest
;
10 class UploadStashTest
extends MediaWikiIntegrationTestCase
{
16 protected function setUp(): void
{
19 $this->tmpFile
= $this->getNewTempFile();
20 file_put_contents( $this->tmpFile
, "\x00" );
23 public static function provideInvalidRequests() {
25 'Check failure on bad wpFileKey' =>
26 [ new FauxRequest( [ 'wpFileKey' => 'foo' ] ) ],
27 'Check failure on bad wpSessionKey' =>
28 [ new FauxRequest( [ 'wpSessionKey' => 'foo' ] ) ],
33 * @dataProvider provideInvalidRequests
35 public function testValidRequestWithInvalidRequests( $request ) {
36 $this->assertFalse( UploadFromStash
::isValidRequest( $request ) );
39 public static function provideValidRequests() {
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' =>
47 'wpFileKey' => 'testkey-test.test',
48 'wpSessionKey' => 'foo'
54 * @dataProvider provideValidRequests
56 public function testValidRequestWithValidRequests( $request ) {
57 $this->assertTrue( UploadFromStash
::isValidRequest( $request ) );