X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiUnblockTest.php;h=a1754faa5877fd63cd16f80bef09ae57aa3d9b4c;hp=6ebd835cf66ab9b9444089bb451a0642c8a6ee54;hb=dfec83932fd38a9086eb5a2e212889ad00f35b0e;hpb=93350da7f1ab397b87c3ac3073ddfc1c857b272e diff --git a/tests/phpunit/includes/api/ApiUnblockTest.php b/tests/phpunit/includes/api/ApiUnblockTest.php index 6ebd835cf6..a1754faa58 100644 --- a/tests/phpunit/includes/api/ApiUnblockTest.php +++ b/tests/phpunit/includes/api/ApiUnblockTest.php @@ -1,5 +1,7 @@ blockee = $this->getMutableTestUser()->getUser(); // Initialize a blocked user (used by most tests, although not all) - $block = new Block( [ + $block = new DatabaseBlock( [ 'address' => $this->blockee->getName(), 'by' => $this->blocker->getId(), ] ); $result = $block->insert(); $this->assertNotFalse( $result, 'Could not insert block' ); - $blockFromDB = Block::newFromID( $result['id'] ); + $blockFromDB = DatabaseBlock::newFromID( $result['id'] ); $this->assertTrue( !is_null( $blockFromDB ), 'Could not retrieve block' ); } private function getBlockFromParams( array $params ) { if ( array_key_exists( 'user', $params ) ) { - return Block::newFromTarget( $params['user'] ); + return DatabaseBlock::newFromTarget( $params['user'] ); } if ( array_key_exists( 'userid', $params ) ) { - return Block::newFromTarget( User::newFromId( $params['userid'] ) ); + return DatabaseBlock::newFromTarget( User::newFromId( $params['userid'] ) ); } - return Block::newFromId( $params['id'] ); + return DatabaseBlock::newFromId( $params['id'] ); } /** @@ -64,7 +66,7 @@ class ApiUnblockTest extends ApiTestCase { // We only check later on whether the block existed to begin with, because maybe the caller // expects doApiRequestWithToken to throw, in which case the block might not be expected to // exist to begin with. - $this->assertInstanceOf( Block::class, $originalBlock, 'Block should initially exist' ); + $this->assertInstanceOf( DatabaseBlock::class, $originalBlock, 'Block should initially exist' ); $this->assertNull( $this->getBlockFromParams( $params ), 'Block should have been removed' ); } @@ -94,7 +96,7 @@ class ApiUnblockTest extends ApiTestCase { public function testUnblockWhenBlocked() { $this->setExpectedApiException( 'ipbblocked' ); - $block = new Block( [ + $block = new DatabaseBlock( [ 'address' => $this->blocker->getName(), 'by' => $this->getTestUser( 'sysop' )->getUser()->getId(), ] ); @@ -104,7 +106,7 @@ class ApiUnblockTest extends ApiTestCase { } public function testUnblockSelfWhenBlocked() { - $block = new Block( [ + $block = new DatabaseBlock( [ 'address' => $this->blocker->getName(), 'by' => $this->getTestUser( 'sysop' )->getUser()->getId(), ] ); @@ -127,8 +129,8 @@ class ApiUnblockTest extends ApiTestCase { __METHOD__, [], [ - 'change_tag' => [ 'INNER JOIN', 'ct_log_id = log_id' ], - 'change_tag_def' => [ 'INNER JOIN', 'ctd_id = ct_tag_id' ], + 'change_tag' => [ 'JOIN', 'ct_log_id = log_id' ], + 'change_tag_def' => [ 'JOIN', 'ctd_id = ct_tag_id' ], ] ) ); }