From cc3c0d2cdfb3e433996d4b51566e1716621238c5 Mon Sep 17 00:00:00 2001 From: "Aleksey Bekh-Ivanov (WMDE)" Date: Fri, 22 Sep 2017 20:49:03 +0200 Subject: [PATCH] Make `ApiUploadTest` up to date so it passes Although the test is still might fail from time to time and needs refactoring. Bug: T28169 Change-Id: Ib27a36e0d76495a133eb8941300e4940e5eb670e --- tests/phpunit/includes/api/ApiUploadTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/includes/api/ApiUploadTest.php b/tests/phpunit/includes/api/ApiUploadTest.php index 9b79e6c538..159a0e36e4 100644 --- a/tests/phpunit/includes/api/ApiUploadTest.php +++ b/tests/phpunit/includes/api/ApiUploadTest.php @@ -51,7 +51,6 @@ class ApiUploadTest extends ApiTestCaseUpload { $this->assertArrayHasKey( "login", $result ); $this->assertArrayHasKey( "result", $result['login'] ); $this->assertEquals( "Success", $result['login']['result'] ); - $this->assertArrayHasKey( 'lgtoken', $result['login'] ); $this->assertNotEmpty( $session, 'API Login must return a session' ); @@ -69,7 +68,7 @@ class ApiUploadTest extends ApiTestCaseUpload { ] ); } catch ( ApiUsageException $e ) { $exception = true; - $this->assertEquals( 'The "token" parameter must be set', $e->getMessage() ); + $this->assertContains( 'The "token" parameter must be set', $e->getMessage() ); } $this->assertTrue( $exception, "Got exception" ); } @@ -85,8 +84,10 @@ class ApiUploadTest extends ApiTestCaseUpload { ], $session, self::$users['uploader']->getUser() ); } catch ( ApiUsageException $e ) { $exception = true; - $this->assertEquals( "One of the parameters filekey, file, url is required", - $e->getMessage() ); + $this->assertEquals( + 'One of the parameters "filekey", "file" and "url" is required.', + $e->getMessage() + ); } $this->assertTrue( $exception, "Got exception" ); } -- 2.20.1