aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/filerepo/file
diff options
context:
space:
mode:
authorTim Starling <tstarling@wikimedia.org>2023-09-08 10:06:59 +1000
committerTim Starling <tstarling@wikimedia.org>2023-09-08 10:16:08 +1000
commit95bd40b25cd6eea81c39d0e88170a214520f7c77 (patch)
tree5eb0426f77cbf2bde662dd2646dc55dfc79424ba /tests/phpunit/includes/filerepo/file
parent7bbc107f164a3ddc20641471b08380794559e53a (diff)
downloadmediawikicore-95bd40b25cd6eea81c39d0e88170a214520f7c77.tar.gz
mediawikicore-95bd40b25cd6eea81c39d0e88170a214520f7c77.zip
In query builders, use insertInto() and deleteFrom() instead of insert() and delete()
The design principle for SelectQueryBuilder was to make the chained builder calls look as much like SQL as possible, so that developers could leverage their knowledge of SQL to understand what the query builder is doing. That's why SelectQueryBuilder::select() takes a list of fields, and by the same principle, it makes sense for UpdateQueryBuilder::update() to take a table. However with "insert" and "delete", the SQL designers chose to add prepositions "into" and "from", and I think it makes sense to follow that here. In terms of natural language, we update a table, but we don't delete a table, or insert a table. We delete rows from a table, or insert rows into a table. The table is not the object of the verb. So, add insertInto() as an alias for insert(), and add deleteFrom() as an alias for delete(). Use the new methods in MW core callers where PHPStorm knows the type. Change-Id: Idb327a54a57a0fb2288ea067472c1e9727016000
Diffstat (limited to 'tests/phpunit/includes/filerepo/file')
-rw-r--r--tests/phpunit/includes/filerepo/file/LocalFileTest.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/phpunit/includes/filerepo/file/LocalFileTest.php b/tests/phpunit/includes/filerepo/file/LocalFileTest.php
index 2f1d68cefa43..4d043a9dfcac 100644
--- a/tests/phpunit/includes/filerepo/file/LocalFileTest.php
+++ b/tests/phpunit/includes/filerepo/file/LocalFileTest.php
@@ -654,7 +654,7 @@ class LocalFileTest extends MediaWikiIntegrationTestCase {
// Make sure we were actually hitting the WAN cache
$dbw->newDeleteQueryBuilder()
- ->delete( 'image' )
+ ->deleteFrom( 'image' )
->where( [ 'img_name' => 'Random-11m.png' ] )
->caller( __METHOD__ )->execute();
$file->invalidateCache();