X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiQueryBlocksTest.php;h=e2816799261b56f24630580fff82bf1e7b1f4b74;hb=a88f1d6b58613cbfa5c24c97887197a41ce66908;hp=dc7d450dba8c2339a790305e78de47c5c7388dad;hpb=6ac8c496d16c1f88d1b8b4cf449085301ddefdce;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiQueryBlocksTest.php b/tests/phpunit/includes/api/ApiQueryBlocksTest.php index dc7d450dba..e281679926 100644 --- a/tests/phpunit/includes/api/ApiQueryBlocksTest.php +++ b/tests/phpunit/includes/api/ApiQueryBlocksTest.php @@ -1,6 +1,8 @@ getTestUser()->getUser(); $sysop = $this->getTestSysop()->getUser(); - $block = new Block( [ + $block = new DatabaseBlock( [ 'address' => $badActor->getName(), 'user' => $badActor->getId(), 'by' => $sysop->getId(), @@ -56,7 +58,7 @@ class ApiQueryBlocksTest extends ApiTestCase { $badActor = $this->getTestUser()->getUser(); $sysop = $this->getTestSysop()->getUser(); - $block = new Block( [ + $block = new DatabaseBlock( [ 'address' => $badActor->getName(), 'user' => $badActor->getId(), 'by' => $sysop->getId(), @@ -86,7 +88,7 @@ class ApiQueryBlocksTest extends ApiTestCase { $badActor = $this->getTestUser()->getUser(); $sysop = $this->getTestSysop()->getUser(); - $block = new Block( [ + $block = new DatabaseBlock( [ 'address' => $badActor->getName(), 'user' => $badActor->getId(), 'by' => $sysop->getId(), @@ -111,10 +113,21 @@ class ApiQueryBlocksTest extends ApiTestCase { 'ir_type' => PageRestriction::TYPE_ID, 'ir_value' => $pageId, ] ); + // Page that has been deleted. $this->db->insert( 'ipblocks_restrictions', [ 'ir_ipb_id' => $block->getId(), - 'ir_type' => 2, - 'ir_value' => 3, + 'ir_type' => PageRestriction::TYPE_ID, + 'ir_value' => 999999, + ] ); + $this->db->insert( 'ipblocks_restrictions', [ + 'ir_ipb_id' => $block->getId(), + 'ir_type' => NamespaceRestriction::TYPE_ID, + 'ir_value' => NS_USER_TALK, + ] ); + $this->db->insert( 'ipblocks_restrictions', [ + 'ir_ipb_id' => $block->getId(), + 'ir_type' => 3, + 'ir_value' => 4, ] ); // Test without requesting restrictions. @@ -149,6 +162,9 @@ class ApiQueryBlocksTest extends ApiTestCase { 'title' => $title, ], ], + 'namespaces' => [ + NS_USER_TALK, + ], ], ] ); $this->assertArraySubset( $restrictionsSubset, $data['query']['blocks'][0] );