Skip to content

Commit

Permalink
chore: drop support for php 5.4 and php 5.5 (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Mar 24, 2022
1 parent fb8f881 commit 888ee55
Show file tree
Hide file tree
Showing 35 changed files with 303 additions and 1,868 deletions.
20 changes: 0 additions & 20 deletions .github/actions/unittest/entrypoint.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .github/actions/unittest/retry.php

This file was deleted.

18 changes: 18 additions & 0 deletions .github/apply-phpunit-patches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# Script used from php-webdriver/php-webdriver

# All commands below must not fail
set -e

# Be in the root dir
cd "$(dirname "$0")/../"

find tests/ -type f -print0 | xargs -0 sed -i 's/function setUp(): void/function setUp()/g';
find tests/ -type f -print0 | xargs -0 sed -i 's/function tearDown(): void/function tearDown()/g';

# Drop the listener from the config file
sed -i '/<listeners>/,+2d' phpunit.xml.dist;

# Return back to original dir
cd - > /dev/null
79 changes: 13 additions & 66 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,38 @@
name: Test Suite
on:
push:
branches:
- main
branches: [ main ]
pull_request:

jobs:
test:
runs-on: ${{matrix.operating-system}}
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0" ]
php: [ "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1" ]
name: PHP ${{matrix.php }} Unit Test
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- if: ${{ matrix.php != '8.0' }}
name: Install Dependencies
- name: Install Dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: composer install
- if: ${{ matrix.php == '8.0' }}
name: Install Dependencies (PHP 8.0)
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: |
composer remove --dev --ignore-platform-reqs phpunit/phpunit
composer require --dev --ignore-platform-reqs --update-with-all-dependencies phpunit/phpunit:^7
- if: ${{ contains(fromJson('["5.6", "7.0", "7.1"]'), matrix.php)}}
name: Run PHPUnit Patches
run: sh .github/apply-phpunit-patches.sh
- name: Run Script
run: vendor/bin/phpunit
test_lowest:
runs-on: ${{matrix.operating-system}}
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ "5.6", "7.0", "7.1", "7.2" ]
php: [ "5.6", "7.2" ]
name: PHP ${{matrix.php }} Unit Test Prefer Lowest
steps:
- uses: actions/checkout@v3
Expand All @@ -56,14 +46,16 @@ jobs:
timeout_minutes: 10
max_attempts: 3
command: composer update --prefer-lowest
- if: ${{ matrix.php == '5.6' }}
name: Run PHPUnit Patches
run: sh .github/apply-phpunit-patches.sh
- name: Run Script
run: vendor/bin/phpunit
guzzle6:
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ "5.6", "7.2" ]
php: [ "7.2" ]
name: PHP ${{ matrix.php }} Unit Test Guzzle 6
steps:
- uses: actions/checkout@v3
Expand All @@ -79,51 +71,6 @@ jobs:
command: composer require guzzlehttp/guzzle:^6 && composer update
- name: Run Script
run: vendor/bin/phpunit
# use dockerfiles for oooooolllllldddd versions of php, setup-php times out for those.
test_php55:
name: "PHP 5.5 Unit Test"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Unit Tests
uses: docker://php:5.5-cli
with:
entrypoint: ./.github/actions/unittest/entrypoint.sh
test_php55_lowest:
name: "PHP 5.5 Unit Test Prefer Lowest"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Unit Tests
uses: docker://php:5.5-cli
env:
composerargs: "--prefer-lowest"
with:
entrypoint: ./.github/actions/unittest/entrypoint.sh
test_php54:
name: "PHP 5.4 Unit Test"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Unit Tests
uses: docker://php:5.4-cli
with:
entrypoint: ./.github/actions/unittest/entrypoint.sh
test_php54_lowest:
name: "PHP 5.4 Unit Test Prefer Lowest"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Unit Tests
uses: docker://php:5.4-cli
env:
composerargs: "--prefer-lowest"
with:
entrypoint: ./.github/actions/unittest/entrypoint.sh
style:
runs-on: ubuntu-latest
name: PHP Style Check
Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
"docs": "https://googleapis.github.io/google-auth-library-php/main/"
},
"require": {
"php": ">=5.4",
"firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0",
"guzzlehttp/guzzle": "^5.3.1|^6.2.1|^7.0",
"php": ">=5.6",
"firebase/php-jwt": "~5.0",
"guzzlehttp/guzzle": "^6.2.1|^7.0",
"guzzlehttp/psr7": "^1.7|^2.0",
"psr/http-message": "^1.0",
"psr/cache": "^1.0|^2.0"
},
"require-dev": {
"guzzlehttp/promises": "0.1.1|^1.3",
"phpunit/phpunit": "^4.8.36|^5.7",
"squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "^5.7||^8.5.13",
"phpspec/prophecy-phpunit": "^1.1",
"sebastian/comparator": ">=1.2.3",
"phpseclib/phpseclib": "^2.0.31",
"kelvinmo/simplejwt": "^0.2.5|^0.5.1"
Expand Down
7 changes: 0 additions & 7 deletions src/Cache/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,10 @@ private function isValidExpiration($expiration)
return true;
}

// We test for two types here due to the fact the DateTimeInterface
// was not introduced until PHP 5.5. Checking for the DateTime type as
// well allows us to support 5.4.
if ($expiration instanceof \DateTimeInterface) {
return true;
}

if ($expiration instanceof \DateTime) {
return true;
}

return false;
}

Expand Down
136 changes: 0 additions & 136 deletions src/Subscriber/AuthTokenSubscriber.php

This file was deleted.

0 comments on commit 888ee55

Please sign in to comment.