Anomie has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/402376 )
Change subject: Add options and join conds to MediaWikiTestCase::assertSelect
......................................................................
Add options and join conds to MediaWikiTestCase::assertSelect
Because selects sometimes need to specify these.
Change-Id: I853e8210bbafe16a62060b9075384afb9cdb03c0
---
M tests/phpunit/MediaWikiTestCase.php
1 file changed, 13 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/76/402376/1
diff --git a/tests/phpunit/MediaWikiTestCase.php
b/tests/phpunit/MediaWikiTestCase.php
index d542826..5c27fa1 100644
--- a/tests/phpunit/MediaWikiTestCase.php
+++ b/tests/phpunit/MediaWikiTestCase.php
@@ -1482,13 +1482,17 @@
* @param string|array $fields The columns to include in the result
(and to sort by)
* @param string|array $condition "where" condition(s)
* @param array $expectedRows An array of arrays giving the expected
rows.
+ * @param array $options Options for the query
+ * @param array $join_conds Join conditions for the query
*
* @throws MWException If this test cases's needsDB() method doesn't
return true.
* Test cases can use "@group Database" to enable database test
support,
* or list the tables under testing in $this->tablesUsed, or
override the
* needsDB() method.
*/
- protected function assertSelect( $table, $fields, $condition, array
$expectedRows ) {
+ protected function assertSelect(
+ $table, $fields, $condition, array $expectedRows, array
$options = [], array $join_conds = []
+ ) {
if ( !$this->needsDB() ) {
throw new MWException( 'When testing database state,
the test cases\'s needDB()' .
' method should return true. Use @group
Database or $this->tablesUsed.' );
@@ -1496,7 +1500,14 @@
$db = wfGetDB( DB_REPLICA );
- $res = $db->select( $table, $fields, $condition, wfGetCaller(),
[ 'ORDER BY' => $fields ] );
+ $res = $db->select(
+ $table,
+ $fields,
+ $condition,
+ wfGetCaller(),
+ $options + [ 'ORDER BY' => $fields ],
+ $join_conds
+ );
$this->assertNotEmpty( $res, "query failed: " .
$db->lastError() );
$i = 0;
--
To view, visit https://gerrit.wikimedia.org/r/402376
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I853e8210bbafe16a62060b9075384afb9cdb03c0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits