Skip to content

Commit

Permalink
testing php 8.1 (#125)
Browse files Browse the repository at this point in the history
* testing php 8.1

* narrowing php versions
  • Loading branch information
jaydiablo authored Dec 4, 2021
1 parent b0f2a62 commit 079d56c
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 90 deletions.
36 changes: 11 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,26 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['7.4', '8.0', '8.1']
composer-args: ['', '--prefer-lowest']
include:
- operating-system: ubuntu-latest
php-versions: '8.0'
composer-args: '--ignore-platform-reqs --no-scripts'
- operating-system: ubuntu-latest
php-versions: '8.0'
composer-args: '--prefer-lowest --ignore-platform-reqs --no-scripts'
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Setup PHP
uses: shivammathur/setup-php@2.10.0
uses: shivammathur/setup-php@2.16.0
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring
coverage: xdebug
coverage: pcov
tools: cs2pr
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/[email protected].4
uses: actions/[email protected].7
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php${{ matrix.php-versions }}-composer-${{ matrix.composer-args }}-${{ hashFiles('**/composer.json') }}
Expand All @@ -50,21 +43,14 @@ jobs:
- name: PHPStan
run: composer phpstan
- name: Code Style Check
env:
PHP_CS_FIXER_IGNORE_ENV: true
run: composer style-check -- --format=checkstyle | cs2pr
- name: Test
run: composer test-with-coverage
- name: Upload Coverage
run: bash <(curl -s https://codecov.io/bash) -f ./clover.xml
merge-me:
name: Merge me!
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Merge me!
uses: ridedott/merge-me-action@master
uses: codecov/codecov-action@v2
with:
# This must be used as GitHub Actions token does not support
# pushing to protected branches.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_LOGIN: 'dependabot[bot]'
files: ./clover.xml
fail_ci_if_error: true
verbose: true
32 changes: 32 additions & 0 deletions .github/workflows/merge-me.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Merge me!

on:
workflow_run:
types:
- completed
workflows:
- 'Build'

jobs:
merge-me:
name: Merge me!
runs-on: ubuntu-latest
steps:
- # It is often a desired behavior to merge only when a workflow execution
# succeeds. This can be changed as needed.
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Merge me!
uses: ridedott/merge-me-action@v2
with:
# Depending on branch protection rules, a manually populated
# `GITHUB_TOKEN_WORKAROUND` secret with permissions to push to
# a protected branch must be used. This secret can have an arbitrary
# name, as an example, this repository uses `DOTTBOTT_TOKEN`.
#
# When using a custom token, it is recommended to leave the following
# comment for other developers to be aware of the reasoning behind it:
#
# This must be used as GitHub Actions token does not support pushing
# to protected branches.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_GITHUB_API_PREVIEW: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/composer.lock
/clover.xml
.php_cs.cache
.phpunit.result.cache
.phpunit.result.cache
.php-cs-fixer.cache
22 changes: 22 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->files()
->in(__DIR__)
;

$config = new PhpCsFixer\Config();
return $config->setRiskyAllowed(true)
->setRules(array(
'@PSR2' => true,
'@PHPUnit60Migration:risky' => true,
'binary_operator_spaces' => array('operators' => array('=' => 'align', '=>' => 'align')),
'single_quote' => true,
'array_syntax' => array('syntax' => 'long'),
'concat_space' => array('spacing' => 'one'),
'psr_autoloading' => array('dir' => 'src'),
))
->setUsingCache(true)
->setFinder($finder);
;
25 changes: 0 additions & 25 deletions .php_cs

This file was deleted.

14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "BSD-3-Clause",
"prefer-stable": true,
"require": {
"php": "^7.1.0 || ^8.0",
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"diablomedia/zendframework1-exception": "^1.0.0",
"diablomedia/zendframework1-loader": "^1.0.0",
"diablomedia/zendframework1-registry": "^1.0.2",
Expand All @@ -21,8 +21,8 @@
"diablomedia/zendframework1-filter": "^1.0.0",
"diablomedia/zendframework1-layout": "^1.0.0",
"diablomedia/zendframework1-session": "^1.0.0",
"phpunit/phpunit": "^8.5.14",
"sebastian/comparator": "^3.0"
"phpunit/phpunit": "^9.5.10",
"sebastian/comparator": "^4.0"
},
"autoload": {
"psr-0": {
Expand All @@ -35,12 +35,12 @@
}
},
"require-dev": {
"phpstan/phpstan": "0.12.82",
"phpstan/phpstan": "1.2.0",
"diablomedia/zendframework1-dojo": "*",
"diablomedia/zendframework1-controller-action-helper-json": "*",
"friendsofphp/php-cs-fixer": "2.18.4",
"maglnet/composer-require-checker": "^1.1.0 || ^2.0.0 || ^3.0.0",
"phpro/grumphp-shim": "^0.22.0 || ^1.1"
"friendsofphp/php-cs-fixer": "3.3.2",
"maglnet/composer-require-checker": "^3.0.0",
"phpro/grumphp-shim": "^1.5.0"
},
"archive": {
"exclude": [
Expand Down
2 changes: 1 addition & 1 deletion grumphp.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ grumphp:
config_file: require-checker-config.json
phpcsfixer2:
allow_risky: true
config: .php_cs
config: .php-cs-fixer.php
phpstan:
configuration: phpstan.neon
memory_limit: 768M
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ parameters:
level: 1
paths:
- ./
excludes_analyse:
excludePaths:
- %rootDir%/../../../vendor/*
- %rootDir%/../../../tests/*
48 changes: 21 additions & 27 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
<phpunit
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
beStrictAboutTestsThatDoNotTestAnything="true"
backupGlobals="true"
stderr="true"
colors="true">
<php>
<const name="TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED" value="false" />
<const name="TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED" value="false" />
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_HOSTNAME" value="127.0.0.1" />
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME" value="" />
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD" value="" />
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE" value="test" />
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_PORT" value="3306" />
</php>
<testsuites>
<testsuite name="default">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" beStrictAboutTestsThatDoNotTestAnything="true" backupGlobals="true" stderr="true" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<php>
<const name="TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED" value="false"/>
<const name="TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED" value="false"/>
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_HOSTNAME" value="127.0.0.1"/>
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME" value=""/>
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD" value=""/>
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE" value="test"/>
<const name="TESTS_ZEND_DB_ADAPTER_MYSQL_PORT" value="3306"/>
</php>
<testsuites>
<testsuite name="default">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion src/Zend/Test/PHPUnit/Constraint/DomQuery41.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function setUseXpath($flag = true)
* public function evaluate($other, $description = '', $returnResult = FALSE)
* We use the new interface for PHP-strict checking, but emulate the old one
*/
public function evaluate($content, $assertType = '', $match = false)
public function evaluate($content, $assertType = '', $match = false): ?bool
{
if (strstr($assertType, 'Not')) {
$this->setNegate(true);
Expand Down
2 changes: 1 addition & 1 deletion src/Zend/Test/PHPUnit/Constraint/Redirect41.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function setNegate($flag = true)
* public function evaluate($other, $description = '', $returnResult = FALSE)
* We use the new interface for PHP-strict checking, but emulate the old one
*/
public function evaluate($other, $assertType = null, $variable = false)
public function evaluate($other, $assertType = null, $variable = false): ?bool
{
if (!$other instanceof Zend_Controller_Response_Abstract) {
throw new Zend_Test_PHPUnit_Constraint_Exception('Redirect constraint assertions require a response object');
Expand Down
2 changes: 1 addition & 1 deletion src/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function setNegate($flag = true)
* public function evaluate($other, $description = '', $returnResult = FALSE)
* We use the new interface for PHP-strict checking, but emulate the old one
*/
public function evaluate($response, $assertType = '', $variable = false)
public function evaluate($response, $assertType = '', $variable = false): ?bool
{
if (!$response instanceof Zend_Controller_Response_Abstract) {
throw new Zend_Test_PHPUnit_Constraint_Exception('Header constraint assertions require a response object');
Expand Down

0 comments on commit 079d56c

Please sign in to comment.