Skip to content

Commit

Permalink
Merge pull request #58 from exonet/tsi/EXO-4912
Browse files Browse the repository at this point in the history
Update dependencies and deprecate unsupported PHP versions
  • Loading branch information
robbinjanssen authored Jan 5, 2021
2 parents 4a3329a + 4a0da6c commit 9b7cf01
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/vendor/
composer.lock
.phpunit.result.cache
/composer.phar
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: php
php:
- 7.3

services:
- docker
Expand All @@ -10,14 +12,12 @@ cache:

before_install:
- docker-compose up -d
- docker pull php:7.1-cli
- docker pull php:7.2-cli
- docker pull php:7.3-cli
- docker pull php:7.4-cli
- docker pull php:8.0-cli

install:
- composer install
- composer update

script:
- ./run-tests.sh
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ All notable changes to `powerdns-php` will be documented in this file.
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## Unreleased
[Compare v2.6.0 - Unreleased](https://github.com/exonet/powerdns-php/compare/v2.6.0...develop)
[Compare v3.0.0 - Unreleased](https://github.com/exonet/powerdns-php/compare/v3.0.0...develop)

## [v3.0.0](https://github.com/exonet/powerdns-php/releases/tag/v3.0.0) - 2021-01-05
[Compare v2.6.0 - v3.0.0](https://github.com/exonet/powerdns-php/compare/v2.6.0...v3.0.0)
### Breaking
- Dropped support for unsupported PHP versions. PHP 7.3 (or newer) is now required.

### Changed
- Updated Guzzle to 7.2. (@itspluxstahre #50)
- Updated PHPUnit to 9.5.0.
- When running tests a `composer update` will be executed for each environment to validate the packages/config for the specified PHP version.

## [v2.6.0](https://github.com/exonet/powerdns-php/releases/tag/v2.6.0) - 2020-12-21
[Compare v2.5.2 - v2.6.0](https://github.com/exonet/powerdns-php/compare/v2.5.2...v2.6.0)
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
}
],
"require": {
"php": ">=7.1",
"php": "^7.3|^8.0",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.3",
"guzzlehttp/guzzle": "^7.2",
"psr/log": "^1.0"
},
"require-dev": {
"mockery/mockery": "^1.2",
"phpunit/phpunit": "^7"
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-4": {
Expand All @@ -39,7 +39,6 @@
}
},
"config": {
"sort-packages": true,
"platform-check": false
"sort-packages": true
}
}
31 changes: 12 additions & 19 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.0/phpunit.xsd"
backupGlobals="true"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
cacheTokens="false"
colors="true"
>
<testsuites>
<testsuite name="PowerDNS API Client">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="true" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="PowerDNS API Client">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
14 changes: 11 additions & 3 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash

bold=$(tput bold)
red=$(tput setaf 1)
green=$(tput setaf 2)
normal=$(tput sgr0)
RESULTS=""
HAS_FAILED_TESTS=0

function run() {
run() {
PHP_VERSION=$1
PDNS_VERSION=$2
SHORT_PDNS=${PDNS_VERSION//./}
Expand All @@ -23,9 +25,10 @@ function run() {
-e PDNS_HOST="http://pdns" \
--net powerdns-php_default \
-v "$PWD":/usr/src \
-v "$PWD"/composer.phar:/usr/src/composer.phar \
-w /usr/src/ \
php:"$PHP_VERSION"-cli \
php ./vendor/bin/phpunit
bash -c './composer.phar -n update && php ./vendor/bin/phpunit'

if [ $? -eq 0 ]; then
RESULTS="$RESULTS\n${green}✓ PHP $PHP_VERSION / PDNS: $PDNS_VERSION"
Expand All @@ -41,12 +44,17 @@ function run() {
SET_PHP_VERSION=$1
SET_PDNS_VERSION=$2

# Grab the most recent stable composer.
rm -f composer.phar
curl -L -sS https://getcomposer.org/composer-stable.phar -o composer.phar
chmod +x composer.phar

# If both arguments are given, only run that combo.
if [ "$#" -eq 2 ]; then
run "$SET_PHP_VERSION" "$SET_PDNS_VERSION"
else
# Run tests for all supported PHP 7 / PowerDNS 4 combinations.
for phpversion in {1..4}; do
for phpversion in {3..4}; do
for pdnsversion in {1..3}; do
run "7.$phpversion" "4.$pdnsversion"
done
Expand Down
2 changes: 1 addition & 1 deletion src/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private function makeCall(string $method, string $urlPath, ?string $payload = nu
$stream = $payload !== null ? \GuzzleHttp\Psr7\stream_for($payload) : null;
$request = new Request($method, $url, $headers, $stream);

$response = $this->httpClient->send($request);
$response = $this->httpClient->send($request, ['http_errors' => false]);

return $this->parseResponse($response);
}
Expand Down

0 comments on commit 9b7cf01

Please sign in to comment.