From d8d0638eb36e59f913972b213f37e99981fb7c7d Mon Sep 17 00:00:00 2001 From: "David.Owusu" Date: Mon, 11 Jan 2021 13:03:30 +0100 Subject: [PATCH 1/3] [fix] (UMCS-56) - tests: Failed tests which depend on another test did not log debug messages as expected, when debug mode has been disabled. --- CHANGELOG.md | 10 ++++++++-- phpunit.xml | 2 +- test/BaseIntegrationTest.php | 3 +-- test/BasePaymentTest.php | 16 +++++++++++++++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef6797a1..0232a506 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,13 +3,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [1.1.1.0][1.1.1.0] +## [1.1.1.1] + +### Fix +* Change debug logging of failed tests that depend on another one to work as expected. + +## [1.1.1.0] ### Changed * Add email property to payment type `card` to meet 3Ds2.x regulations. * Several minor changes. -## [1.1.0.0][1.1.0.0] +## [1.1.0.0] ### Changed * Rebranding of the SDK. @@ -43,3 +48,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [1.1.0.0]: https://github.com/unzerdev/php-sdk/compare/1260b8314af1ac461e33f0cfb382ffcd0e87c105..1.1.0.0 [1.1.1.0]: https://github.com/unzerdev/php-sdk/compare/1.1.0.0..1.1.1.0 +[1.1.1.1]: https://github.com/unzerdev/php-sdk/compare/1.1.1.0..1.1.1.1 diff --git a/phpunit.xml b/phpunit.xml index d0d58a86..58ad4061 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ unzer->getDebugHandler(); + $debugHandler = self::getDebugHandler(); if ($this->getStatus() === BaseTestRunner::STATUS_PASSED) { $debugHandler->clearTempLog(); diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index 91a28b90..f06d539d 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -52,6 +52,20 @@ class BasePaymentTest extends TestCase /** @var Unzer $unzer */ protected $unzer; + protected static $debughandler; + + /** + * @return TestDebugHandler + */ + public static function getDebugHandler(): TestDebugHandler + { + if (!self::$debughandler instanceof TestDebugHandler) { + self::$debughandler = new TestDebugHandler(); + } + return self::$debughandler; + } + + /** * Creates and returns an Unzer object if it does not exist yet. * Uses an invalid but well formed default key if no key is given. @@ -66,7 +80,7 @@ protected function getUnzerObject($privateKey = 's-priv-1234'): Unzer { if (!$this->unzer instanceof Unzer) { $this->unzer = (new Unzer($privateKey)) - ->setDebugHandler(new TestDebugHandler()) + ->setDebugHandler(self::getDebugHandler()) ->setDebugMode(true); } return $this->unzer; From fec06c500c2d699e4224ce3d3f6a519d60d470b0 Mon Sep 17 00:00:00 2001 From: "David.Owusu" Date: Mon, 18 Jan 2021 15:21:18 +0100 Subject: [PATCH 2/3] [fix] (UMCS-56) - update changelog - correct charge variable in installment example. --- CHANGELOG.md | 1 + examples/InstallmentSecured/PlaceOrderController.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0232a506..6798f765 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Fix * Change debug logging of failed tests that depend on another one to work as expected. +* Several minor changes. ## [1.1.1.0] diff --git a/examples/InstallmentSecured/PlaceOrderController.php b/examples/InstallmentSecured/PlaceOrderController.php index 615f7a23..998f359a 100644 --- a/examples/InstallmentSecured/PlaceOrderController.php +++ b/examples/InstallmentSecured/PlaceOrderController.php @@ -72,7 +72,7 @@ function redirect($url, $merchantMessage = '', $clientMessage = '') } // Check the result message of the transaction to find out what went wrong. - $merchantMessage = $authorize->getMessage()->getCustomer(); + $merchantMessage = $charge->getMessage()->getCustomer(); } catch (UnzerApiException $e) { $merchantMessage = $e->getMerchantMessage(); $clientMessage = $e->getClientMessage(); From 20c414c9f61de6637904c40262e52641dd1b3dd4 Mon Sep 17 00:00:00 2001 From: "David.Owusu" Date: Mon, 18 Jan 2021 16:04:46 +0100 Subject: [PATCH 3/3] [fix] (UMCS-56) - code style. --- test/BasePaymentTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/test/BasePaymentTest.php b/test/BasePaymentTest.php index f06d539d..69407b6a 100755 --- a/test/BasePaymentTest.php +++ b/test/BasePaymentTest.php @@ -65,7 +65,6 @@ public static function getDebugHandler(): TestDebugHandler return self::$debughandler; } - /** * Creates and returns an Unzer object if it does not exist yet. * Uses an invalid but well formed default key if no key is given.