Skip to content

Commit

Permalink
Merge pull request #1140 from GrahamCampbell/php81-fixes
Browse files Browse the repository at this point in the history
[1.3] More fixes for PHP 8.1 and setup CI again
  • Loading branch information
davedevelopment committed Aug 25, 2021
2 parents 0a999ca + 2bbc2b1 commit 6be9039
Show file tree
Hide file tree
Showing 10 changed files with 307 additions and 156 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
@@ -1,12 +1,11 @@
* text=auto

/.github export-ignore
/docker export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.scrutinizer.yml export-ignore
.styleci.yml export-ignore
.travis.yml export-ignore
Makefile export-ignore
phpunit.xml.dist export-ignore
139 changes: 139 additions & 0 deletions .github/workflows/tests.yml
@@ -0,0 +1,139 @@
name: Tests

on:
push:
pull_request:

jobs:
php5:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04

strategy:
matrix:
php: ['5.6']

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: mongodb, redis
coverage: xdebug

- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Execute PHPUnit
run: vendor/bin/phpunit --coverage-text --testsuite="Mockery Test Suite PHP5"

php7:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04

strategy:
matrix:
php: ['7.0', '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
extensions: mongodb, redis
coverage: xdebug

- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Execute PHPUnit
run: vendor/bin/phpunit --coverage-text --testsuite="Mockery Test Suite PHP7"

php80:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04

strategy:
matrix:
php: ['8.0']

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: xdebug

- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Execute PHPUnit
run: vendor/bin/phpunit --coverage-text --testsuite="Mockery Test Suite PHP8"

php81:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04

strategy:
matrix:
php: ['8.1']

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: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Mimic PHP 8.0
run: composer config platform.php 8.0.999

- name: Install Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Execute PHPUnit
run: vendor/bin/phpunit --testsuite="Mockery Test Suite PHP8"
24 changes: 0 additions & 24 deletions .scrutinizer.yml

This file was deleted.

60 changes: 0 additions & 60 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
@@ -1,9 +1,8 @@
Mockery
=======

[![Build Status](https://travis-ci.org/mockery/mockery.svg?branch=master)](https://travis-ci.org/mockery/mockery)
[![Build Status](https://github.com/mockery/mockery/workflows/tests/badge.svg)](https://github.com/mockery/mockery/actions)
[![Latest Stable Version](https://poser.pugx.org/mockery/mockery/v/stable.svg)](https://packagist.org/packages/mockery/mockery)
[![Coverage Status](https://coveralls.io/repos/github/mockery/mockery/badge.svg)](https://coveralls.io/github/mockery/mockery)
[![Total Downloads](https://poser.pugx.org/mockery/mockery/downloads.svg)](https://packagist.org/packages/mockery/mockery)

Mockery is a simple yet flexible PHP mock object framework for use in unit testing
Expand Down
Expand Up @@ -30,7 +30,8 @@
*/
class RemoveUnserializeForInternalSerializableClassesPass
{
const DUMMY_METHOD_DEFINITION = 'public function unserialize($string) {} ';
const DUMMY_METHOD_DEFINITION_LEGACY = 'public function unserialize($string) {} ';
const DUMMY_METHOD_DEFINITION = 'public function unserialize(string $data): void {} ';

public function apply($code, MockConfiguration $config)
{
Expand All @@ -44,7 +45,7 @@ public function apply($code, MockConfiguration $config)
return $code;
}

$code = $this->appendToClass($code, self::DUMMY_METHOD_DEFINITION);
$code = $this->appendToClass($code, \PHP_VERSION_ID < 80100 ? self::DUMMY_METHOD_DEFINITION_LEGACY : self::DUMMY_METHOD_DEFINITION);

return $code;
}
Expand Down
12 changes: 7 additions & 5 deletions phpunit.xml.dist
Expand Up @@ -6,24 +6,26 @@
<testsuites>
<testsuite name="Mockery Test Suite PHP8">
<directory suffix="Test.php">./tests</directory>
<directory phpVersion="8.0.0" phpVersionOperator=">=">./tests/PHP80</directory>
<directory phpVersion="8.0.0-dev" phpVersionOperator=">=">./tests/PHP80</directory>
<directory phpVersion="8.1.0-dev" phpVersionOperator=">=">./tests/PHP81</directory>
</testsuite>

<testsuite name="Mockery Test Suite PHP7">
<directory suffix="Test.php">./tests</directory>
<directory phpVersion="7.0.0" phpVersionOperator=">=">./tests/PHP70</directory>
<directory phpVersion="7.1.0" phpVersionOperator=">=">./tests/PHP71</directory>
<directory phpVersion="7.2.0" phpVersionOperator=">=">./tests/PHP72</directory>
<directory phpVersion="7.0.0-dev" phpVersionOperator=">=">./tests/PHP70</directory>
<directory phpVersion="7.1.0-dev" phpVersionOperator=">=">./tests/PHP71</directory>
<directory phpVersion="7.2.0-dev" phpVersionOperator=">=">./tests/PHP72</directory>
<exclude>./tests/PHP80</exclude>
<exclude>./tests/PHP81</exclude>
</testsuite>

<testsuite name="Mockery Test Suite PHP5">
<directory suffix="Test.php">./tests</directory>
<directory suffix="Test.php">./tests/PHP56</directory>
<exclude>./tests/PHP70</exclude>
<exclude>./tests/PHP71</exclude>
<exclude>./tests/PHP72</exclude>
<exclude>./tests/PHP80</exclude>
<exclude>./tests/PHP81</exclude>
</testsuite>
</testsuites>

Expand Down

0 comments on commit 6be9039

Please sign in to comment.