X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fupload%2FUploadStashTest.php;h=e1db084baa914f80dc926b7f39d29607f0d2273f;hb=58713d2b1611e55fcd0cf7647af8d96ebc1e88bf;hp=8f9eabe9f86a77840ed7a9c8444383ca96df7526;hpb=04fdc78370dbc042116488d6826e19bf3910273b;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/upload/UploadStashTest.php b/tests/phpunit/includes/upload/UploadStashTest.php index 8f9eabe9f8..e1db084baa 100644 --- a/tests/phpunit/includes/upload/UploadStashTest.php +++ b/tests/phpunit/includes/upload/UploadStashTest.php @@ -7,7 +7,7 @@ */ class UploadStashTest extends MediaWikiTestCase { /** - * @var array Array of UploadStashTestUser + * @var TestUser[] Array of UploadStashTestUser */ public static $users; @@ -23,20 +23,20 @@ class UploadStashTest extends MediaWikiTestCase { $this->bug29408File = wfTempDir() . '/bug29408'; file_put_contents( $this->bug29408File, "\x00" ); - self::$users = array( + self::$users = [ 'sysop' => new TestUser( 'Uploadstashtestsysop', 'Upload Stash Test Sysop', 'upload_stash_test_sysop@example.com', - array( 'sysop' ) + [ 'sysop' ] ), 'uploader' => new TestUser( 'Uploadstashtestuser', 'Upload Stash Test User', 'upload_stash_test_user@example.com', - array() + [] ) - ); + ]; } protected function tearDown() { @@ -55,10 +55,8 @@ class UploadStashTest extends MediaWikiTestCase { * @todo give this test a real name explaining what is being tested here */ public function testBug29408() { - $this->setMwGlobals( 'wgUser', self::$users['uploader']->user ); - $repo = RepoGroup::singleton()->getLocalRepo(); - $stash = new UploadStash( $repo ); + $stash = new UploadStash( $repo, self::$users['uploader']->getUser() ); // Throws exception caught by PHPUnit on failure $file = $stash->stashFile( $this->bug29408File ); @@ -69,12 +67,12 @@ class UploadStashTest extends MediaWikiTestCase { } public static function provideInvalidRequests() { - return array( + return [ 'Check failure on bad wpFileKey' => - array( new FauxRequest( array( 'wpFileKey' => 'foo' ) ) ), + [ new FauxRequest( [ 'wpFileKey' => 'foo' ] ) ], 'Check failure on bad wpSessionKey' => - array( new FauxRequest( array( 'wpSessionKey' => 'foo' ) ) ), - ); + [ new FauxRequest( [ 'wpSessionKey' => 'foo' ] ) ], + ]; } /** @@ -85,17 +83,17 @@ class UploadStashTest extends MediaWikiTestCase { } public static function provideValidRequests() { - return array( + return [ 'Check good wpFileKey' => - array( new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) ) ), + [ new FauxRequest( [ 'wpFileKey' => 'testkey-test.test' ] ) ], 'Check good wpSessionKey' => - array( new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) ) ), + [ new FauxRequest( [ 'wpFileKey' => 'testkey-test.test' ] ) ], 'Check key precedence' => - array( new FauxRequest( array( + [ new FauxRequest( [ 'wpFileKey' => 'testkey-test.test', 'wpSessionKey' => 'foo' - ) ) ), - ); + ] ) ], + ]; } /** * @dataProvider provideValidRequests