-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add handling for fatal errors by the gateway (#25)
- Loading branch information
1 parent
52e0925
commit 29eae73
Showing
4 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* Ratepay PHP-Library | ||
* | ||
* This document contains trade secret data which are the property of | ||
* Ratepay GmbH, Berlin, Germany. Information contained herein must not be used, | ||
* copied or disclosed in whole or part unless permitted in writing by Ratepay GmbH. | ||
* All rights reserved by Ratepay GmbH. | ||
* | ||
* Copyright (c) 2022 Ratepay GmbH / Berlin / Germany | ||
*/ | ||
|
||
namespace RatePAY\Service; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use RatePAY\Exception\RequestException; | ||
|
||
class ValidateGatewayResponseTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @requires PHPUnit 7.5 | ||
*/ | ||
public function testIfExceptionWillThrownIfUnexpectedXML() | ||
{ | ||
$xml = '<?xml version="1.0" encoding="UTF-8"?><note><to>Foo</to></note>'; | ||
|
||
$this->expectException(RequestException::class); | ||
$this->expectExceptionMessageMatches('/An error occurred during the processing of the response from the gateway. Error message: (.*)/'); | ||
|
||
new ValidateGatewayResponse('PaymentInit', new \SimpleXMLElement($xml)); | ||
} | ||
} |