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

[DV-8391] Added ResponseStream to VerboseErrorHttpClient::stream. #5

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

kkevindev
Copy link
Contributor

Q A
⏱ Review tijd 10 min
⌨️ Type wijziging New feature
🔗 Ticket DV-8391

✍️ Wijzigingen

🪜 Stappen om te testen

  1. Install the changes in this branch:
composer require superbrave/verbose-error-http-client:dev-DV-8391
  1. Apply this git patch to the Supplier Service (pharmacy-service) and run the test:
Subject: [PATCH] VerboseErrorHttpClientTest
---
Index: tests/App/VerboseErrorHttpClientTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/tests/App/VerboseErrorHttpClientTest.php b/tests/App/VerboseErrorHttpClientTest.php
new file mode 100644
--- /dev/null	(date 1713537703108)
+++ b/tests/App/VerboseErrorHttpClientTest.php	(date 1713537703108)
@@ -0,0 +1,36 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App;
+
+use PHPUnit\Framework\TestCase;
+use Sentry\SentryBundle\Tracing\HttpClient\TraceableHttpClient;
+use Sentry\State\HubInterface;
+use Superbrave\VerboseErrorHttpClientBundle\HttpClient\Response\VerboseErrorResponse;
+use Superbrave\VerboseErrorHttpClientBundle\HttpClient\VerboseErrorHttpClient;
+use Symfony\Component\HttpClient\Response\MockResponse;
+use Symfony\Contracts\HttpClient\HttpClientInterface;
+
+final class VerboseErrorHttpClientTest extends TestCase
+{
+    public function testVerboseErrorHttpClientStreamIsCompatibleWithSentryTraceableHttpClientStream(): void
+    {
+        // Arrange
+        $httpClientMock = $this->createMock(HttpClientInterface::class);
+
+        $sentryHttpClient = new TraceableHttpClient($httpClientMock, $this->createMock(HubInterface::class));
+
+        $verboseResponse = new VerboseErrorResponse(new MockResponse(''));
+
+        $verboseHttpClient = new VerboseErrorHttpClient($httpClientMock);
+
+        // Act
+        $response = $verboseHttpClient->stream($verboseResponse);
+
+        $sentryHttpClient->stream($response);
+
+        // Assert
+        $this->expectNotToPerformAssertions(); // Asserts that no errors have been raised in the act stage above
+    }
+}

@kkevindev kkevindev requested review from atehvg and Marijn-ehvg April 19, 2024 14:44
@kkevindev kkevindev marked this pull request as ready for review April 19, 2024 14:44
@kkevindev kkevindev merged commit 7537987 into DV-8390 Apr 22, 2024
1 check passed
@kkevindev kkevindev deleted the DV-8391 branch April 22, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants