From f71e7cfb3c5966dc0b286d37c651d073fe5d3610 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:23:30 +0000 Subject: [PATCH 1/3] chore(deps): bump the dependencies group with 8 updates Updates the requirements on [symfony/console](https://github.com/symfony/console), [symfony/dependency-injection](https://github.com/symfony/dependency-injection), [symfony/filesystem](https://github.com/symfony/filesystem), [symfony/process](https://github.com/symfony/process), [symfony/config](https://github.com/symfony/config), [symfony/http-client](https://github.com/symfony/http-client), [symfony/finder](https://github.com/symfony/finder) and [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) to permit the latest version. Updates `symfony/console` to 8.1.10 - [Release notes](https://github.com/symfony/console/releases) - [Changelog](https://github.com/symfony/console/blob/8.2/CHANGELOG.md) - [Commits](https://github.com/symfony/console/compare/v8.0.0...v8.1.10) Updates `symfony/dependency-injection` to 8.1.10 - [Release notes](https://github.com/symfony/dependency-injection/releases) - [Changelog](https://github.com/symfony/dependency-injection/blob/8.2/CHANGELOG.md) - [Commits](https://github.com/symfony/dependency-injection/compare/v8.0.0...v8.1.10) Updates `symfony/filesystem` to 8.1.9 - [Release notes](https://github.com/symfony/filesystem/releases) - [Changelog](https://github.com/symfony/filesystem/blob/8.2/CHANGELOG.md) - [Commits](https://github.com/symfony/filesystem/compare/v8.0.0...v8.1.9) Updates `symfony/process` to 8.1.10 - [Release notes](https://github.com/symfony/process/releases) - [Changelog](https://github.com/symfony/process/blob/8.2/CHANGELOG.md) - [Commits](https://github.com/symfony/process/compare/v8.0.0...v8.1.10) Updates `symfony/config` to 8.1.10 - [Release notes](https://github.com/symfony/config/releases) - [Changelog](https://github.com/symfony/config/blob/8.2/CHANGELOG.md) - [Commits](https://github.com/symfony/config/compare/v8.0.0...v8.1.10) Updates `symfony/http-client` to 8.1.10 - [Release notes](https://github.com/symfony/http-client/releases) - [Changelog](https://github.com/symfony/http-client/blob/8.2/CHANGELOG.md) - [Commits](https://github.com/symfony/http-client/compare/v8.0.0...v8.1.10) Updates `symfony/finder` to 8.1.10 - [Release notes](https://github.com/symfony/finder/releases) - [Changelog](https://github.com/symfony/finder/blob/8.2/CHANGELOG.md) - [Commits](https://github.com/symfony/finder/compare/v8.0.0...v8.1.10) Updates `phpunit/phpunit` to 13.4.5 - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/13.4.5/ChangeLog-13.4.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/11.5.0...13.4.5) --- updated-dependencies: - dependency-name: symfony/console dependency-version: 8.1.10 dependency-type: direct:production dependency-group: dependencies - dependency-name: symfony/dependency-injection dependency-version: 8.1.10 dependency-type: direct:production dependency-group: dependencies - dependency-name: symfony/filesystem dependency-version: 8.1.9 dependency-type: direct:production dependency-group: dependencies - dependency-name: symfony/process dependency-version: 8.1.10 dependency-type: direct:production dependency-group: dependencies - dependency-name: symfony/config dependency-version: 8.1.10 dependency-type: direct:production dependency-group: dependencies - dependency-name: symfony/http-client dependency-version: 8.1.10 dependency-type: direct:production dependency-group: dependencies - dependency-name: symfony/finder dependency-version: 8.1.10 dependency-type: direct:production dependency-group: dependencies - dependency-name: phpunit/phpunit dependency-version: 13.4.5 dependency-type: direct:development dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 936ea3b..f73b599 100644 --- a/composer.json +++ b/composer.json @@ -20,15 +20,15 @@ "ext-mbstring": "*", "ext-ctype": "*", "ext-intl": "*", - "symfony/console": "^8.0", - "symfony/dependency-injection": "^8.0", - "symfony/filesystem": "^8.0", - "symfony/process": "^8.0", + "symfony/console": "^8.1", + "symfony/dependency-injection": "^8.1", + "symfony/filesystem": "^8.1", + "symfony/process": "^8.1", "knplabs/github-api": "^3.16", - "symfony/config": "^8.0", - "symfony/http-client": "^8.0", + "symfony/config": "^8.1", + "symfony/http-client": "^8.1", "nyholm/psr7": "^1.8", - "symfony/finder": "^8.0", + "symfony/finder": "^8.1", "m4tthumphrey/php-gitlab-api": "^12.1", "php-http/client-common": "^2.7" }, @@ -52,7 +52,7 @@ ], "require-dev": { "friendsofphp/php-cs-fixer": "^3.95", - "phpunit/phpunit": "^11.5", + "phpunit/phpunit": "^13.4", "phpstan/phpstan": "^2.3", "phpstan/phpstan-phpunit": "^2", "phpstan/extension-installer": "^1.4.3", From 1b12e4b3c20ca54980456474bc489b596ebf58b3 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 2 Nov 2026 07:44:06 +0000 Subject: [PATCH 2/3] compat: migrate tests to PHPUnit 13 --- tests/Command/CiCommandTest.php | 16 +++++++-------- tests/Command/GithubCommandTest.php | 12 +++++------ tests/Command/GitlabCommandTest.php | 6 +++--- tests/Command/LocalCommandTest.php | 10 +++++----- tests/ConfigTest.php | 4 ++-- tests/Platform/Github/GithubCommenterTest.php | 6 +++--- tests/Platform/Github/GithubTest.php | 20 +++++++++---------- tests/Platform/Gitlab/GitlabTest.php | 10 +++++----- tests/Platform/PlatformDetectorTest.php | 8 ++++---- tests/Renderer/HTMLRendererTest.php | 4 ++-- tests/Rule/CheckPhpCsFixerTest.php | 8 ++++---- tests/Rule/CheckPhpStanTest.php | 4 ++-- tests/Rule/CommitRegexTest.php | 8 ++++---- tests/Rule/ConditionTest.php | 4 ++-- tests/Rule/DisallowRepeatedCommitsTest.php | 16 +++++++-------- tests/Rule/MaxCommitTest.php | 8 ++++---- tests/RunnerTest.php | 2 +- 17 files changed, 73 insertions(+), 73 deletions(-) diff --git a/tests/Command/CiCommandTest.php b/tests/Command/CiCommandTest.php index ee1daa8..4fbc133 100644 --- a/tests/Command/CiCommandTest.php +++ b/tests/Command/CiCommandTest.php @@ -25,7 +25,7 @@ public function testValid(): void $platform = $this->createMock(Github::class); $platform->expects(static::once())->method('removePost'); - $detector = $this->createMock(PlatformDetector::class); + $detector = static::createStub(PlatformDetector::class); $detector->method('detect')->willReturn($platform); $output = new BufferedOutput(); @@ -39,10 +39,10 @@ public function testValid(): void public function testNotValid(): void { - $platform = $this->createMock(Github::class); + $platform = static::createStub(Github::class); $platform->method('post')->willReturn('https://danger.local/test'); - $detector = $this->createMock(PlatformDetector::class); + $detector = static::createStub(PlatformDetector::class); $detector->method('detect')->willReturn($platform); $output = new BufferedOutput(); @@ -55,10 +55,10 @@ public function testNotValid(): void public function testNotValidWarning(): void { - $platform = $this->createMock(Github::class); + $platform = static::createStub(Github::class); $platform->method('post')->willReturn('https://danger.local/test'); - $detector = $this->createMock(PlatformDetector::class); + $detector = static::createStub(PlatformDetector::class); $detector->method('detect')->willReturn($platform); $output = new BufferedOutput(); @@ -71,16 +71,16 @@ public function testNotValidWarning(): void public function testInvalidConfig(): void { - $platform = $this->createMock(Github::class); + $platform = static::createStub(Github::class); $platform->method('post')->willReturn('https://danger.local/test'); - $detector = $this->createMock(PlatformDetector::class); + $detector = static::createStub(PlatformDetector::class); $detector->method('detect')->willReturn($platform); $cmd = new CiCommand($detector, new ConfigLoader(), new Runner(), new HTMLRenderer()); static::expectException(\InvalidArgumentException::class); - static::expectExceptionMessage('Invalid config option given'); + static::expectExceptionMessageIsOrContains('Invalid config option given'); $input = new ArgvInput([]); $input->bind($cmd->getDefinition()); diff --git a/tests/Command/GithubCommandTest.php b/tests/Command/GithubCommandTest.php index daa0800..058bcb6 100644 --- a/tests/Command/GithubCommandTest.php +++ b/tests/Command/GithubCommandTest.php @@ -22,10 +22,10 @@ class GithubCommandTest extends TestCase #[DataProvider('invalidUrls')] public function testInvalidUrl(string $url): void { - $cmd = new GithubCommand($this->createMock(Github::class), new ConfigLoader(), new Runner()); + $cmd = new GithubCommand(static::createStub(Github::class), new ConfigLoader(), new Runner()); static::expectException(\InvalidArgumentException::class); - static::expectExceptionMessage('The given url must be a valid Github URL'); + static::expectExceptionMessageIsOrContains('The given url must be a valid Github URL'); $cmd->run(new ArgvInput(['danger', $url]), new NullOutput()); } @@ -45,10 +45,10 @@ public static function invalidUrls(): array public function testInvalidConfig(): void { - $cmd = new GithubCommand($this->createMock(Github::class), new ConfigLoader(), new Runner()); + $cmd = new GithubCommand(static::createStub(Github::class), new ConfigLoader(), new Runner()); static::expectException(\InvalidArgumentException::class); - static::expectExceptionMessage('Invalid config option given'); + static::expectExceptionMessageIsOrContains('Invalid config option given'); $input = new ArgvInput(['danger', 'https://github.com']); $input->bind($cmd->getDefinition()); @@ -59,10 +59,10 @@ public function testInvalidConfig(): void public function testInvalidPr(): void { - $cmd = new GithubCommand($this->createMock(Github::class), new ConfigLoader(), new Runner()); + $cmd = new GithubCommand(static::createStub(Github::class), new ConfigLoader(), new Runner()); static::expectException(\InvalidArgumentException::class); - static::expectExceptionMessage('The PR links needs to be a string'); + static::expectExceptionMessageIsOrContains('The PR links needs to be a string'); $tester = new CommandTester($cmd); $tester->execute(['pr' => []]); diff --git a/tests/Command/GitlabCommandTest.php b/tests/Command/GitlabCommandTest.php index d2f6107..1732cf6 100644 --- a/tests/Command/GitlabCommandTest.php +++ b/tests/Command/GitlabCommandTest.php @@ -25,7 +25,7 @@ public function testRunWithoutToken(): void unset($_SERVER['DANGER_GITLAB_TOKEN']); } - $cmd = new GitlabCommand($this->createMock(Gitlab::class), new ConfigLoader(), new Runner()); + $cmd = new GitlabCommand(static::createStub(Gitlab::class), new ConfigLoader(), new Runner()); $output = new BufferedOutput(); $cmd->run(new ArgvInput(['danger', 'test', '1']), $output); @@ -36,10 +36,10 @@ public function testInvalidConfig(): void { $_SERVER['DANGER_GITLAB_TOKEN'] = '1'; - $cmd = new GitlabCommand($this->createMock(Gitlab::class), new ConfigLoader(), new Runner()); + $cmd = new GitlabCommand(static::createStub(Gitlab::class), new ConfigLoader(), new Runner()); static::expectException(\InvalidArgumentException::class); - static::expectExceptionMessage('Invalid config option given'); + static::expectExceptionMessageIsOrContains('Invalid config option given'); $input = new ArgvInput(['danger', 'https://github.com']); $input->bind($cmd->getDefinition()); diff --git a/tests/Command/LocalCommandTest.php b/tests/Command/LocalCommandTest.php index ab2c56c..3ffa552 100644 --- a/tests/Command/LocalCommandTest.php +++ b/tests/Command/LocalCommandTest.php @@ -22,10 +22,10 @@ class LocalCommandTest extends TestCase { public function testInvalidConfig(): void { - $cmd = new LocalCommand(new ConfigLoader(), new Runner(), $this->createMock(LocalPlatform::class)); + $cmd = new LocalCommand(new ConfigLoader(), new Runner(), static::createStub(LocalPlatform::class)); static::expectException(\InvalidArgumentException::class); - static::expectExceptionMessage('Invalid config option given'); + static::expectExceptionMessageIsOrContains('Invalid config option given'); $input = new ArgvInput(['danger']); $input->bind($cmd->getDefinition()); @@ -36,10 +36,10 @@ public function testInvalidConfig(): void public function testInvalidRoot(): void { - $cmd = new LocalCommand(new ConfigLoader(), new Runner(), $this->createMock(LocalPlatform::class)); + $cmd = new LocalCommand(new ConfigLoader(), new Runner(), static::createStub(LocalPlatform::class)); static::expectException(\InvalidArgumentException::class); - static::expectExceptionMessage('Invalid root option given'); + static::expectExceptionMessageIsOrContains('Invalid root option given'); $input = new ArgvInput(['danger']); $input->bind($cmd->getDefinition()); @@ -72,7 +72,7 @@ public function testCommand(): void (new Filesystem())->remove($tmpDir); (new Process(['git', 'clone', 'file://' . $tmpDirTarget, $tmpDir]))->mustRun(); - $cmd = new LocalCommand(new ConfigLoader(), new Runner(), $this->createMock(LocalPlatform::class)); + $cmd = new LocalCommand(new ConfigLoader(), new Runner(), static::createStub(LocalPlatform::class)); $input = new ArgvInput(['danger', '--config=' . \dirname(__DIR__) . '/configs/empty.php', '--root=' . $tmpDir]); $input->bind($cmd->getDefinition()); diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index c1693ac..78cc245 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -55,7 +55,7 @@ public function testGetReportLevelNotice(): void { $config = new Config(); - $context = new Context($this->createMock(AbstractPlatform::class)); + $context = new Context(static::createStub(AbstractPlatform::class)); $context->notice('test'); static::assertSame(Config::REPORT_LEVEL_NOTICE, $config->getReportLevel($context)); @@ -65,7 +65,7 @@ public function testGetReportLevelNone(): void { $config = new Config(); - $context = new Context($this->createMock(AbstractPlatform::class)); + $context = new Context(static::createStub(AbstractPlatform::class)); static::assertSame(Config::REPORT_LEVEL_NONE, $config->getReportLevel($context)); } diff --git a/tests/Platform/Github/GithubCommenterTest.php b/tests/Platform/Github/GithubCommenterTest.php index d4ab4fe..555cd85 100644 --- a/tests/Platform/Github/GithubCommenterTest.php +++ b/tests/Platform/Github/GithubCommenterTest.php @@ -34,7 +34,7 @@ public function testCommentUsingProxyFails(): void static::expectException(\RuntimeException::class); - $commenter = new GithubCommenter($this->createMock(Client::class), $client); + $commenter = new GithubCommenter(static::createStub(Client::class), $client); $commenter->comment( 'test', 'test', @@ -50,7 +50,7 @@ public function testCommentUsingProxy(): void new MockResponse('{"html_url": "https://test.de"}', ['http_response' => 200, 'response_headers' => ['content-type' => 'application/json']]), ]); - $commenter = new GithubCommenter($this->createMock(Client::class), $client); + $commenter = new GithubCommenter(static::createStub(Client::class), $client); static::assertSame('https://test.de', $commenter->comment( 'test', 'test', @@ -66,7 +66,7 @@ public function testRemoveCommentUsingProxy(): void new MockResponse('{}', ['http_response' => 200, 'response_headers' => ['content-type' => 'application/json']]), ]); - $commenter = new GithubCommenter($this->createMock(Client::class), $client); + $commenter = new GithubCommenter(static::createStub(Client::class), $client); $commenter->remove( 'test', 'test', diff --git a/tests/Platform/Github/GithubTest.php b/tests/Platform/Github/GithubTest.php index 2659963..ec59316 100644 --- a/tests/Platform/Github/GithubTest.php +++ b/tests/Platform/Github/GithubTest.php @@ -152,7 +152,7 @@ public function testRemovePost(): void public function testLabels(): void { - $commenter = $this->createMock(GithubCommenter::class); + $commenter = static::createStub(GithubCommenter::class); $httpClient = new MockHttpClient([ new MockResponse((string) file_get_contents(__DIR__ . '/payloads/pr.json'), ['http_code' => 200, 'response_headers' => ['content-type' => 'application/json']]), @@ -179,7 +179,7 @@ public function testLabels(): void public function testLabelsWithoutPermission(): void { - $commenter = $this->createMock(GithubCommenter::class); + $commenter = static::createStub(GithubCommenter::class); $httpClient = new MockHttpClient([ new MockResponse((string) file_get_contents(__DIR__ . '/payloads/pr.json'), ['http_code' => 200, 'response_headers' => ['content-type' => 'application/json']]), @@ -202,7 +202,7 @@ public function testLabelsWithoutPermission(): void public function testAddLabelOtherErrorNotIgnored(): void { - $commenter = $this->createMock(GithubCommenter::class); + $commenter = static::createStub(GithubCommenter::class); $httpClient = new MockHttpClient([ new MockResponse((string) file_get_contents(__DIR__ . '/payloads/pr.json'), ['http_code' => 200, 'response_headers' => ['content-type' => 'application/json']]), @@ -217,14 +217,14 @@ public function testAddLabelOtherErrorNotIgnored(): void $github->load('FriendsOfShopware/FroshPluginUploader', '144'); static::expectException(\RuntimeException::class); - static::expectExceptionMessage('Permission Denied'); + static::expectExceptionMessageIsOrContains('Permission Denied'); $github->addLabels('Test'); } public function testRemoveLabelOtherErrorNotIgnored(): void { - $commenter = $this->createMock(GithubCommenter::class); + $commenter = static::createStub(GithubCommenter::class); $httpClient = new MockHttpClient([ new MockResponse((string) file_get_contents(__DIR__ . '/payloads/pr.json'), ['http_code' => 200, 'response_headers' => ['content-type' => 'application/json']]), @@ -239,14 +239,14 @@ public function testRemoveLabelOtherErrorNotIgnored(): void $github->load('FriendsOfShopware/FroshPluginUploader', '144'); static::expectException(\RuntimeException::class); - static::expectExceptionMessage('Permission Denied'); + static::expectExceptionMessageIsOrContains('Permission Denied'); $github->removeLabels('Test'); } public function testHasDangerComment(): void { - $commenter = $this->createMock(GithubCommenter::class); + $commenter = static::createStub(GithubCommenter::class); $commenter->method('getCommentIds')->willReturn([1]); $httpClient = new MockHttpClient([ @@ -265,7 +265,7 @@ public function testHasDangerComment(): void public function testFetchingHeadFile(): void { - $commenter = $this->createMock(GithubCommenter::class); + $commenter = static::createStub(GithubCommenter::class); $commenter->method('getCommentIds')->willReturn([1]); $httpClient = new MockHttpClient([ @@ -286,7 +286,7 @@ public function testFetchingHeadFile(): void public function testFetchingHeadFileFails(): void { - $commenter = $this->createMock(GithubCommenter::class); + $commenter = static::createStub(GithubCommenter::class); $commenter->method('getCommentIds')->willReturn([1]); $httpClient = new MockHttpClient([ @@ -302,7 +302,7 @@ public function testFetchingHeadFileFails(): void $github->load('FriendsOfShopware/FroshPluginUploader', '144'); static::expectException(CouldNotGetFileContentException::class); - static::expectExceptionMessage('Could not get content of file composer.json'); + static::expectExceptionMessageIsOrContains('Could not get content of file composer.json'); $github->pullRequest->getFileContent('composer.json'); } diff --git a/tests/Platform/Gitlab/GitlabTest.php b/tests/Platform/Gitlab/GitlabTest.php index f781667..648f572 100644 --- a/tests/Platform/Gitlab/GitlabTest.php +++ b/tests/Platform/Gitlab/GitlabTest.php @@ -158,7 +158,7 @@ public function testLabels(): void $client = Client::createWithHttpClient(new Psr18Client($mockHttpClient)); - $gitlab = new Gitlab($client, $this->createMock(GitlabCommenter::class)); + $gitlab = new Gitlab($client, static::createStub(GitlabCommenter::class)); $gitlab->load('test', '1'); $gitlab->removeLabels('Test'); @@ -177,7 +177,7 @@ public function testHasDangerComment(): void ]); $client = Client::createWithHttpClient(new Psr18Client($mockHttpClient)); - $commenter = $this->createMock(GitlabCommenter::class); + $commenter = static::createStub(GitlabCommenter::class); $commenter->method('getRelevantNoteIds')->willReturn([1, 2, 3]); $gitlab = new Gitlab($client, $commenter); @@ -195,7 +195,7 @@ public function testFetchingHeadFile(): void $client = Client::createWithHttpClient(new Psr18Client($mockHttpClient)); - $gitlab = new Gitlab($client, $this->createMock(GitlabCommenter::class)); + $gitlab = new Gitlab($client, static::createStub(GitlabCommenter::class)); $gitlab->load('test', '1'); $file = $gitlab->pullRequest->getFileContent('composer.json'); @@ -211,11 +211,11 @@ public function testFetchingHeadFileFails(): void $client = Client::createWithHttpClient(new Psr18Client($mockHttpClient)); - $gitlab = new Gitlab($client, $this->createMock(GitlabCommenter::class)); + $gitlab = new Gitlab($client, static::createStub(GitlabCommenter::class)); $gitlab->load('test', '1'); static::expectException(CouldNotGetFileContentException::class); - static::expectExceptionMessage('Could not get content of file composer.json'); + static::expectExceptionMessageIsOrContains('Could not get content of file composer.json'); $gitlab->pullRequest->getFileContent('composer.json'); } diff --git a/tests/Platform/PlatformDetectorTest.php b/tests/Platform/PlatformDetectorTest.php index c7ff820..02f8ebc 100644 --- a/tests/Platform/PlatformDetectorTest.php +++ b/tests/Platform/PlatformDetectorTest.php @@ -16,9 +16,9 @@ class PlatformDetectorTest extends TestCase { public function testUnknown(): void { - $detector = new PlatformDetector($this->createMock(Github::class), $this->createMock(Gitlab::class)); + $detector = new PlatformDetector(static::createStub(Github::class), static::createStub(Gitlab::class)); static::expectException(UnsupportedCIException::class); - static::expectExceptionMessage('Could not detect CI Platform'); + static::expectExceptionMessageIsOrContains('Could not detect CI Platform'); $detector->detect(); } @@ -31,7 +31,7 @@ public function testGithub(): void $github = $this->createMock(Github::class); $github->expects(static::once())->method('load'); - $detector = new PlatformDetector($github, $this->createMock(Gitlab::class)); + $detector = new PlatformDetector($github, static::createStub(Gitlab::class)); static::assertSame($github, $detector->detect()); unset($_SERVER['GITHUB_REPOSITORY'], $_SERVER['GITHUB_PULL_REQUEST_ID'], $_SERVER['GITHUB_TOKEN']); @@ -47,7 +47,7 @@ public function testGitlab(): void $gitlab = $this->createMock(Gitlab::class); $gitlab->expects(static::once())->method('load'); - $detector = new PlatformDetector($this->createMock(Github::class), $gitlab); + $detector = new PlatformDetector(static::createStub(Github::class), $gitlab); static::assertSame($gitlab, $detector->detect()); unset($_SERVER['GITLAB_CI'], $_SERVER['CI_PROJECT_ID'], $_SERVER['CI_MERGE_REQUEST_IID'], $_SERVER['DANGER_GITLAB_TOKEN']); diff --git a/tests/Renderer/HTMLRendererTest.php b/tests/Renderer/HTMLRendererTest.php index 57f69d8..3471411 100644 --- a/tests/Renderer/HTMLRendererTest.php +++ b/tests/Renderer/HTMLRendererTest.php @@ -16,13 +16,13 @@ class HTMLRendererTest extends TestCase public function testRenderEmpty(): void { $renderer = new HTMLRenderer(); - static::assertSame(HTMLRenderer::MARKER, $renderer->convert(new Context($this->createMock(Github::class)))); + static::assertSame(HTMLRenderer::MARKER, $renderer->convert(new Context(static::createStub(Github::class)))); } public function testRenderFailure(): void { $renderer = new HTMLRenderer(); - $context = new Context($this->createMock(Github::class)); + $context = new Context(static::createStub(Github::class)); $context->failure('Test'); static::assertStringContainsString(HTMLRenderer::MARKER, $renderer->convert($context)); diff --git a/tests/Rule/CheckPhpCsFixerTest.php b/tests/Rule/CheckPhpCsFixerTest.php index 11f1c38..fca2b4e 100644 --- a/tests/Rule/CheckPhpCsFixerTest.php +++ b/tests/Rule/CheckPhpCsFixerTest.php @@ -18,8 +18,8 @@ class CheckPhpCsFixerTest extends TestCase { public function testRuleRunsWithoutIssues(): void { - $github = $this->createMock(Github::class); - $pullRequest = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pullRequest = static::createStub(PullRequest::class); $github->pullRequest = $pullRequest; $pullRequest->method('getFiles')->willReturn(new FileCollection([ new TestFile('test.php', 'createMock(Github::class); - $pullRequest = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pullRequest = static::createStub(PullRequest::class); $github->pullRequest = $pullRequest; $pullRequest->method('getFiles')->willReturn(new FileCollection([ new TestFile('test.php', 'createMock(Github::class); + $github = static::createStub(Github::class); $context = new Context($github); $rule = new CheckPhpStan(); @@ -26,7 +26,7 @@ public function testValid(): void public function testInvalid(): void { - $github = $this->createMock(Github::class); + $github = static::createStub(Github::class); $context = new Context($github); $path = \dirname(__DIR__, 2) . '/src/Test.php'; diff --git a/tests/Rule/CommitRegexTest.php b/tests/Rule/CommitRegexTest.php index 6f05c79..75f7ea7 100644 --- a/tests/Rule/CommitRegexTest.php +++ b/tests/Rule/CommitRegexTest.php @@ -21,8 +21,8 @@ public function testRuleMatches(): void $commit = new Commit(); $commit->message = 'Test'; - $github = $this->createMock(Github::class); - $pr = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pr = static::createStub(PullRequest::class); $pr->method('getCommits')->willReturn(new CommitCollection([$commit])); $github->pullRequest = $pr; @@ -39,8 +39,8 @@ public function testRuleNotMatches(): void $commit = new Commit(); $commit->message = 'feat: Test'; - $github = $this->createMock(Github::class); - $pr = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pr = static::createStub(PullRequest::class); $pr->method('getCommits')->willReturn(new CommitCollection([$commit])); $github->pullRequest = $pr; diff --git a/tests/Rule/ConditionTest.php b/tests/Rule/ConditionTest.php index ff0157a..ba3002c 100644 --- a/tests/Rule/ConditionTest.php +++ b/tests/Rule/ConditionTest.php @@ -16,7 +16,7 @@ class ConditionTest extends TestCase { public function testConditionMet(): void { - $github = $this->createMock(Github::class); + $github = static::createStub(Github::class); $context = new Context($github); $innerRuleExecuted = false; @@ -36,7 +36,7 @@ static function () use (&$innerRuleExecuted): void { public function testConditionNotMet(): void { - $github = $this->createMock(Github::class); + $github = static::createStub(Github::class); $context = new Context($github); $innerRuleExecuted = false; diff --git a/tests/Rule/DisallowRepeatedCommitsTest.php b/tests/Rule/DisallowRepeatedCommitsTest.php index 1701bbb..1516bc4 100644 --- a/tests/Rule/DisallowRepeatedCommitsTest.php +++ b/tests/Rule/DisallowRepeatedCommitsTest.php @@ -24,8 +24,8 @@ public function testRuleMatches(): void $secondCommit = new Commit(); $secondCommit->message = 'Test'; - $github = $this->createMock(Github::class); - $pr = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pr = static::createStub(PullRequest::class); $pr->method('getCommits')->willReturn(new CommitCollection([$commit, $secondCommit])); $github->pullRequest = $pr; @@ -45,8 +45,8 @@ public function testRuleNotMatches(): void $secondCommit = new Commit(); $secondCommit->message = 'Test2'; - $github = $this->createMock(Github::class); - $pr = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pr = static::createStub(PullRequest::class); $pr->method('getCommits')->willReturn(new CommitCollection([$commit, $secondCommit])); $github->pullRequest = $pr; @@ -69,8 +69,8 @@ public function testRuleMatchesWithMergeCommits(): void $thirdCommit = new Commit(); $thirdCommit->message = 'Merge branch master into feature'; - $github = $this->createMock(Github::class); - $pr = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pr = static::createStub(PullRequest::class); $pr->method('getCommits')->willReturn(new CommitCollection([$commit, $secondCommit, $thirdCommit])); $github->pullRequest = $pr; @@ -93,8 +93,8 @@ public function testRuleNotMatchesWithMultipleMergeCommits(): void $thirdCommit = new Commit(); $thirdCommit->message = 'Merge branch master into feature'; - $github = $this->createMock(Github::class); - $pr = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pr = static::createStub(PullRequest::class); $pr->method('getCommits')->willReturn(new CommitCollection([$commit, $secondCommit, $thirdCommit])); $github->pullRequest = $pr; diff --git a/tests/Rule/MaxCommitTest.php b/tests/Rule/MaxCommitTest.php index 7e7ca50..e4be519 100644 --- a/tests/Rule/MaxCommitTest.php +++ b/tests/Rule/MaxCommitTest.php @@ -18,8 +18,8 @@ class MaxCommitTest extends TestCase { public function testRuleMatches(): void { - $github = $this->createMock(Github::class); - $pr = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pr = static::createStub(PullRequest::class); $pr->method('getCommits')->willReturn(new CommitCollection([new Commit(), new Commit()])); $github->pullRequest = $pr; @@ -33,8 +33,8 @@ public function testRuleMatches(): void public function testRuleNotMatches(): void { - $github = $this->createMock(Github::class); - $pr = $this->createMock(PullRequest::class); + $github = static::createStub(Github::class); + $pr = static::createStub(PullRequest::class); $pr->method('getCommits')->willReturn(new CommitCollection([new Commit()])); $github->pullRequest = $pr; diff --git a/tests/RunnerTest.php b/tests/RunnerTest.php index f625aa1..0e27efd 100644 --- a/tests/RunnerTest.php +++ b/tests/RunnerTest.php @@ -33,7 +33,7 @@ public function testRunner(): void }); $config->useThreadOn(Config::REPORT_LEVEL_FAILURE); - $runner->run($config, new Context($this->createMock(Github::class))); + $runner->run($config, new Context(static::createStub(Github::class))); static::assertTrue($ruleExecuted); static::assertTrue($afterExecuted); From d02d7f5a4d6dcf23c8a7efe7568c10a3ef858e9d Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 2 Nov 2026 07:47:56 +0000 Subject: [PATCH 3/3] compat: allow all Symfony 8 releases --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index f73b599..0f8a863 100644 --- a/composer.json +++ b/composer.json @@ -20,15 +20,15 @@ "ext-mbstring": "*", "ext-ctype": "*", "ext-intl": "*", - "symfony/console": "^8.1", - "symfony/dependency-injection": "^8.1", - "symfony/filesystem": "^8.1", - "symfony/process": "^8.1", + "symfony/console": "^8.0", + "symfony/dependency-injection": "^8.0", + "symfony/filesystem": "^8.0", + "symfony/process": "^8.0", "knplabs/github-api": "^3.16", - "symfony/config": "^8.1", - "symfony/http-client": "^8.1", + "symfony/config": "^8.0", + "symfony/http-client": "^8.0", "nyholm/psr7": "^1.8", - "symfony/finder": "^8.1", + "symfony/finder": "^8.0", "m4tthumphrey/php-gitlab-api": "^12.1", "php-http/client-common": "^2.7" },