From 8631ea7bf6456ec8b4eb81cdbcb8761d427a34f9 Mon Sep 17 00:00:00 2001 From: David Barratt Date: Thu, 15 Nov 2018 17:32:09 -0500 Subject: [PATCH] Add tests to ensure that NamespaceRestrictions are returned from Block APIs. Bug: T204989 Change-Id: Ibe44da41e9efa6688615dc9b0712f9713d4e8158 --- tests/phpunit/includes/api/ApiQueryBlocksTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/api/ApiQueryBlocksTest.php b/tests/phpunit/includes/api/ApiQueryBlocksTest.php index dc7d450dba..03198a8781 100644 --- a/tests/phpunit/includes/api/ApiQueryBlocksTest.php +++ b/tests/phpunit/includes/api/ApiQueryBlocksTest.php @@ -1,6 +1,7 @@ db->insert( 'ipblocks_restrictions', [ 'ir_ipb_id' => $block->getId(), - 'ir_type' => 2, - 'ir_value' => 3, + '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 +155,9 @@ class ApiQueryBlocksTest extends ApiTestCase { 'title' => $title, ], ], + 'namespaces' => [ + NS_USER_TALK, + ], ], ] ); $this->assertArraySubset( $restrictionsSubset, $data['query']['blocks'][0] ); -- 2.20.1