From 059324d3ebfbf9312f5a9a6c2f9cb769105689d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 21:11:56 +0000 Subject: [PATCH 1/6] Adds PHPUnit 10.5 support --- .github/workflows/tests.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index efd4bcc..369e542 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,7 @@ jobs: - '7.1' - '7.0' phpunit-version: + - '10.5.0' - '10.4.0' - '10.3.0' - '10.2.0' @@ -193,6 +194,8 @@ jobs: phpunit-version: '6.0.0' # PHP 8.0 Exclusions + - php-version: '8.0' + phpunit-version: '10.5.0' - php-version: '8.0' phpunit-version: '10.4.0' - php-version: '8.0' @@ -245,6 +248,8 @@ jobs: phpunit-version: '6.0.0' # PHP 7.4 Exclusions + - php-version: '7.4' + phpunit-version: '10.5.0' - php-version: '7.4' phpunit-version: '10.4.0' - php-version: '7.4' @@ -283,6 +288,8 @@ jobs: phpunit-version: '6.0.0' # PHP 7.3 Exclusions + - php-version: '7.3' + phpunit-version: '10.5.0' - php-version: '7.3' phpunit-version: '10.4.0' - php-version: '7.3' @@ -295,6 +302,8 @@ jobs: phpunit-version: '10.0.0' # PHP 7.2 Exclusions + - php-version: '7.2' + phpunit-version: '10.5.0' - php-version: '7.2' phpunit-version: '10.4.0' - php-version: '7.2' @@ -321,6 +330,8 @@ jobs: phpunit-version: '9.0.0' # PHP 7.1 Exclusions + - php-version: '7.1' + phpunit-version: '10.5.0' - php-version: '7.1' phpunit-version: '10.4.0' - php-version: '7.1' @@ -359,6 +370,8 @@ jobs: phpunit-version: '8.0.0' # PHP 7.0 Exclusions + - php-version: '7.0' + phpunit-version: '10.5.0' - php-version: '7.0' phpunit-version: '10.4.0' - php-version: '7.0' From c05e3d7fb4fbc846627846dde9adccdd1476a82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 21:33:00 +0000 Subject: [PATCH 2/6] update tests and remove deprecations --- classes/PHPMock.php | 2 +- tests/MockObjectProxyTest.php | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/classes/PHPMock.php b/classes/PHPMock.php index 2a12b03..543db17 100644 --- a/classes/PHPMock.php +++ b/classes/PHPMock.php @@ -210,7 +210,7 @@ private function prepareCustomTemplates() $reflectionTemplates = $reflection->getProperty('templates'); $reflectionTemplates->setAccessible(true); - $reflectionTemplates->setValue($templates); + $reflectionTemplates->setValue(null, $templates); break; } diff --git a/tests/MockObjectProxyTest.php b/tests/MockObjectProxyTest.php index e9020d4..482e052 100644 --- a/tests/MockObjectProxyTest.php +++ b/tests/MockObjectProxyTest.php @@ -34,12 +34,25 @@ public function testExpects() { $matcher = $this->getMockBuilder(Invocation::class)->getMock(); - $methods = class_exists(ConfigurableMethod::class) - ? new ConfigurableMethod( - MockDelegateFunctionBuilder::METHOD, - Mockery::mock(Type::class) - ) - : [MockDelegateFunctionBuilder::METHOD]; + if (class_exists(ConfigurableMethod::class)) { + if (class_exists(\PHPUnit\Runner\Version::class) + && version_compare(\PHPUnit\Runner\Version::id(), '10.5.0') >= 0 + ) { + $methods = new ConfigurableMethod( + MockDelegateFunctionBuilder::METHOD, + [], + 0, + Mockery::mock(Type::class) + ); + } else { + $methods = new ConfigurableMethod( + MockDelegateFunctionBuilder::METHOD, + Mockery::mock(Type::class) + ); + } + } else { + $methods = [MockDelegateFunctionBuilder::METHOD]; + } if (class_exists(\PHPUnit\Runner\Version::class) && version_compare(\PHPUnit\Runner\Version::id(), '8.4.0') >= 0 From bc40439853c5470f5c38fad275ef2f3e64133158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 21:42:45 +0000 Subject: [PATCH 3/6] Update workflows --- .github/workflows/coding-standards.yml | 27 ++++++++++++++++++++++++++ .github/workflows/phpmd.yml | 27 ++++++++++++++++++++++++++ .github/workflows/tests.yml | 10 ++-------- 3 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/coding-standards.yml create mode 100644 .github/workflows/phpmd.yml diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..62e01cc --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,27 @@ +name: "Check Coding Standards" + +on: + pull_request: + push: + +jobs: + coding-standards: + name: "Check Coding Standards" + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + tools: composer:v2, cs2pr + + - name: Install dependencies + run: composer require phpcsstandards/php_codesniffer --no-interaction --no-progress --no-suggest + + - name: "Run phpcs" + run: vendor/bin/phpcs -q --standard=PSR2 classes/ tests/ --report=checkstyle | cs2pr diff --git a/.github/workflows/phpmd.yml b/.github/workflows/phpmd.yml new file mode 100644 index 0000000..7559785 --- /dev/null +++ b/.github/workflows/phpmd.yml @@ -0,0 +1,27 @@ +name: "Check phpmd" + +on: + pull_request: + push: + +jobs: + coding-standards: + name: "Check phpmd" + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + tools: composer:v2 + + - name: Install dependencies + run: composer require phpmd/phpmd --no-interaction --no-progress --no-suggest + + - name: Run phpmd + run: vendor/bin/phpmd classes/ text cleancode,codesize,controversial,design,naming,unusedcode diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 369e542..ad2245e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -424,7 +424,7 @@ jobs: name: PHPUnit ${{ matrix.phpunit-version }} on PHP ${{ matrix.php-version }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -432,13 +432,7 @@ jobs: php-version: ${{ matrix.php-version }} - name: Install Dependencies - run: composer require phpunit/phpunit:~${{ matrix.phpunit-version }} squizlabs/php_codesniffer phpmd/phpmd + run: composer require phpunit/phpunit:~${{ matrix.phpunit-version }} --no-interaction --no-progress --no-suggest - name: PHPUnit run: vendor/bin/phpunit - - - 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 7cf83096114009d71c7106c400e5853b93807b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 21:45:12 +0000 Subject: [PATCH 4/6] Update workflows --- .github/workflows/coding-standards.yml | 5 ++++- .github/workflows/phpmd.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 62e01cc..a772a15 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -2,7 +2,10 @@ name: "Check Coding Standards" on: pull_request: - push: + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true jobs: coding-standards: diff --git a/.github/workflows/phpmd.yml b/.github/workflows/phpmd.yml index 7559785..b21a57f 100644 --- a/.github/workflows/phpmd.yml +++ b/.github/workflows/phpmd.yml @@ -2,7 +2,10 @@ name: "Check phpmd" on: pull_request: - push: + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true jobs: coding-standards: From ad6fe57f72d339cfbb628d93f54416b89a707d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 21:46:17 +0000 Subject: [PATCH 5/6] Update workflows --- .github/workflows/coding-standards.yml | 4 ---- .github/workflows/phpmd.yml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index a772a15..7349885 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -3,10 +3,6 @@ name: "Check Coding Standards" on: pull_request: -concurrency: - group: ${{ github.head_ref }} - cancel-in-progress: true - jobs: coding-standards: name: "Check Coding Standards" diff --git a/.github/workflows/phpmd.yml b/.github/workflows/phpmd.yml index b21a57f..c268831 100644 --- a/.github/workflows/phpmd.yml +++ b/.github/workflows/phpmd.yml @@ -3,10 +3,6 @@ name: "Check phpmd" on: pull_request: -concurrency: - group: ${{ github.head_ref }} - cancel-in-progress: true - jobs: coding-standards: name: "Check phpmd" From dbbd8c62953fa6db22b37d14538a25e9bc0dfdb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bundyra?= Date: Fri, 1 Dec 2023 21:47:30 +0000 Subject: [PATCH 6/6] Update workflows - remove --no-suggest --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/phpmd.yml | 2 +- .github/workflows/tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 7349885..52cc8ac 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -20,7 +20,7 @@ jobs: tools: composer:v2, cs2pr - name: Install dependencies - run: composer require phpcsstandards/php_codesniffer --no-interaction --no-progress --no-suggest + run: composer require phpcsstandards/php_codesniffer --no-interaction --no-progress - name: "Run phpcs" run: vendor/bin/phpcs -q --standard=PSR2 classes/ tests/ --report=checkstyle | cs2pr diff --git a/.github/workflows/phpmd.yml b/.github/workflows/phpmd.yml index c268831..4854690 100644 --- a/.github/workflows/phpmd.yml +++ b/.github/workflows/phpmd.yml @@ -20,7 +20,7 @@ jobs: tools: composer:v2 - name: Install dependencies - run: composer require phpmd/phpmd --no-interaction --no-progress --no-suggest + run: composer require phpmd/phpmd --no-interaction --no-progress - name: Run phpmd run: vendor/bin/phpmd classes/ text cleancode,codesize,controversial,design,naming,unusedcode diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ad2245e..a6eb00d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -432,7 +432,7 @@ jobs: php-version: ${{ matrix.php-version }} - name: Install Dependencies - run: composer require phpunit/phpunit:~${{ matrix.phpunit-version }} --no-interaction --no-progress --no-suggest + run: composer require phpunit/phpunit:~${{ matrix.phpunit-version }} --no-interaction --no-progress - name: PHPUnit run: vendor/bin/phpunit