php-http/psr7-integration-tests
Integration test suite to verify PSR-7 HTTP message implementations against the specification. Run the tests in your own PSR-7 package to ensure Request/Response/Stream/URI behavior matches the standard and stays compatible across libraries.
Begin by requiring the package in your test environment:
composer require --dev php-http/psr7-integration-tests
Then, in your phpunit.xml, include the test suite and create a minimal test class that extends Http\Tests\Integration\Ps7IntegrationTestCase. The class must implement a createMessageFactory() method returning your PSR-7 message factory (e.g., Symfony HttpClient, Nyholm/psr7, Guzzle). Run tests via phpunit --testsuite=psr7-integration.
First use case: Validate a new or custom PSR-7 implementation (e.g., MyProject\Psr7\Factory) before publishing it — run integration tests to catch deviations from PSR-7 standards in common operations like withHeader(), stream buffering, or URI mutation.
Ps7IntegrationTestCase, implement required factory methods, and optionally override setUp() to configure environment-specific behavior (e.g., mock file system for stream tests).HasPsr7Compliance) to reuse across multiple packages (e.g., HTTP clients, middleware libraries).php-http/discovery), run integration tests against the resolved factory to verify runtime behavior, not just compile-time interfaces.with*() methods mutate the original object. If tests break, inspect return values and reference identity.fopen('php://temp', 'r+') or large buffers may fail in environments with limited memory limits — adjust memory_limit for full coverage.MessageFactoryInterface and StreamFactoryInterface — the suite validates both.Tests\Integration\ namespace; IDE autocomplete may misfire if tests are added at root level.provide*Data() methods in your subclass to add custom edge cases (e.g., non-standard headers, malformed URIs), while retaining core compliance checks.--debug with PHPUnit to trace failures back to exact immutability or type violations.How can I help you explore Laravel packages today?