X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiBlockTest.php;h=7274a546ee8e5db94fa4505501ba222dd0f5f503;hb=1a62e51a00321eb6674e27cdff57c683703a5579;hp=feafdef7e0232999a713746130d7c565ef62d391;hpb=b4999a404c5a8084ece8c2599c183d8bfa99ff7a;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php index feafdef7e0..7274a546ee 100644 --- a/tests/phpunit/includes/api/ApiBlockTest.php +++ b/tests/phpunit/includes/api/ApiBlockTest.php @@ -1,5 +1,8 @@ assertTrue( !is_null( $block ), 'Block is valid' ); $this->assertSame( $this->mUser->getName(), (string)$block->getTarget() ); - $this->assertSame( 'Some reason', $block->mReason ); + $this->assertSame( 'Some reason', $block->getReason() ); return $ret; } @@ -128,8 +131,8 @@ class ApiBlockTest 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' ], ] ) ); } @@ -235,17 +238,22 @@ class ApiBlockTest extends ApiTestCase { $title = 'Foo'; $page = $this->getExistingTestPage( $title ); + $namespace = NS_TALK; $this->doBlock( [ 'partial' => true, 'pagerestrictions' => $title, + 'namespacerestrictions' => $namespace, ] ); $block = Block::newFromTarget( $this->mUser->getName() ); $this->assertFalse( $block->isSitewide() ); - $this->assertCount( 1, $block->getRestrictions() ); + $this->assertCount( 2, $block->getRestrictions() ); + $this->assertInstanceOf( PageRestriction::class, $block->getRestrictions()[0] ); $this->assertEquals( $title, $block->getRestrictions()[0]->getTitle()->getText() ); + $this->assertInstanceOf( NamespaceRestriction::class, $block->getRestrictions()[1] ); + $this->assertEquals( $namespace, $block->getRestrictions()[1]->getValue() ); } /** @@ -290,7 +298,7 @@ class ApiBlockTest extends ApiTestCase { * @expectedExceptionMessage Too many values supplied for parameter "pagerestrictions". The * limit is 10. */ - public function testBlockingToManyRestrictions() { + public function testBlockingToManyPageRestrictions() { $this->setMwGlobals( [ 'wgEnablePartialBlocks' => true, ] );