Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on infection and update to PHPUnit 11 #60

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.jparrowsec.cn%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)
Expand Down
25 changes: 6 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": "<fg=blue;options=bold>Alias for \"cs\", \"stan\", \"test:ci\" and \"infect:ci\"</>",
"ci": "<fg=blue;options=bold>Alias for \"cs\", \"stan\" and \"test:ci\"</>",
"cs": "<fg=blue;options=bold>Checks coding styles</>",
"cs:fix": "<fg=blue;options=bold>Fixes coding styles, when possible</>",
"stan": "<fg=blue;options=bold>Inspects code with phpstan</>",
"test": "<fg=blue;options=bold>Runs unit tests with no coverage reports</>",
"test:ci": "<fg=blue;options=bold>Runs unit tests generating coverage reports and logs</>",
"test:pretty": "<fg=blue;options=bold>Runs unit tests generating coverage reports in html</>",
"infect": "<fg=blue;options=bold>Checks unit tests quality applying mutation testing</>",
"infect:ci": "<fg=blue;options=bold>Checks unit tests quality applying mutation testing with existing reports and logs</>",
"infect:show": "<fg=blue;options=bold>Checks unit tests quality applying mutation testing and shows applied mutators</>"
"test:pretty": "<fg=blue;options=bold>Runs unit tests generating coverage reports in html</>"
},
"config": {
"sort-packages": true,
Expand Down
26 changes: 0 additions & 26 deletions infection.json5

This file was deleted.

21 changes: 11 additions & 10 deletions test/Functions/ResolveEnabledListenerCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
},
Expand Down