Merge "Consolidate duplicated unseen change logic and fix inconsistent code"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiQueryBlocksTest.php
index dc7d450..6e00842 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use MediaWiki\Block\Restriction\PageRestriction;
+use MediaWiki\Block\Restriction\NamespaceRestriction;
 
 /**
  * @group API
@@ -111,10 +112,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 +161,9 @@ class ApiQueryBlocksTest extends ApiTestCase {
                                                'title' => $title,
                                        ],
                                ],
+                               'namespaces' => [
+                                       NS_USER_TALK,
+                               ],
                        ],
                ] );
                $this->assertArraySubset( $restrictionsSubset, $data['query']['blocks'][0] );