From bc7b360ac5585f895b960dad085ed3ad4b9c94c2 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Sun, 14 Jun 2026 22:57:09 +0200 Subject: [PATCH 1/2] :white_check_mark: test: use createStub for doubles without expectations Fixes 8 PHPUnit 12 notices ('No expectations were configured for the mock object'). Doubles that only stub return values now use createStub(); mocks that verify calls via expects() stay createMock(). Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/Authentication/OAuth2AuthenticationTest.php | 4 ++-- tests/Client/Bc4ClientTest.php | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/Authentication/OAuth2AuthenticationTest.php b/tests/Authentication/OAuth2AuthenticationTest.php index 59eebdf..aab1378 100644 --- a/tests/Authentication/OAuth2AuthenticationTest.php +++ b/tests/Authentication/OAuth2AuthenticationTest.php @@ -82,7 +82,7 @@ public function testInvalidGrantMarksRequiresReauth(): void public function testRequiresReauthReadsFromStorage(): void { - $storage = $this->createMock(TokenStorageInterface::class); + $storage = $this->createStub(TokenStorageInterface::class); $storage->method('loadTokens')->willReturn([ 'access_token' => null, 'refresh_token' => null, @@ -97,7 +97,7 @@ public function testRequiresReauthReadsFromStorage(): void public function testRequiresReauthSurfacesAsInvalidGrantOnDecorate(): void { - $storage = $this->createMock(TokenStorageInterface::class); + $storage = $this->createStub(TokenStorageInterface::class); $storage->method('loadTokens')->willReturn([ 'access_token' => null, 'refresh_token' => 'r', diff --git a/tests/Client/Bc4ClientTest.php b/tests/Client/Bc4ClientTest.php index 7d890c5..bdc8cd5 100644 --- a/tests/Client/Bc4ClientTest.php +++ b/tests/Client/Bc4ClientTest.php @@ -64,7 +64,10 @@ public function testReactiveRefreshOn401ThenRetrySucceeds(): void new MockResponse('[]', ['http_code' => 200]), ]); - $auth = $this->makeAuthStub('access-1'); + // Real mock here (not makeAuthStub): we assert refresh() is called once. + $auth = $this->createMock(AuthenticationInterface::class); + $auth->method('requiresReauth')->willReturn(false); + $auth->method('decorate')->willReturnArgument(0); $auth->expects($this->once())->method('refresh'); $client = $this->makeClient($http, $auth); @@ -110,7 +113,7 @@ public function testRequiresReauthShortCircuits(): void new MockResponse('SHOULD_NOT_BE_CALLED', ['http_code' => 200]), ]); - $auth = $this->createMock(AuthenticationInterface::class); + $auth = $this->createStub(AuthenticationInterface::class); $auth->method('requiresReauth')->willReturn(true); $client = $this->makeClient($http, $auth); @@ -165,7 +168,7 @@ private function makeClient(MockHttpClient $http, AuthenticationInterface $auth) private function makeAuthStub(string $accessToken = 'access-1'): AuthenticationInterface { - $auth = $this->createMock(AuthenticationInterface::class); + $auth = $this->createStub(AuthenticationInterface::class); $auth->method('requiresReauth')->willReturn(false); // Pass the client through unchanged so MockHttpClient::getRequestsCount() // reflects the actual call sequence. Header injection is exercised in From 9a7ecbf6c84de0bd9be028ceb287d9eb94d0ca82 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Sun, 14 Jun 2026 23:14:14 +0200 Subject: [PATCH 2/2] :memo: docs: add CLAUDE.md (English-only policy) Document that this public OSS package is English-only for commit messages, code, comments, and documentation. Co-Authored-By: Claude Opus 4.8 (1M context) --- CLAUDE.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..1931f4d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,26 @@ + + +# CLAUDE.md + +This is a public open-source package maintained under github.com/dmstr. + +## Language policy + +**Everything in this repository is in English** — commit messages, code, +comments, and documentation. Do not write German here, even though related +company/customer projects (e.g. the consuming application) use German. These +packages are public and English-only. + +## Testing + +PHPUnit (^12). Run locally with the bundled CLI-only Docker Compose +(no host PHP required): + + docker compose run --rm php + +This installs dependencies and runs `vendor/bin/phpunit`. The same runs in CI +via `.github/workflows/tests.yml`. + +## Requirements + +PHP >= 8.4.