Skip to content

Commit

Permalink
PHPUnit 10 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk authored Feb 22, 2023
1 parent d219499 commit a87528d
Show file tree
Hide file tree
Showing 17 changed files with 175 additions and 252 deletions.
10 changes: 5 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ updates:
directory: "/"
schedule:
interval: "weekly"
commit-message:
include: "scope"
prefix: "composer"
labels:
- "dependency-update"
versioning-strategy: "widen"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
102 changes: 102 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: "CI"

on:
pull_request:
push:
branches:
- "master"

env:
INI_VALUES: zend.assertions=1,error_reporting=-1

jobs:
composer-json-lint:
name: "Lint composer.json"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"

steps:
- uses: "actions/checkout@v3"
- uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-values: "${{ env.INI_VALUES }}"
tools: composer-normalize,composer-require-checker,composer-unused
- uses: "ramsey/composer-install@v2"

- run: "composer validate --strict"
- run: "composer-normalize --dry-run"
- run: "composer-require-checker check"
- run: "composer-unused"

tests:
name: "Tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.2"
code-coverage:
- "none"
include:
- php-version: "8.1"
code-coverage: "pcov"

steps:
- uses: "actions/checkout@v3"
- uses: "shivammathur/setup-php@v2"
with:
coverage: "${{ matrix.code-coverage }}"
php-version: "${{ matrix.php-version }}"
ini-values: "${{ env.INI_VALUES }}"
- uses: "ramsey/composer-install@v2"

- run: "vendor/bin/phpunit --no-coverage --no-logging"
if: ${{ matrix.code-coverage == 'none' }}
timeout-minutes: 3

- run: "vendor/bin/phpunit --no-logging"
if: ${{ matrix.code-coverage != 'none' }}
timeout-minutes: 3

coding-standards:
name: "Coding Standards"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"

steps:
- uses: "actions/checkout@v3"
- uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-values: "${{ env.INI_VALUES }}"
- uses: "ramsey/composer-install@v2"

- run: "vendor/bin/php-cs-fixer fix --verbose --dry-run --diff"

static-analysis:
name: "Static Analysis"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"

steps:
- uses: "actions/checkout@v3"
- uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-values: "${{ env.INI_VALUES }}"
- uses: "ramsey/composer-install@v2"

- run: "vendor/bin/phpstan analyse --no-progress --error-format=github"
169 changes: 0 additions & 169 deletions .github/workflows/integrate.yaml

This file was deleted.

12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.idea/
vendor/
.php-cs-fixer.cache
composer.lock
.phpunit.result.cache
/.idea/
/.phpunit.cache/
/vendor/
/coverage/
/.php-cs-fixer.cache
/.phpunit.result.cache
/composer.lock
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
CSFIX_PHP_BIN=PHP_CS_FIXER_IGNORE_ENV=1 php8.2
PHP_BIN=php8.2 -d zend.assertions=1 -d error_reporting=-1
COMPOSER_BIN=$(shell command -v composer)

all: csfix static-analysis test
@echo "Done."

vendor: composer.json
composer update
composer bump
$(PHP_BIN) $(COMPOSER_BIN) update
$(PHP_BIN) $(COMPOSER_BIN) bump
touch vendor

.PHONY: csfix
csfix: vendor
vendor/bin/php-cs-fixer fix --verbose
$(CSFIX_PHP_BIN) vendor/bin/php-cs-fixer fix -v

.PHONY: static-analysis
static-analysis: vendor
php -d zend.assertions=1 vendor/bin/phpstan analyse
$(PHP_BIN) vendor/bin/phpstan analyse $(PHPSTAN_ARGS)

.PHONY: test
test: vendor
php -d zend.assertions=1 vendor/bin/phpunit
$(PHP_BIN) vendor/bin/phpunit $(PHPUNIT_ARGS)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Latest Stable Version](https://img.shields.io/packagist/v/slam/php-cs-fixer-extensions.svg)](https://packagist.org/packages/slam/php-cs-fixer-extensions)
[![Downloads](https://img.shields.io/packagist/dt/slam/php-cs-fixer-extensions.svg)](https://packagist.org/packages/slam/php-cs-fixer-extensions)
[![Integrate](https://github.com/Slamdunk/php-cs-fixer-extensions/workflows/Integrate/badge.svg?branch=master)](https://github.com/Slamdunk/php-cs-fixer-extensions/actions)
[![Integrate](https://github.com/Slamdunk/php-cs-fixer-extensions/workflows/CI/badge.svg?branch=master)](https://github.com/Slamdunk/php-cs-fixer-extensions/actions)

[PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) extensions and configurations

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"php": "~8.1.0 || ~8.2.0",
"ext-mbstring": "*",
"ext-tokenizer": "*",
"friendsofphp/php-cs-fixer": "^3.13.2"
"friendsofphp/php-cs-fixer": "^3.14.4"
},
"require-dev": {
"phpstan/phpstan": "^1.9.6",
"phpstan/phpstan-phpunit": "^1.3.3",
"phpunit/phpunit": "^9.5.27",
"phpstan/phpstan": "^1.10.1",
"phpstan/phpstan-phpunit": "^1.3.7",
"phpunit/phpunit": "^10.0.11",
"slam/php-debug-r": "^1.7.0",
"slam/phpstan-extensions": "^6.0.0"
},
Expand Down
1 change: 1 addition & 0 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ final class Config extends PhpCsFixerConfig
'nullable_type_declaration_for_default_null_value' => true,
'ordered_class_elements' => ['order' => ['use_trait', 'constant_public', 'constant_protected', 'constant_private', 'property', 'construct', 'destruct', 'magic', 'phpunit', 'method']],
'ordered_interfaces' => true,
'php_unit_data_provider_static' => true,
'php_unit_internal_class' => false,
'php_unit_size_class' => false,
'php_unit_strict' => false,
Expand Down
3 changes: 1 addition & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./vendor/autoload.php"
colors="true"
verbose="true"
cacheDirectory=".phpunit.cache"
>
<coverage>
<include>
Expand Down
Loading

0 comments on commit a87528d

Please sign in to comment.