ItSpiderman has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/346975 )

Change subject: Add 'query' param to API calls
......................................................................

Add 'query' param to API calls

Enables classes to pass query param to API calls if needed

Change-Id: I2349df3a350c4aea6a9aaed688692dc8278ca461
---
M tests/BSApiExtJSStoreTestBase.php
1 file changed, 28 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation 
refs/changes/75/346975/1

diff --git a/tests/BSApiExtJSStoreTestBase.php 
b/tests/BSApiExtJSStoreTestBase.php
index 4dfe35b..ae458a4 100644
--- a/tests/BSApiExtJSStoreTestBase.php
+++ b/tests/BSApiExtJSStoreTestBase.php
@@ -7,6 +7,7 @@
 abstract class BSApiExtJSStoreTestBase extends ApiTestCase {
 
        protected $iFixtureTotal = 0;
+       protected $sQuery = '';
        abstract protected function getStoreSchema();
 
        /**
@@ -70,11 +71,15 @@
         * @dataProvider providePagingData
         */
        public function testPaging( $limit, $offset ) {
-               $results = $this->doApiRequest([
+               $aParams = array(
                        'action' => $this->getModuleName(),
                        'limit' => $limit,
                        'start' => $offset
-               ]);
+               );
+               if( $this->sQuery ) {
+                       $aParams['query'] = $this->sQuery;
+               }
+               $results = $this->doApiRequest( $aParams );
                $response = $results[0];
 
                $this->assertAttributeEquals(
@@ -117,7 +122,7 @@
         * @dataProvider provideSingleFilterData
         */
        public function testSingleFilter( $type, $comparison, $field, $value, 
$expectedTotal ) {
-               $results = $this->doApiRequest([
+               $aParams = array(
                        'action' => $this->getModuleName(),
                        'filter' => FormatJson::encode([
                                [
@@ -127,7 +132,12 @@
                                        'value' => $value
                                ]
                        ])
-               ]);
+               );
+               if( $this->sQuery ) {
+                       $aParams['query'] = $this->sQuery;
+               }
+
+               $results = $this->doApiRequest( $aParams );
 
                $response = $results[0];
 
@@ -148,10 +158,15 @@
         * @dataProvider provideMultipleFilterData
         */
        public function testMultipleFilter( $filters, $expectedTotal ) {
-               $results = $this->doApiRequest([
+               $aParams = array(
                        'action' => $this->getModuleName(),
                        'filter' => FormatJson::encode( $filters )
-               ]);
+               );
+               if( $this->sQuery ) {
+                       $aParams['query'] = $this->sQuery;
+               }
+
+               $results = $this->doApiRequest( $aParams );
 
                $response = $results[0];
 
@@ -166,8 +181,13 @@
        abstract public function provideMultipleFilterData();
 
        protected function makeRequestParams() {
-               return [
+               $aParams = array(
                        'action' => $this->getModuleName()
-               ];
+               );
+               if( $this->sQuery ) {
+                       $aParams['query'] = $this->sQuery;
+               }
+
+               return $aParams;
        }
 }
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/346975
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2349df3a350c4aea6a9aaed688692dc8278ca461
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: ItSpiderman <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to