From f2933986f57ddbfaee8c4e9199f27bb7b4c3e32c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Jan 2026 00:55:52 +0000 Subject: [PATCH 1/6] feat(HarRecorder): add PSR-18 client decorator for recording HTTP traffic Implement a PSR-18 HTTP client decorator that records request/response pairs to HAR format. This enables generating test fixtures by recording real API interactions. Core methods: - sendRequest(): delegates to inner client and records the entry - getHar(): returns recorded traffic as a HAR object - getEntries(): returns individual recorded entries --- composer.json | 1 + src/HarRecorder.php | 115 ++++++++++++ tests/src/Unit/HarRecorderTest.php | 274 +++++++++++++++++++++++++++++ 3 files changed, 390 insertions(+) create mode 100644 src/HarRecorder.php create mode 100644 tests/src/Unit/HarRecorderTest.php diff --git a/composer.json b/composer.json index 3d83c44b..fd44f370 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "jms/serializer": "^3.0", "doctrine/annotations": "^2.0", "guzzlehttp/psr7": "^2.0", + "psr/http-client": "^1.0", "deviantintegral/jms-serializer-uri-handler": "^1.1", "deviantintegral/null-date-time": "^1.0", "symfony/console": "^7||^8" diff --git a/src/HarRecorder.php b/src/HarRecorder.php new file mode 100644 index 00000000..dc47e5c5 --- /dev/null +++ b/src/HarRecorder.php @@ -0,0 +1,115 @@ +sendRequest($request); // Makes real request + * $har = $recorder->getHar(); // Get recorded traffic + */ +final class HarRecorder implements ClientInterface +{ + /** + * @var Entry[] + */ + private array $entries = []; + + private Creator $creator; + + /** + * @param ClientInterface $client The underlying HTTP client to delegate requests to + * @param string $creatorName Name of the application creating the HAR + * @param string $creatorVersion Version of the application + */ + public function __construct( + private readonly ClientInterface $client, + string $creatorName = 'deviantintegral/har', + string $creatorVersion = '1.0', + ) { + $this->creator = (new Creator()) + ->setName($creatorName) + ->setVersion($creatorVersion); + } + + /** + * Send an HTTP request and record the request/response pair. + * + * @throws \Psr\Http\Client\ClientExceptionInterface + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + $startTime = hrtime(true); + $startDateTime = new \DateTime(); + + $response = $this->client->sendRequest($request); + + $endTime = hrtime(true); + /** @infection-ignore-all Equivalent mutant: 1 part per million difference is not testable */ + $totalTimeMs = ($endTime - $startTime) / 1_000_000; + + $entry = $this->createEntry($request, $response, $startDateTime, $totalTimeMs); + $this->entries[] = $entry; + + return $response; + } + + /** + * Get the recorded traffic as a HAR object. + */ + public function getHar(): Har + { + $log = (new Log()) + ->setVersion('1.2') + ->setCreator($this->creator) + ->setEntries($this->entries); + + return (new Har())->setLog($log); + } + + /** + * Get individual recorded entries. + * + * @return Entry[] + */ + public function getEntries(): array + { + return $this->entries; + } + + /** + * Create a HAR entry from the request/response pair. + */ + private function createEntry( + RequestInterface $request, + ResponseInterface $response, + \DateTime $startDateTime, + float $totalTimeMs, + ): Entry { + $harRequest = Request::fromPsr7Request($request); + $harResponse = Response::fromPsr7Response($response); + + $timings = (new Timings()) + ->setSend(0) + ->setWait($totalTimeMs) + ->setReceive(0); + + return (new Entry()) + ->setStartedDateTime($startDateTime) + ->setTime($totalTimeMs) + ->setRequest($harRequest) + ->setResponse($harResponse) + ->setCache(new Cache()) + ->setTimings($timings); + } +} diff --git a/tests/src/Unit/HarRecorderTest.php b/tests/src/Unit/HarRecorderTest.php new file mode 100644 index 00000000..b30a4e12 --- /dev/null +++ b/tests/src/Unit/HarRecorderTest.php @@ -0,0 +1,274 @@ +createMock(ClientInterface::class); + $innerClient->expects($this->once()) + ->method('sendRequest') + ->with($request) + ->willReturn($expectedResponse); + + $recorder = new HarRecorder($innerClient); + $response = $recorder->sendRequest($request); + + $this->assertSame($expectedResponse, $response); + } + + public function testSendRequestRecordsEntry(): void + { + $request = new Request('POST', new Uri('https://example.com/api'), [], 'request body'); + $expectedResponse = new Response(201, ['Content-Type' => 'application/json'], '{"id": 1}'); + + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn($expectedResponse); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest($request); + + $entries = $recorder->getEntries(); + $this->assertCount(1, $entries); + $this->assertInstanceOf(Entry::class, $entries[0]); + } + + public function testRecordedEntryContainsCorrectRequestData(): void + { + $uri = new Uri('https://example.com/api/users'); + $request = new Request('POST', $uri, ['Accept' => 'application/json'], 'test body'); + $response = new Response(200); + + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn($response); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest($request); + + $entry = $recorder->getEntries()[0]; + $harRequest = $entry->getRequest(); + + $this->assertSame('POST', $harRequest->getMethod()); + $this->assertSame((string) $uri, (string) $harRequest->getUrl()); + $this->assertTrue($harRequest->hasPostData()); + $this->assertSame('test body', $harRequest->getPostData()->getText()); + } + + public function testRecordedEntryContainsCorrectResponseData(): void + { + $request = new Request('GET', new Uri('https://example.com')); + $response = new Response( + 200, + ['Content-Type' => 'text/plain'], + 'Hello World' + ); + + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn($response); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest($request); + + $entry = $recorder->getEntries()[0]; + $harResponse = $entry->getResponse(); + + $this->assertSame(200, $harResponse->getStatus()); + $this->assertSame('OK', $harResponse->getStatusText()); + $this->assertSame('Hello World', $harResponse->getContent()->getText()); + } + + public function testRecordedEntryContainsTimingInfo(): void + { + $request = new Request('GET', new Uri('https://example.com')); + $response = new Response(200); + + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn($response); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest($request); + + $entry = $recorder->getEntries()[0]; + + // Time should be non-negative and reasonable (< 1 second for a mocked instant request) + // This catches mutations that would add timestamps instead of subtract, or use wrong divisors + $this->assertGreaterThanOrEqual(0, $entry->getTime()); + $this->assertLessThan(1000, $entry->getTime()); + $this->assertInstanceOf(\DateTimeInterface::class, $entry->getStartedDateTime()); + + $timings = $entry->getTimings(); + $this->assertSame(0.0, $timings->getSend()); + $this->assertGreaterThanOrEqual(0, $timings->getWait()); + $this->assertLessThan(1000, $timings->getWait()); + $this->assertSame(0.0, $timings->getReceive()); + } + + public function testGetHarReturnsValidHarObject(): void + { + $request = new Request('GET', new Uri('https://example.com')); + $response = new Response(200); + + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn($response); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest($request); + + $har = $recorder->getHar(); + + $this->assertInstanceOf(Har::class, $har); + $this->assertSame('1.2', $har->getLog()->getVersion()); + $this->assertCount(1, $har->getLog()->getEntries()); + } + + public function testGetHarWithCustomCreator(): void + { + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn(new Response(200)); + + $recorder = new HarRecorder($innerClient, 'MyApp', '2.5.0'); + $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); + + $har = $recorder->getHar(); + $creator = $har->getLog()->getCreator(); + + $this->assertSame('MyApp', $creator->getName()); + $this->assertSame('2.5.0', $creator->getVersion()); + } + + public function testDefaultCreatorValues(): void + { + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn(new Response(200)); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); + + $har = $recorder->getHar(); + $creator = $har->getLog()->getCreator(); + + $this->assertSame('deviantintegral/har', $creator->getName()); + $this->assertSame('1.0', $creator->getVersion()); + } + + public function testMultipleRequestsAreRecorded(): void + { + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn(new Response(200)); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest(new Request('GET', new Uri('https://example.com/1'))); + $recorder->sendRequest(new Request('POST', new Uri('https://example.com/2'))); + $recorder->sendRequest(new Request('DELETE', new Uri('https://example.com/3'))); + + $entries = $recorder->getEntries(); + $this->assertCount(3, $entries); + $this->assertCount(3, $recorder->getHar()->getLog()->getEntries()); + + $this->assertSame('GET', $entries[0]->getRequest()->getMethod()); + $this->assertSame('POST', $entries[1]->getRequest()->getMethod()); + $this->assertSame('DELETE', $entries[2]->getRequest()->getMethod()); + } + + public function testRecordedHarIsSerializable(): void + { + $uri = new Uri('https://example.com/api'); + $request = new Request('POST', $uri, ['Content-Type' => 'application/json'], '{"test": true}'); + $response = new Response(201, ['Content-Type' => 'application/json'], '{"id": 123}'); + + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn($response); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest($request); + + $har = $recorder->getHar(); + $serializer = $this->getSerializer(); + + $json = $serializer->serialize($har, 'json'); + $this->assertJson($json); + + $data = json_decode($json, true); + $this->assertIsArray($data); + $this->assertArrayHasKey('log', $data); + $this->assertIsArray($data['log']); + $this->assertSame('1.2', $data['log']['version']); + $this->assertArrayHasKey('entries', $data['log']); + $this->assertIsArray($data['log']['entries']); + $this->assertCount(1, $data['log']['entries']); + } + + public function testRecordedEntryHasCacheObject(): void + { + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn(new Response(200)); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); + + $entry = $recorder->getEntries()[0]; + + $this->assertInstanceOf(\Deviantintegral\Har\Cache::class, $entry->getCache()); + } + + public function testGetHarWithNoEntriesReturnsEmptyHar(): void + { + $innerClient = $this->createMock(ClientInterface::class); + $recorder = new HarRecorder($innerClient); + + $har = $recorder->getHar(); + + $this->assertInstanceOf(Har::class, $har); + $this->assertSame('1.2', $har->getLog()->getVersion()); + $this->assertEmpty($har->getLog()->getEntries()); + } + + public function testClientExceptionIsPropagated(): void + { + $exception = new class extends \Exception implements \Psr\Http\Client\ClientExceptionInterface {}; + + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest') + ->willThrowException($exception); + + $recorder = new HarRecorder($innerClient); + + $this->expectException(\Psr\Http\Client\ClientExceptionInterface::class); + $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); + } + + public function testFailedRequestIsNotRecorded(): void + { + $exception = new class extends \Exception implements \Psr\Http\Client\ClientExceptionInterface {}; + + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest') + ->willThrowException($exception); + + $recorder = new HarRecorder($innerClient); + + try { + $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); + } catch (\Psr\Http\Client\ClientExceptionInterface) { + // Expected + } + + $this->assertEmpty($recorder->getEntries()); + } +} From aa50d1d6e647ec28beb8bae2e64f50549eb54aa1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Jan 2026 01:04:05 +0000 Subject: [PATCH 2/6] feat(HarRecorder): add count() method Add count() method to get the number of recorded entries. --- src/HarRecorder.php | 8 ++++++++ tests/src/Unit/HarRecorderTest.php | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/HarRecorder.php b/src/HarRecorder.php index dc47e5c5..b7473f73 100644 --- a/src/HarRecorder.php +++ b/src/HarRecorder.php @@ -87,6 +87,14 @@ public function getEntries(): array return $this->entries; } + /** + * Get the number of recorded entries. + */ + public function count(): int + { + return \count($this->entries); + } + /** * Create a HAR entry from the request/response pair. */ diff --git a/tests/src/Unit/HarRecorderTest.php b/tests/src/Unit/HarRecorderTest.php index b30a4e12..6d61b0e4 100644 --- a/tests/src/Unit/HarRecorderTest.php +++ b/tests/src/Unit/HarRecorderTest.php @@ -271,4 +271,20 @@ public function testFailedRequestIsNotRecorded(): void $this->assertEmpty($recorder->getEntries()); } + + public function testCountReturnsCorrectNumber(): void + { + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn(new Response(200)); + + $recorder = new HarRecorder($innerClient); + + $this->assertSame(0, $recorder->count()); + + $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); + $this->assertSame(1, $recorder->count()); + + $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); + $this->assertSame(2, $recorder->count()); + } } From ad3931b9a56832be395057828790e1fd20fb9dca Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Jan 2026 01:12:18 +0000 Subject: [PATCH 3/6] feat(HarRecorder): add clear() method Add clear() method to remove all recorded entries. --- src/HarRecorder.php | 8 ++++++++ tests/src/Unit/HarRecorderTest.php | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/HarRecorder.php b/src/HarRecorder.php index b7473f73..688e2bed 100644 --- a/src/HarRecorder.php +++ b/src/HarRecorder.php @@ -95,6 +95,14 @@ public function count(): int return \count($this->entries); } + /** + * Clear all recorded entries. + */ + public function clear(): void + { + $this->entries = []; + } + /** * Create a HAR entry from the request/response pair. */ diff --git a/tests/src/Unit/HarRecorderTest.php b/tests/src/Unit/HarRecorderTest.php index 6d61b0e4..275c318c 100644 --- a/tests/src/Unit/HarRecorderTest.php +++ b/tests/src/Unit/HarRecorderTest.php @@ -287,4 +287,22 @@ public function testCountReturnsCorrectNumber(): void $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); $this->assertSame(2, $recorder->count()); } + + public function testClearRemovesAllEntries(): void + { + $innerClient = $this->createMock(ClientInterface::class); + $innerClient->method('sendRequest')->willReturn(new Response(200)); + + $recorder = new HarRecorder($innerClient); + $recorder->sendRequest(new Request('GET', new Uri('https://example.com/1'))); + $recorder->sendRequest(new Request('GET', new Uri('https://example.com/2'))); + + $this->assertSame(2, $recorder->count()); + + $recorder->clear(); + + $this->assertSame(0, $recorder->count()); + $this->assertEmpty($recorder->getEntries()); + $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); + } } From 61ecf0ed701463a499c9eda86092afe75c90d763 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Jan 2026 17:59:09 +0000 Subject: [PATCH 4/6] refactor(HarRecorder): remove getEntries() method Remove getEntries() method - callers can use getHar()->getLog()->getEntries() instead. This simplifies the API by having a single way to access entries. --- src/HarRecorder.php | 10 ---------- tests/src/Unit/HarRecorderTest.php | 16 ++++++++-------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/HarRecorder.php b/src/HarRecorder.php index 688e2bed..9f5a5aa6 100644 --- a/src/HarRecorder.php +++ b/src/HarRecorder.php @@ -77,16 +77,6 @@ public function getHar(): Har return (new Har())->setLog($log); } - /** - * Get individual recorded entries. - * - * @return Entry[] - */ - public function getEntries(): array - { - return $this->entries; - } - /** * Get the number of recorded entries. */ diff --git a/tests/src/Unit/HarRecorderTest.php b/tests/src/Unit/HarRecorderTest.php index 275c318c..3110e5f5 100644 --- a/tests/src/Unit/HarRecorderTest.php +++ b/tests/src/Unit/HarRecorderTest.php @@ -44,7 +44,7 @@ public function testSendRequestRecordsEntry(): void $recorder = new HarRecorder($innerClient); $recorder->sendRequest($request); - $entries = $recorder->getEntries(); + $entries = $recorder->getHar()->getLog()->getEntries(); $this->assertCount(1, $entries); $this->assertInstanceOf(Entry::class, $entries[0]); } @@ -61,7 +61,7 @@ public function testRecordedEntryContainsCorrectRequestData(): void $recorder = new HarRecorder($innerClient); $recorder->sendRequest($request); - $entry = $recorder->getEntries()[0]; + $entry = $recorder->getHar()->getLog()->getEntries()[0]; $harRequest = $entry->getRequest(); $this->assertSame('POST', $harRequest->getMethod()); @@ -85,7 +85,7 @@ public function testRecordedEntryContainsCorrectResponseData(): void $recorder = new HarRecorder($innerClient); $recorder->sendRequest($request); - $entry = $recorder->getEntries()[0]; + $entry = $recorder->getHar()->getLog()->getEntries()[0]; $harResponse = $entry->getResponse(); $this->assertSame(200, $harResponse->getStatus()); @@ -104,7 +104,7 @@ public function testRecordedEntryContainsTimingInfo(): void $recorder = new HarRecorder($innerClient); $recorder->sendRequest($request); - $entry = $recorder->getEntries()[0]; + $entry = $recorder->getHar()->getLog()->getEntries()[0]; // Time should be non-negative and reasonable (< 1 second for a mocked instant request) // This catches mutations that would add timestamps instead of subtract, or use wrong divisors @@ -177,7 +177,7 @@ public function testMultipleRequestsAreRecorded(): void $recorder->sendRequest(new Request('POST', new Uri('https://example.com/2'))); $recorder->sendRequest(new Request('DELETE', new Uri('https://example.com/3'))); - $entries = $recorder->getEntries(); + $entries = $recorder->getHar()->getLog()->getEntries(); $this->assertCount(3, $entries); $this->assertCount(3, $recorder->getHar()->getLog()->getEntries()); @@ -222,7 +222,7 @@ public function testRecordedEntryHasCacheObject(): void $recorder = new HarRecorder($innerClient); $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); - $entry = $recorder->getEntries()[0]; + $entry = $recorder->getHar()->getLog()->getEntries()[0]; $this->assertInstanceOf(\Deviantintegral\Har\Cache::class, $entry->getCache()); } @@ -269,7 +269,7 @@ public function testFailedRequestIsNotRecorded(): void // Expected } - $this->assertEmpty($recorder->getEntries()); + $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); } public function testCountReturnsCorrectNumber(): void @@ -302,7 +302,7 @@ public function testClearRemovesAllEntries(): void $recorder->clear(); $this->assertSame(0, $recorder->count()); - $this->assertEmpty($recorder->getEntries()); + $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); } } From ac108e10f0802b4fc34d5e1ac2238c1461b2a8b0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Jan 2026 18:07:01 +0000 Subject: [PATCH 5/6] refactor(HarRecorder): remove count() method Remove count() method - callers can use count($recorder->getHar()->getLog()->getEntries()) instead. This simplifies the API. --- src/HarRecorder.php | 8 -------- tests/src/Unit/HarRecorderTest.php | 20 +------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/HarRecorder.php b/src/HarRecorder.php index 9f5a5aa6..1e88f763 100644 --- a/src/HarRecorder.php +++ b/src/HarRecorder.php @@ -77,14 +77,6 @@ public function getHar(): Har return (new Har())->setLog($log); } - /** - * Get the number of recorded entries. - */ - public function count(): int - { - return \count($this->entries); - } - /** * Clear all recorded entries. */ diff --git a/tests/src/Unit/HarRecorderTest.php b/tests/src/Unit/HarRecorderTest.php index 3110e5f5..45c8598e 100644 --- a/tests/src/Unit/HarRecorderTest.php +++ b/tests/src/Unit/HarRecorderTest.php @@ -272,22 +272,6 @@ public function testFailedRequestIsNotRecorded(): void $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); } - public function testCountReturnsCorrectNumber(): void - { - $innerClient = $this->createMock(ClientInterface::class); - $innerClient->method('sendRequest')->willReturn(new Response(200)); - - $recorder = new HarRecorder($innerClient); - - $this->assertSame(0, $recorder->count()); - - $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); - $this->assertSame(1, $recorder->count()); - - $recorder->sendRequest(new Request('GET', new Uri('https://example.com'))); - $this->assertSame(2, $recorder->count()); - } - public function testClearRemovesAllEntries(): void { $innerClient = $this->createMock(ClientInterface::class); @@ -297,12 +281,10 @@ public function testClearRemovesAllEntries(): void $recorder->sendRequest(new Request('GET', new Uri('https://example.com/1'))); $recorder->sendRequest(new Request('GET', new Uri('https://example.com/2'))); - $this->assertSame(2, $recorder->count()); + $this->assertCount(2, $recorder->getHar()->getLog()->getEntries()); $recorder->clear(); - $this->assertSame(0, $recorder->count()); - $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); } } From 7dbcff3a9919d3431a2c9e74e8edd489f1ecdf36 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Jan 2026 18:15:33 +0000 Subject: [PATCH 6/6] refactor(HarRecorder): rename clear() to reset() Rename clear() method to reset() for clearer semantics. --- src/HarRecorder.php | 4 ++-- tests/src/Unit/HarRecorderTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/HarRecorder.php b/src/HarRecorder.php index 1e88f763..ded7978a 100644 --- a/src/HarRecorder.php +++ b/src/HarRecorder.php @@ -78,9 +78,9 @@ public function getHar(): Har } /** - * Clear all recorded entries. + * Reset and clear all recorded entries. */ - public function clear(): void + public function reset(): void { $this->entries = []; } diff --git a/tests/src/Unit/HarRecorderTest.php b/tests/src/Unit/HarRecorderTest.php index 45c8598e..8654c4bd 100644 --- a/tests/src/Unit/HarRecorderTest.php +++ b/tests/src/Unit/HarRecorderTest.php @@ -272,7 +272,7 @@ public function testFailedRequestIsNotRecorded(): void $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); } - public function testClearRemovesAllEntries(): void + public function testResetRemovesAllEntries(): void { $innerClient = $this->createMock(ClientInterface::class); $innerClient->method('sendRequest')->willReturn(new Response(200)); @@ -283,7 +283,7 @@ public function testClearRemovesAllEntries(): void $this->assertCount(2, $recorder->getHar()->getLog()->getEntries()); - $recorder->clear(); + $recorder->reset(); $this->assertEmpty($recorder->getHar()->getLog()->getEntries()); }