r100622 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100621‎ | r100622 | r100623 >
Date:17:25, 24 October 2011
Author:jpostlethwaite
Status:deferred (Comments)
Tags:fundraising 
Comment:
Made currentTransaction() public for unit testing. Added getDonationData() for unit testing.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -251,6 +251,17 @@
252252 }
253253 }
254254
 255+ /**
 256+ * Returns the variable $this->dataObj which should be an instance of
 257+ * DonationData
 258+ *
 259+ * @return DonationData
 260+ */
 261+ public function getDonationData() {
 262+
 263+ return $this->dataObj;
 264+ }
 265+
255266 function getDisplayData() {
256267 return $this->displaydata;
257268 }
@@ -644,7 +655,7 @@
645656 * @param $transaction string This is a specific transaction type like 'INSERT_ORDERWITHPAYMENT'
646657 * that maps to a first-level key in the $transactions array.
647658 */
648 - protected function currentTransaction( $transaction = '' ) { //get&set in one!
 659+ public function currentTransaction( $transaction = '' ) { //get&set in one!
649660 static $current_transaction;
650661 if ( $transaction != '' ) {
651662 $current_transaction = $transaction;

Follow-up revisions

RevisionCommit summaryAuthorDate
r100942Added GlobalCollectTestAdapter for testing the GlobalCollect adapter.jpostlethwaite03:47, 27 October 2011

Comments

#Comment by Khorn (WMF) (talk | contribs)   03:20, 27 October 2011

Actually, I'd _really_ prefer if we don't make the innards available to the public in this way. It's far too confusing for other developers who want to easily use adapters and know what they should be accessing from the outside... not to mention the part where making everything publicly accessible opens up the door for a large number of vectors for abuse. If you want access to private or protected members in a unit test, create an object that extends the object you want to test, which only contains some methods which can safely pass the internal functions and objects to your tests, and vice versa.

#Comment by Jpostlethwaite (talk | contribs)   03:58, 27 October 2011

I created a test class: GlobalCollectTestAdapter

Status & tagging log