diff options
author | Daimona Eaytoy <daimona.wiki@gmail.com> | 2019-10-05 17:42:53 +0200 |
---|---|---|
committer | Daimona Eaytoy <daimona.wiki@gmail.com> | 2019-10-05 16:14:05 +0000 |
commit | ef5ab69629dc3339b808376b189083838656efbe (patch) | |
tree | e555d181fa6969c48f325d59faebe7aadcdeead5 /tests/phpunit/includes/api/ApiMoveTest.php | |
parent | 98fcdd8f7d5100d1c327b7823ec8609a355ba45e (diff) | |
download | mediawikicore-ef5ab69629dc3339b808376b189083838656efbe.tar.gz mediawikicore-ef5ab69629dc3339b808376b189083838656efbe.zip |
Replace setExpectedException with two args
Find: ^(\t*)(\$this->)setExpectedException\(\s+(\\?[a-z\\]+::class),\s+('(?:[^'\\]|\\')+'|"(?:[^"\\]|\\")+")\s+\);
Replace: $1$2expectException( $3 );\n$1\$this->expectExceptionMessage( $4 );
+broke long lines manually.
Bug: T192167
Change-Id: I5557b4372625def55a53ac637c2f980f51f12933
Diffstat (limited to 'tests/phpunit/includes/api/ApiMoveTest.php')
-rw-r--r-- | tests/phpunit/includes/api/ApiMoveTest.php | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/tests/phpunit/includes/api/ApiMoveTest.php b/tests/phpunit/includes/api/ApiMoveTest.php index e09e6ad7bb49..22d0f3d487eb 100644 --- a/tests/phpunit/includes/api/ApiMoveTest.php +++ b/tests/phpunit/includes/api/ApiMoveTest.php @@ -53,8 +53,8 @@ class ApiMoveTest extends ApiTestCase { } public function testFromWithFromid() { - $this->setExpectedException( ApiUsageException::class, - 'The parameters "from" and "fromid" can not be used together.' ); + $this->expectException( ApiUsageException::class ); + $this->expectExceptionMessage( 'The parameters "from" and "fromid" can not be used together.' ); $this->doApiRequestWithToken( [ 'action' => 'move', @@ -95,8 +95,8 @@ class ApiMoveTest extends ApiTestCase { } public function testMoveNonexistent() { - $this->setExpectedException( ApiUsageException::class, - "The page you specified doesn't exist." ); + $this->expectException( ApiUsageException::class ); + $this->expectExceptionMessage( "The page you specified doesn't exist." ); $this->doApiRequestWithToken( [ 'action' => 'move', @@ -106,8 +106,8 @@ class ApiMoveTest extends ApiTestCase { } public function testMoveNonexistentId() { - $this->setExpectedException( ApiUsageException::class, - 'There is no page with ID 2147483647.' ); + $this->expectException( ApiUsageException::class ); + $this->expectExceptionMessage( 'There is no page with ID 2147483647.' ); $this->doApiRequestWithToken( [ 'action' => 'move', @@ -117,7 +117,8 @@ class ApiMoveTest extends ApiTestCase { } public function testMoveToInvalidPageName() { - $this->setExpectedException( ApiUsageException::class, 'Bad title "[".' ); + $this->expectException( ApiUsageException::class ); + $this->expectExceptionMessage( 'Bad title "[".' ); $name = ucfirst( __FUNCTION__ ); $id = $this->createPage( $name ); @@ -169,8 +170,10 @@ class ApiMoveTest extends ApiTestCase { // @todo File moving public function testPingLimiter() { - $this->setExpectedException( ApiUsageException::class, - "You've exceeded your rate limit. Please wait some time and try again." ); + $this->expectException( ApiUsageException::class ); + $this->expectExceptionMessage( + "You've exceeded your rate limit. Please wait some time and try again." + ); $name = ucfirst( __FUNCTION__ ); @@ -204,8 +207,10 @@ class ApiMoveTest extends ApiTestCase { } public function testTagsNoPermission() { - $this->setExpectedException( ApiUsageException::class, - 'You do not have permission to apply change tags along with your changes.' ); + $this->expectException( ApiUsageException::class ); + $this->expectExceptionMessage( + 'You do not have permission to apply change tags along with your changes.' + ); $name = ucfirst( __FUNCTION__ ); @@ -230,8 +235,8 @@ class ApiMoveTest extends ApiTestCase { } public function testSelfMove() { - $this->setExpectedException( ApiUsageException::class, - 'The title is the same; cannot move a page over itself.' ); + $this->expectException( ApiUsageException::class ); + $this->expectExceptionMessage( 'The title is the same; cannot move a page over itself.' ); $name = ucfirst( __FUNCTION__ ); $this->createPage( $name ); @@ -337,8 +342,10 @@ class ApiMoveTest extends ApiTestCase { } public function testMoveNoPermission() { - $this->setExpectedException( ApiUsageException::class, - 'You must be a registered user and [[Special:UserLogin|logged in]] to move a page.' ); + $this->expectException( ApiUsageException::class ); + $this->expectExceptionMessage( + 'You must be a registered user and [[Special:UserLogin|logged in]] to move a page.' + ); $name = ucfirst( __FUNCTION__ ); |