diff --git a/.gitattributes b/.gitattributes index eab33c2..f081c87 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,6 +7,5 @@ docker-compose.override.yml.dist export-ignore docker-compose.yml export-ignore Dockerfile export-ignore indocker export-ignore -infection.json export-ignore phpcs.xml export-ignore phpunit.xml.dist export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d466edf..fce44bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,5 +9,5 @@ on: jobs: ci: uses: shlinkio/github-actions/.github/workflows/php-lib-ci.yml@main - secrets: - INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} + with: + mutation-tests: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 98f57c6..ad83b72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,15 +10,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this ### Changed * Update dependencies +* Update to PHPUnit 11 ### Deprecated * *Nothing* ### Removed -* *Nothing* +* Remove support for openswoole +* Remove infection and mutation tests ### Fixed -* Remove support for openswoole +* *Nothing* ## [3.1.0] - 2023-11-25 diff --git a/README.md b/README.md index 6ee85e8..2c8cee7 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Most of the elements it provides require a [PSR-11](https://www.php-fig.org/psr/ [![Build Status](https://img.shields.io/github/actions/workflow/status/shlinkio/shlink-event-dispatcher/ci.yml?branch=main&logo=github&style=flat-square)](https://github.com/shlinkio/shlink-event-dispatcher/actions/workflows/ci.yml?query=workflow%3A%22Continuous+integration%22) [![Code Coverage](https://img.shields.io/codecov/c/gh/shlinkio/shlink-event-dispatcher/main?style=flat-square)](https://app.codecov.io/gh/shlinkio/shlink-event-dispatcher) -[![Infection MSI](https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fshlinkio%2Fshlink-event-dispatcher%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/shlinkio/shlink-event-dispatcher/main) [![Latest Stable Version](https://img.shields.io/github/release/shlinkio/shlink-event-dispatcher.svg?style=flat-square)](https://packagist.org/packages/shlinkio/shlink-event-dispatcher) [![License](https://img.shields.io/github/license/shlinkio/shlink-event-dispatcher.svg?style=flat-square)](https://github.com/shlinkio/shlink-event-dispatcher/blob/main/LICENSE) [![Paypal donate](https://img.shields.io/badge/Donate-paypal-blue.svg?style=flat-square&logo=paypal&colorA=aaaaaa)](https://slnk.to/donate) diff --git a/composer.json b/composer.json index 77ff47d..d7157b8 100644 --- a/composer.json +++ b/composer.json @@ -20,10 +20,9 @@ "shlinkio/shlink-json": "^1.0" }, "require-dev": { - "infection/infection": "^0.27.9", "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^10.5", + "phpunit/phpunit": "^11.0", "roave/security-advisories": "dev-master", "shlinkio/php-coding-standard": "~2.3.0", "spiral/roadrunner-jobs": "^4.3", @@ -49,35 +48,23 @@ "ci": [ "@cs", "@stan", - "@test:ci", - "@infect:ci" + "@test:ci" ], "cs": "phpcs", "cs:fix": "phpcbf", "stan": "phpstan analyse src test config functions --level=8", "test": "phpunit --order-by=random --testdox --colors=always", - "test:ci": "@test --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/junit.xml", - "test:pretty": "@test --coverage-html build/coverage-html", - "infect": "infection --threads=4 --min-msi=95 --log-verbosity=default --only-covered", - "infect:ci": "@infect --coverage=build --skip-initial-tests", - "infect:show": "@infect --show-mutations", - "infect:show:ci": "@infect --show-mutations --coverage=build --skip-initial-tests", - "test:infect": [ - "@test:ci", - "@infect:show:ci" - ] + "test:ci": "@test --coverage-clover=build/clover.xml", + "test:pretty": "@test --coverage-html=build/coverage-html" }, "scripts-descriptions": { - "ci": "Alias for \"cs\", \"stan\", \"test:ci\" and \"infect:ci\"", + "ci": "Alias for \"cs\", \"stan\" and \"test:ci\"", "cs": "Checks coding styles", "cs:fix": "Fixes coding styles, when possible", "stan": "Inspects code with phpstan", "test": "Runs unit tests with no coverage reports", "test:ci": "Runs unit tests generating coverage reports and logs", - "test:pretty": "Runs unit tests generating coverage reports in html", - "infect": "Checks unit tests quality applying mutation testing", - "infect:ci": "Checks unit tests quality applying mutation testing with existing reports and logs", - "infect:show": "Checks unit tests quality applying mutation testing and shows applied mutators" + "test:pretty": "Runs unit tests generating coverage reports in html" }, "config": { "sort-packages": true, diff --git a/infection.json5 b/infection.json5 deleted file mode 100644 index bcb10ed..0000000 --- a/infection.json5 +++ /dev/null @@ -1,26 +0,0 @@ -{ - source: { - directories: [ - 'src' - ] - }, - timeout: 5, - logs: { - text: 'build/infection/infection-log.txt', - html: 'build/infection/infection-log.html', - summary: 'build/infection/summary-log.txt', - debug: 'build/infection/debug-log.txt', - stryker: { - report: 'main' - } - }, - tmpDir: 'build/infection/temp', - phpUnit: { - configDir: '.' - }, - mutators: { - '@default': true, - IdenticalEqual: false, - NotIdenticalNotEqual: false - } -} diff --git a/test/Functions/ResolveEnabledListenerCheckerTest.php b/test/Functions/ResolveEnabledListenerCheckerTest.php index 988dc94..484c754 100644 --- a/test/Functions/ResolveEnabledListenerCheckerTest.php +++ b/test/Functions/ResolveEnabledListenerCheckerTest.php @@ -26,12 +26,13 @@ protected function setUp(): void } /** + * @param callable(ContainerInterface $c, TestCase $test): void $setUpContainer * @param class-string $expectedResult */ #[Test, DataProvider('provideContainerConfigs')] public function expectedInstanceIsReturned(callable $setUpContainer, string $expectedResult): void { - $setUpContainer($this->container); + $setUpContainer($this->container, $this); $result = resolveEnabledListenerChecker($this->container); self::assertInstanceOf($expectedResult, $result); @@ -46,26 +47,26 @@ public function shouldRegisterListener(string $event, string $listener, bool $is } }; - yield 'no checker service' => [function (MockObject & ContainerInterface $container): void { - $container->expects(self::once())->method('has')->with(EnabledListenerCheckerInterface::class)->willReturn( + yield 'no checker service' => [function (MockObject & ContainerInterface $container, TestCase $t): void { + $container->expects($t->once())->method('has')->with(EnabledListenerCheckerInterface::class)->willReturn( false, ); - $container->expects(self::never())->method('get'); + $container->expects($t->never())->method('get'); }, DummyEnabledListenerChecker::class]; - yield 'invalid checker service' => [function (MockObject & ContainerInterface $container): void { - $container->expects(self::once())->method('has')->with(EnabledListenerCheckerInterface::class)->willReturn( + yield 'invalid checker service' => [function (MockObject & ContainerInterface $container, TestCase $t): void { + $container->expects($t->once())->method('has')->with(EnabledListenerCheckerInterface::class)->willReturn( true, ); - $container->expects(self::once())->method('get')->with(EnabledListenerCheckerInterface::class)->willReturn( + $container->expects($t->once())->method('get')->with(EnabledListenerCheckerInterface::class)->willReturn( new stdClass(), ); }, DummyEnabledListenerChecker::class]; yield 'valid checker service' => [ - function (MockObject & ContainerInterface $container) use ($validChecker): void { - $container->expects(self::once())->method('has')->with( + function (MockObject & ContainerInterface $container, TestCase $t) use ($validChecker): void { + $container->expects($t->once())->method('has')->with( EnabledListenerCheckerInterface::class, )->willReturn(true); - $container->expects(self::once())->method('get')->with( + $container->expects($t->once())->method('get')->with( EnabledListenerCheckerInterface::class, )->willReturn($validChecker); },