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

Change subject: Add function for retrieving custom params
......................................................................

Add function for retrieving custom params

Added a function that classes inheriting this base class can override and
pass any number and type of params to be passes when executing API
request.

Problematic is that there is already logic implemented that lets you pass
'query' param by overriding sQuery var. This is now unnecessary as 'query'
can also be passed over the new function, but for backwards compatibility
cannot be removed

Change-Id: Ica116febdd82314cd7a6fb55206fc0a6e2896e37
---
M tests/BSApiExtJSStoreTestBase.php
1 file changed, 19 insertions(+), 0 deletions(-)


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

diff --git a/tests/BSApiExtJSStoreTestBase.php 
b/tests/BSApiExtJSStoreTestBase.php
index a9dfb84..abd453c 100644
--- a/tests/BSApiExtJSStoreTestBase.php
+++ b/tests/BSApiExtJSStoreTestBase.php
@@ -75,6 +75,11 @@
                $aParams = array(
                        'action' => $this->getModuleName()
                );
+               if( $this->sQuery ) {
+                       $aParams['query'] = $this->sQuery;
+               }
+               $aParams = array_merge( $aParams, $this->getAdditionalParams() 
);
+
                $results = $this->doApiRequest( $aParams );
                $resultItems = $results[0]["results"];
 
@@ -102,6 +107,8 @@
                if( $this->sQuery ) {
                        $aParams['query'] = $this->sQuery;
                }
+               $aParams = array_merge( $aParams, $this->getAdditionalParams() 
);
+
                $results = $this->doApiRequest( $aParams );
                $response = $results[0];
 
@@ -161,6 +168,7 @@
                if( $this->sQuery ) {
                        $aParams['query'] = $this->sQuery;
                }
+               $aParams = array_merge( $aParams, $this->getAdditionalParams() 
);
 
                $results = $this->doApiRequest( $aParams );
 
@@ -190,6 +198,7 @@
                if( $this->sQuery ) {
                        $aParams['query'] = $this->sQuery;
                }
+               $aParams = array_merge( $aParams, $this->getAdditionalParams() 
);
 
                $results = $this->doApiRequest( $aParams );
 
@@ -212,6 +221,7 @@
                if( $this->sQuery ) {
                        $aParams['query'] = $this->sQuery;
                }
+               $aParams = array_merge( $aParams, $this->getAdditionalParams() 
);
 
                return $aParams;
        }
@@ -245,4 +255,13 @@
                }
                return false;
        }
+
+       /**
+        * Allows subclasses to add custom parameters
+        * to the API calls
+        * @return array
+        */
+       protected function getAdditionalParams() {
+               return [];
+       }
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica116febdd82314cd7a6fb55206fc0a6e2896e37
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