From ed068f2679210101aa64839740acc540111f3375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 20:50:02 +0000 Subject: [PATCH 01/13] GHA Workflow instead of TravisCI --- .github/workflows/tests.yml | 95 +++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ef5e80f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,95 @@ +on: + pull_request: + schedule: + - cron: "0 0 * * *" + +concurrency: + group: ${{ github.head_ref || 'cron' }} + cancel-in-progress: true + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: + - '8.1' + - '8.0' + - '7.4' + - '7.3' + - '7.2' + - '7.1' + - '7.0' + mockery-version: + - '1.5.0' + - '1.4.0' + - '1.3.0' + - '1.2.0' + - '1.1.0' + - '1.0.0' + - '0.9.0' + - '0.8.0' + + exclude: + # PHP 8.1 Exclusions + - php-version: '8.1' + mockery-version: '1.3.0' + - php-version: '8.1' + mockery-version: '1.2.0' + - php-version: '8.1' + mockery-version: '1.1.0' + - php-version: '8.1' + mockery-version: '1.0.0' + - php-version: '8.1' + mockery-version: '0.9.0' + - php-version: '8.1' + mockery-version: '0.8.0' + + # PHP 8.0 Exclusions + - php-version: '8.0' + mockery-version: '1.1.0' + - php-version: '8.0' + mockery-version: '1.0.0' + - php-version: '8.0' + mockery-version: '0.9.0' + - php-version: '8.0' + mockery-version: '0.8.0' + + # PHP 7.4 Exclusions + - php-version: '7.4' + mockery-version: '1.1.0' + - php-version: '7.4' + mockery-version: '1.0.0' + - php-version: '7.4' + mockery-version: '0.9.0' + - php-version: '7.4' + mockery-version: '0.8.0' + + name: Mockery ${{ matrix.movkery-version }} on PHP ${{ matrix.php-version }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Install Dependencies + run: composer require mockery/mockery:~${{ matrix.mockery-version }} squizlabs/php_codesniffer phpmd/phpmd cundd/test-flight + + - name: PHPUnit + run: vendor/bin/phpunit + + - name: Test Flight + run: | + vendor/bin/test-flight README.md + vendor/bin/test-flight classes/ + + - name: PHPCS + run: vendor/bin/phpcs --standard=PSR2 classes/ tests/ + + - name: PHPMD + run: vendor/bin/phpmd classes/ text cleancode,codesize,controversial,design,naming,unusedcode From 5d6ff9b067548af1da25957d273ade02c05e5ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 20:50:20 +0000 Subject: [PATCH 02/13] Delete .travis.yml --- .travis.yml | 55 ----------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 85183ea..0000000 --- a/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -env: - - MOCKERY_VERSION=dev-master - - MOCKERY_VERSION=~1.4.0 - - MOCKERY_VERSION=~1.3.0 - - MOCKERY_VERSION=~1.2.0 - - MOCKERY_VERSION=~1.1.0 - - MOCKERY_VERSION=~1.0.0 - - MOCKERY_VERSION=~0.9.0 - - MOCKERY_VERSION=~0.8.0 - -php: - - 8.0 - - 7.4 - - 7.3 - - 7.2 - - 7.1 - - 7.0 - - 5.6 - -matrix: - fast_finish: true - exclude: - - php: 8.0 - env: MOCKERY_VERSION=~1.1.0 - - php: 8.0 - env: MOCKERY_VERSION=~1.0.0 - - php: 8.0 - env: MOCKERY_VERSION=~0.9.0 - - php: 8.0 - env: MOCKERY_VERSION=~0.8.0 - - - php: 7.4 - env: MOCKERY_VERSION=~1.1.0 - - php: 7.4 - env: MOCKERY_VERSION=~1.0.0 - - php: 7.4 - env: MOCKERY_VERSION=~0.9.0 - - php: 7.4 - env: MOCKERY_VERSION=~0.8.0 - -install: - - composer require mockery/mockery:${MOCKERY_VERSION} squizlabs/php_codesniffer phpmd/phpmd cundd/test-flight - -script: - - vendor/bin/phpunit - - vendor/bin/test-flight README.md - - vendor/bin/test-flight classes/ - - vendor/bin/phpcs --standard=PSR2 classes/ tests/ - - vendor/bin/phpmd classes/ text cleancode,codesize,controversial,design,naming,unusedcode From 9931bc3c95a803835400db5a3157e9fd8d0d0e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 20:51:38 +0000 Subject: [PATCH 03/13] Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4c096c7..53c9629 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ +[![.github/workflows/tests.yml](https://github.com/php-mock/php-mock-mockery/actions/workflows/tests.yml/badge.svg)](https://github.com/php-mock/php-mock-mockery/actions/workflows/tests.yml) + # Mock PHP built-in functions with Mockery This package integrates the function mock library [PHP-Mock](https://github.com/php-mock/php-mock) with Mockery. -# Installation +## Installation Use [Composer](https://getcomposer.org/): @@ -11,14 +13,14 @@ Use [Composer](https://getcomposer.org/): composer require --dev php-mock/php-mock-mockery ``` -# Usage +## Usage [`PHPMockery::mock()`](http://php-mock.github.io/php-mock-mockery/api/class-phpmock.mockery.PHPMockery.html#_mock) let's you build a function mock which can be equiped with Mockery's expectations. After your test you'll have to disable all created function mocks by calling `Mockery::close()`. -## Example +### Example ```php namespace foo; @@ -31,7 +33,7 @@ assert (3 == time()); \Mockery::close(); ``` -## Restrictions +### Restrictions This library comes with the same restrictions as the underlying [`php-mock`](https://github.com/php-mock/php-mock#requirements-and-restrictions): @@ -46,14 +48,12 @@ This library comes with the same restrictions as the underlying this issue you can call [`PHPMockery::define()`](http://php-mock.github.io/php-mock-mockery/api/class-phpmock.mockery.PHPMockery.html#_define) before that first call. This would define a side effectless namespaced function. -# License and authors +## License and authors This project is free and under the WTFPL. Responsable for this project is Markus Malkusch markus@malkusch.de. -## Donations +### Donations If you like this project and feel generous donate a few Bitcoins here: [1335STSwu9hST4vcMRppEPgENMHD2r1REK](bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK) - -[![Build Status](https://travis-ci.org/php-mock/php-mock-mockery.svg?branch=master)](https://travis-ci.org/php-mock/php-mock-mockery) From 35c63fa4b207a8b9a73ed0c223d42d4f86a81483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 20:54:15 +0000 Subject: [PATCH 04/13] Update tests.yml --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef5e80f..2afc285 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -76,6 +76,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} + ini-values: zend.assertions=1 - name: Install Dependencies run: composer require mockery/mockery:~${{ matrix.mockery-version }} squizlabs/php_codesniffer phpmd/phpmd cundd/test-flight From 94234296e2f353638109655bf29ebf04d67abce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 20:59:08 +0000 Subject: [PATCH 05/13] Update tests.yml --- .github/workflows/tests.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2afc285..3cb8cb4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -64,6 +64,18 @@ jobs: mockery-version: '0.9.0' - php-version: '7.4' mockery-version: '0.8.0' + + # PHP 7.2 Exclusions + - php-version: '7.2' + mockery-version: '1.5.0' + + # PHP 7.1 Exclusions + - php-version: '7.1' + mockery-version: '1.5.0' + + # PHP 7.0 Exclusions + - php-version: '7.0' + mockery-version: '1.5.0' name: Mockery ${{ matrix.movkery-version }} on PHP ${{ matrix.php-version }} steps: From 22f9511a7cbf8c90d89f40041f6ee9b74edc0147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 21:00:35 +0000 Subject: [PATCH 06/13] Update tests.yml --- .github/workflows/tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3cb8cb4..aac2a6c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -68,14 +68,20 @@ jobs: # PHP 7.2 Exclusions - php-version: '7.2' mockery-version: '1.5.0' + - php-version: '7.2' + mockery-version: '1.4.0' # PHP 7.1 Exclusions - php-version: '7.1' mockery-version: '1.5.0' + - php-version: '7.1' + mockery-version: '1.4.0' # PHP 7.0 Exclusions - php-version: '7.0' mockery-version: '1.5.0' + - php-version: '7.0' + mockery-version: '1.4.0' name: Mockery ${{ matrix.movkery-version }} on PHP ${{ matrix.php-version }} steps: From 4094c9749b80dc4e0db91ae59b207ada6fc4be71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 21:02:30 +0000 Subject: [PATCH 07/13] Update tests.yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aac2a6c..63cd33b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -83,7 +83,7 @@ jobs: - php-version: '7.0' mockery-version: '1.4.0' - name: Mockery ${{ matrix.movkery-version }} on PHP ${{ matrix.php-version }} + name: Mockery ${{ matrix.mockery-version }} on PHP ${{ matrix.php-version }} steps: - name: Checkout uses: actions/checkout@v2 From 9d542dcd3e86a392af2281ee371dd165a90cdc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 21:09:11 +0000 Subject: [PATCH 08/13] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index efbe075..4ad1a03 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php-mock/php-mock-integration": "^2" }, "require-dev": { - "phpunit/phpunit": "^4|^5" + "phpunit/phpunit": "^4|^5|^6" }, "archive": { "exclude": ["/tests"] From 405a8b363a138d89a30b3604cf8aa17c0c47e02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 21:12:36 +0000 Subject: [PATCH 09/13] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4ad1a03..c7bfe93 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php-mock/php-mock-integration": "^2" }, "require-dev": { - "phpunit/phpunit": "^4|^5|^6" + "phpunit/phpunit": "^4|^5|^8" }, "archive": { "exclude": ["/tests"] From 9b4efd5c7ce539b01f820c123a9953f2eb819ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 21:16:23 +0000 Subject: [PATCH 10/13] Update PHPMockeryTest.php --- tests/PHPMockeryTest.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/PHPMockeryTest.php b/tests/PHPMockeryTest.php index 3f799a7..62ebed6 100644 --- a/tests/PHPMockeryTest.php +++ b/tests/PHPMockeryTest.php @@ -32,10 +32,8 @@ protected function mockFunction($namespace, $functionName, callable $function) PHPMockery::mock($namespace, $functionName)->andReturnUsing($function); } - protected function setUp() - { - parent::setUp(); - + protected function setUpCompat() + { $this->workaroundMockeryIssue268(); } From 31ea6edbb5aa3a9e771b3454c9f7178bf6fbae8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 21:17:24 +0000 Subject: [PATCH 11/13] Update PHPMockeryTest.php --- tests/PHPMockeryTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/PHPMockeryTest.php b/tests/PHPMockeryTest.php index 62ebed6..cfd89cc 100644 --- a/tests/PHPMockeryTest.php +++ b/tests/PHPMockeryTest.php @@ -33,7 +33,9 @@ protected function mockFunction($namespace, $functionName, callable $function) } protected function setUpCompat() - { + { + parent::setUp(); + $this->workaroundMockeryIssue268(); } From 0f919a9bb0905f2705fb538f17dbaf425c8f5467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 21:20:23 +0000 Subject: [PATCH 12/13] Update PHPMockeryTest.php --- tests/PHPMockeryTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/PHPMockeryTest.php b/tests/PHPMockeryTest.php index cfd89cc..e5f8f9b 100644 --- a/tests/PHPMockeryTest.php +++ b/tests/PHPMockeryTest.php @@ -34,8 +34,6 @@ protected function mockFunction($namespace, $functionName, callable $function) protected function setUpCompat() { - parent::setUp(); - $this->workaroundMockeryIssue268(); } From 78d48b9fbbf946399ee2b54a93e40f5595b4130d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Tue, 25 Jan 2022 21:24:16 +0000 Subject: [PATCH 13/13] Update tests.yml --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 63cd33b..838bff0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -103,6 +103,7 @@ jobs: run: vendor/bin/phpunit - name: Test Flight + if: matrix.php-version != '8.1' run: | vendor/bin/test-flight README.md vendor/bin/test-flight classes/