Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
This bumps the minimum required PHP version to 8.2.

PHPSpec is remover in favor of PHPUnit.

Scrutinizer CI is removed because we no longer have coverage.
  • Loading branch information
ruudk committed Oct 31, 2024
1 parent 73b74a2 commit 52264c0
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 273 deletions.
6 changes: 2 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
.github/ export-ignore
.gitignore export-ignore
.php_cs export-ignore
.scrutinizer.yml export-ignore
.styleci.yml export-ignore
phpspec.yml.ci export-ignore
phpspec.yml.dist export-ignore
spec/ export-ignore
phpunit.xml export-ignore
tests export-ignore
77 changes: 10 additions & 67 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ on:
pull_request:

jobs:
latest:
name: PHP ${{ matrix.php }} Latest
tests:
name: PHP ${{ matrix.php }} ${{ matrix.dependencies }}
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
php: ['8.2', '8.3', '8.4']
dependencies:
- "lowest"
- "highest"

steps:
- name: Checkout code
Expand All @@ -20,72 +23,12 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Install PHP 7 dependencies
run: composer update --prefer-dist --no-interaction --no-progress
if: "matrix.php != '8.0'"

- name: Install PHP 8 dependencies
run: |
composer require "phpdocumentor/reflection-docblock:^5.2@dev" --no-interaction --no-update
composer update --prefer-dist --prefer-stable --no-interaction --no-progress --ignore-platform-req=php
if: "matrix.php == '8.0'"

- name: Execute tests
run: composer test

lowest:
name: PHP ${{ matrix.php }} Lowest
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4']

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Install dependencies
run: |
composer require "sebastian/comparator:^3.0.2" --no-interaction --no-update
composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress
- name: Execute tests
run: composer test

coverage:
name: Code Coverage
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
uses: "ramsey/composer-install@v3"
with:
php-version: 7.4
tools: composer:v2
coverage: xdebug
dependency-versions: "${{ matrix.dependencies }}"

- name: Install dependencies
run: |
composer require "friends-of-phpspec/phpspec-code-coverage:^4.3.2" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: composer test-ci

- name: Upload coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml
- name: Run tests
run: composer test
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
build/
vendor/
composer.lock
phpspec.yml
phpunit.xml
/.phpunit.cache/
8 changes: 0 additions & 8 deletions .scrutinizer.yml

This file was deleted.

24 changes: 14 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,31 @@
}
],
"require": {
"php": "^7.0 || ^8.0",
"psr/log": "^1.0 || ^2 || ^3",
"php-http/client-common": "^1.9 || ^2.0",
"php-http/message": "^1.0",
"symfony/polyfill-php73": "^1.17"
},
"require-dev": {
"phpspec/phpspec": "^5.1 || ^6.0"
"php": "^8.2",
"psr/log": "^2 || ^3",
"php-http/client-common": "^2.0",
"php-http/message": "^1.13"
},
"autoload": {
"psr-4": {
"Http\\Client\\Common\\Plugin\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Http\\Client\\Common\\Plugin\\": "tests/"
}
},
"scripts": {
"test": "vendor/bin/phpspec run",
"test-ci": "vendor/bin/phpspec run -c phpspec.yml.ci"
"test": "vendor/bin/phpunit"
},
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"require-dev": {
"phpunit/phpunit": "^11",
"nyholm/psr7": "^1.8"
}
}
10 changes: 0 additions & 10 deletions phpspec.yml.ci

This file was deleted.

5 changes: 0 additions & 5 deletions phpspec.yml.dist

This file was deleted.

26 changes: 26 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
shortenArraysForExportThreshold="10"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
displayDetailsOnPhpunitDeprecations="true"
failOnPhpunitDeprecation="true"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
149 changes: 0 additions & 149 deletions spec/LoggerPluginSpec.php

This file was deleted.

Loading

0 comments on commit 52264c0

Please sign in to comment.