Skip to content

Commit 7546dd3

Browse files
committed
chore: improve discovery test assertion and add suggest section
- Test now verifies discovery works by creating a service via Factory - Add suggest section for PSR-18 client and PSR-17 factory implementations
1 parent d16b315 commit 7546dd3

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
"dev-master": "4.0-dev"
5151
}
5252
},
53+
"suggest": {
54+
"php-http/discovery": "Auto-discover PSR-18 HTTP client and PSR-17 request factory",
55+
"symfony/http-client": "PSR-18 HTTP client implementation",
56+
"nyholm/psr7": "PSR-17 HTTP factory implementation"
57+
},
5358
"config": {
5459
"allow-plugins": {
5560
"php-http/discovery": true

tests/Service/FactoryTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ public function constructInvalidClient()
102102
#[Test]
103103
public function withNullAsClientUsesDiscovery()
104104
{
105+
// php-http/mock-client (dev dep) provides client-implementation,
106+
// so PSR-18 discovery succeeds and Factory can create services.
105107
$factory = new Factory();
106108

107-
$this->assertInstanceOf(Factory::class, $factory);
109+
$this->assertInstanceOf(EuropeanCentralBank::class, $factory->create('european_central_bank'));
108110
}
109111

110112
#[Test]

0 commit comments

Comments
 (0)