[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Make getLogMatches static

2017-07-19 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/366161 )

Change subject: Make getLogMatches static
..


Make getLogMatches static

This will let us re-use it in API tests

Change-Id: Idfaff167388e9f338270d17307baf9d6a4643b69
---
M tests/phpunit/Adapter/AstroPay/AstroPayTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
M tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M tests/phpunit/DonationDataTest.php
M tests/phpunit/DonationInterfaceTestCase.php
M tests/phpunit/GatewayPageTest.php
M tests/phpunit/IntegrationTest.php
M tests/phpunit/LoggingTest.php
10 files changed, 25 insertions(+), 29 deletions(-)

Approvals:
  Mepps: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php 
b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
index 59e1185..24c5c54 100644
--- a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
+++ b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
@@ -158,7 +158,7 @@
$errors[0]->getErrorCode(),
'Wrong error for code "1"'
);
-   $logged = $this->getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
+   $logged = self::getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
$this->assertNotEmpty( $logged );
}
 
@@ -212,7 +212,7 @@
'Should be an error in PaymentResult'
);
 
-   $logged = $this->getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
+   $logged = self::getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
$this->assertNotEmpty( $logged );
// TODO: Should this really be a refresh, or should we finalize 
to failed here?
$this->assertTrue( $result->getRefresh(), 'PaymentResult should 
be a refresh' );
diff --git 
a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
index 8053400..86d457b 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
@@ -151,7 +151,7 @@
return $error->getErrorCode() == '101';
};
$this->assertNotEmpty( array_filter( $errors, $finder ), 
'Orphan adapter needs error 101 to consider it rectified' );
-   $loglines = $this->getLogMatches( LogLevel::INFO, "/Got error 
code $code, not retrying to avoid MasterCard fines./" );
+   $loglines = self::getLogMatches( LogLevel::INFO, "/Got error 
code $code, not retrying to avoid MasterCard fines./" );
$this->assertNotEmpty( $loglines, "GC Error $code is not 
generating the expected payments log error" );
}
 
diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
index 972d8b0..ee8e3d3 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
@@ -423,18 +423,18 @@
$gateway = $this->getFreshGatewayObject( $init );
$gateway->setDummyGatewayResponseCode( '2150' );
$gateway->do_transaction( 'GET_ORDERSTATUS' );
-   $loglines = $this->getLogMatches( LogLevel::ERROR, 
'/Investigation required!/' );
+   $loglines = self::getLogMatches( LogLevel::ERROR, 
'/Investigation required!/' );
$this->assertNotEmpty( $loglines, 'GC Error 2150 is not 
generating the expected payments log error' );
 
//Reset logs
-   $this->testLogger->messages = array();
+   DonationLoggerFactory::$overrideLogger->messages = array();
 
//Most irritating version of 20001000 - They failed to enter an 
expiration date on GC's form. This should log some specific info, but not an 
error.
$gateway = $this->getFreshGatewayObject( $init );
$gateway->setDummyGatewayResponseCode( '20001000-expiry' );
$gateway->do_transaction( 'GET_ORDERSTATUS' );
$this->verifyNoLogErrors();
-   $loglines = $this->getLogMatches( LogLevel::INFO, 
'/processResponse:.*EXPIRYDATE/' );
+   $loglines = self::getLogMatches( LogLevel::INFO, 
'/processResponse:.*EXPIRYDATE/' );
$this->assertNotEmpty( $loglines, 'GC Error 20001000-expiry is 
not generating the expected payments log line' );
}
 
@@ -530,7 +530,7 

[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Make getLogMatches static

2017-07-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366161 )

Change subject: Make getLogMatches static
..

Make getLogMatches static

This will let us re-use it in API tests

Change-Id: Idfaff167388e9f338270d17307baf9d6a4643b69
---
M tests/phpunit/Adapter/AstroPay/AstroPayTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
M tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
M tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
M tests/phpunit/DonationDataTest.php
M tests/phpunit/DonationInterfaceTestCase.php
M tests/phpunit/GatewayPageTest.php
M tests/phpunit/IntegrationTest.php
M tests/phpunit/LoggingTest.php
10 files changed, 25 insertions(+), 29 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/61/366161/1

diff --git a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php 
b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
index 59e1185..24c5c54 100644
--- a/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
+++ b/tests/phpunit/Adapter/AstroPay/AstroPayTest.php
@@ -158,7 +158,7 @@
$errors[0]->getErrorCode(),
'Wrong error for code "1"'
);
-   $logged = $this->getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
+   $logged = self::getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
$this->assertNotEmpty( $logged );
}
 
@@ -212,7 +212,7 @@
'Should be an error in PaymentResult'
);
 
-   $logged = $this->getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
+   $logged = self::getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
$this->assertNotEmpty( $logged );
// TODO: Should this really be a refresh, or should we finalize 
to failed here?
$this->assertTrue( $result->getRefresh(), 'PaymentResult should 
be a refresh' );
diff --git 
a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
index 8053400..86d457b 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php
@@ -151,7 +151,7 @@
return $error->getErrorCode() == '101';
};
$this->assertNotEmpty( array_filter( $errors, $finder ), 
'Orphan adapter needs error 101 to consider it rectified' );
-   $loglines = $this->getLogMatches( LogLevel::INFO, "/Got error 
code $code, not retrying to avoid MasterCard fines./" );
+   $loglines = self::getLogMatches( LogLevel::INFO, "/Got error 
code $code, not retrying to avoid MasterCard fines./" );
$this->assertNotEmpty( $loglines, "GC Error $code is not 
generating the expected payments log error" );
}
 
diff --git a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php 
b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
index 972d8b0..ee8e3d3 100644
--- a/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
+++ b/tests/phpunit/Adapter/GlobalCollect/GlobalCollectTest.php
@@ -423,18 +423,18 @@
$gateway = $this->getFreshGatewayObject( $init );
$gateway->setDummyGatewayResponseCode( '2150' );
$gateway->do_transaction( 'GET_ORDERSTATUS' );
-   $loglines = $this->getLogMatches( LogLevel::ERROR, 
'/Investigation required!/' );
+   $loglines = self::getLogMatches( LogLevel::ERROR, 
'/Investigation required!/' );
$this->assertNotEmpty( $loglines, 'GC Error 2150 is not 
generating the expected payments log error' );
 
//Reset logs
-   $this->testLogger->messages = array();
+   DonationLoggerFactory::$overrideLogger->messages = array();
 
//Most irritating version of 20001000 - They failed to enter an 
expiration date on GC's form. This should log some specific info, but not an 
error.
$gateway = $this->getFreshGatewayObject( $init );
$gateway->setDummyGatewayResponseCode( '20001000-expiry' );
$gateway->do_transaction( 'GET_ORDERSTATUS' );
$this->verifyNoLogErrors();
-   $loglines = $this->getLogMatches( LogLevel::INFO, 
'/processResponse:.*EXPIRYDATE/' );
+   $loglines = self::getLogMatches( LogLevel::INFO, 
'/processResponse:.*EXPIRYDATE/' );
$this->assertNotEmpty( $loglines, 'GC Error 20001000-expiry is 
not generating the expected payments log line' );