Skip to content

Commit

Permalink
Upgrade PHPUnit and rmccue/requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakito committed Dec 30, 2023
1 parent 0908162 commit 13be8d9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ vendor
composer.lock
junit.xml
build/
.phpunit.result.cache
.phpunit.cache/
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ language: php
php:
- 7.2
- 7.3
- 8.1
- 8.2
- 8.3
before_script:
- composer require php-coveralls/php-coveralls
script:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
}
],
"require": {
"php": ">=5.3.0",
"rmccue/requests": "~1.7"
"php": ">=7.2.0",
"rmccue/requests": "^2.0"
},
"require-dev": {
"php": ">=7.2",
"phpunit/phpunit": "8.*"
"phpunit/phpunit": "10.*"
},
"autoload": {
"files": [ "src/functions.php"],
Expand Down
36 changes: 13 additions & 23 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="phpunit-bootstrap.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
testSuiteLoaderFile="phpunit/src/Runner/StandardTestSuiteLoader.php">

<testsuites>
<testsuite name="All">
<directory>tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">./src</directory>
<exclude>
</exclude>
</whitelist>
</filter>
</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="phpunit-bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="All">
<directory>tests</directory>
<exclude>tests/unit/at/externet/eps_bank_transfer/BaseTest.php</exclude>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
9 changes: 6 additions & 3 deletions src/SoCommunicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace at\externet\eps_bank_transfer;

use WpOrg\Requests\Exception\Transport;
use WpOrg\Requests\Requests;

/**
* Handles the communication with the EPS scheme operator
*/
Expand All @@ -19,7 +22,7 @@ class SoCommunicator
/**
* requests transport
* @internal
* @var \Requests_Transport *
* @var Transport
*/
public $Transport;

Expand Down Expand Up @@ -252,7 +255,7 @@ private function GetUrl($url, $logMessage)
$options = $this->Transport === null ? array() : array(
'transport' => $this->Transport
);
$response = \Requests::get($url, array(), $options);
$response = Requests::get($url, array(), $options);
if ($response->status_code != 200)
{
$this->WriteLog($logMessage, false);
Expand All @@ -275,7 +278,7 @@ private function PostUrl($url, $data, $message)
$options = $this->Transport === null ? array() : array(
'transport' => $this->Transport
);
$response = \Requests::post($url, array('Content-Type' => 'text/xml; charset=UTF-8'), $data, $options);
$response = Requests::post($url, array('Content-Type' => 'text/xml; charset=UTF-8'), $data, $options);

if ($response->status_code != 200)
{
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/at/externet/eps_bank_transfer/MockTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace at\externet\eps_bank_transfer;

class MockTransport implements \Requests_Transport {
class MockTransport implements \WpOrg\Requests\Transport {
public $code = 200;
public $chunked = false;
public $body = 'Test Body';
Expand Down Expand Up @@ -88,7 +88,8 @@ public function request_multiple($requests, $options) {
return $responses;
}

public static function test() {
public static function test($capabilities = [])
{
return true;
}
}

0 comments on commit 13be8d9

Please sign in to comment.