aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/api
diff options
context:
space:
mode:
authorTim Starling <tstarling@wikimedia.org>2025-01-10 11:42:20 +1100
committerTim Starling <tstarling@wikimedia.org>2025-01-10 12:03:19 +1100
commit6724e4b695c6fb955b3301bc701c98fbb1522df0 (patch)
treead6e41fd2087ca849c48c66d060dab2ac3dd7a2d /tests/phpunit/includes/api
parent8ce0a476897c46c9821692d1c25fdf2982105803 (diff)
downloadmediawikicore-6724e4b695c6fb955b3301bc701c98fbb1522df0.tar.gz
mediawikicore-6724e4b695c6fb955b3301bc701c98fbb1522df0.zip
block: Fix HideUserUtils error when user is hidden twice
* Add a limit to the HideUserUtils subqueries to avoid error "Subquery returns more than 1 row". We really want to know if at least one row exists. * Fix outdated doc comment * Add tests. Bug: T382399 Change-Id: Ib3bc22e0b3080b3ae6e1d2591ac7f2a1ef57c6b3
Diffstat (limited to 'tests/phpunit/includes/api')
-rw-r--r--tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php b/tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php
index 915da66575d0..badcaa2bb5bb 100644
--- a/tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php
+++ b/tests/phpunit/includes/api/query/ApiQueryBlockInfoTraitTest.php
@@ -61,7 +61,8 @@ class ApiQueryBlockInfoTraitTest extends MediaWikiIntegrationTestCase {
'fields' => [ 'hu_deleted' => '1=0' ],
'conds' => [ '(SELECT 1 FROM "block_target" "hu_block_target" ' .
'JOIN "block" "hu_block" ON ((hu_block.bl_target=hu_block_target.bt_id)) ' .
- 'WHERE (hu_block_target.bt_user=user_id) AND hu_block.bl_deleted = 1 ) IS NULL' ],
+ 'WHERE (hu_block_target.bt_user=user_id) AND hu_block.bl_deleted = 1 ' .
+ 'LIMIT 1 ) IS NULL' ],
'options' => [],
'join_conds' => [],
],
@@ -72,7 +73,8 @@ class ApiQueryBlockInfoTraitTest extends MediaWikiIntegrationTestCase {
'tables' => [ 'table' ],
'fields' => [ 'hu_deleted' => '(SELECT 1 FROM "block_target" "hu_block_target" ' .
'JOIN "block" "hu_block" ON ((hu_block.bl_target=hu_block_target.bt_id)) ' .
- 'WHERE (hu_block_target.bt_user=user_id) AND hu_block.bl_deleted = 1 ) IS NOT NULL' ],
+ 'WHERE (hu_block_target.bt_user=user_id) AND hu_block.bl_deleted = 1 ' .
+ 'LIMIT 1 ) IS NOT NULL' ],
'conds' => [],
'options' => [],
'join_conds' => []