File tree 2 files changed +6
-1
lines changed
tests/DependencyInjection
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 6
6
7
7
use OpenAI ;
8
8
use OpenAI \Client ;
9
+ use OpenAI \Contracts \ClientContract ;
9
10
use OpenAI \Factory ;
10
11
use Symfony \Component \HttpClient \Psr18Client ;
11
12
22
23
->set (Client::class)
23
24
->factory ([service (Factory::class), 'make ' ])
24
25
26
+ ->alias (ClientContract::class, Client::class)
25
27
->alias ('openai ' , Client::class);
26
28
};
Original file line number Diff line number Diff line change 5
5
namespace OpenAI \Symfony \Tests \DependencyInjection ;
6
6
7
7
use OpenAI \Client ;
8
+ use OpenAI \Contracts \ClientContract ;
8
9
use OpenAI \Symfony \DependencyInjection \OpenAIExtension ;
9
10
use PHPUnit \Framework \TestCase ;
10
11
use Symfony \Component \DependencyInjection \ContainerBuilder ;
13
14
14
15
final class OpenAIExtensionTest extends TestCase
15
16
{
16
- public function testService (): void
17
+ public function test_service (): void
17
18
{
18
19
// Using a mock to test the service configuration
19
20
$ httpClient = new MockHttpClient (function (string $ method , string $ url , array $ options = []) {
@@ -45,5 +46,7 @@ public function testService(): void
45
46
46
47
$ response = $ openai ->files ()->delete ('file.txt ' );
47
48
self ::assertSame ('file.txt ' , $ response ->id );
49
+
50
+ self ::assertSame ($ openai , $ container ->get (ClientContract::class), 'Alias for the ClientContract interface ' );
48
51
}
49
52
}
You can’t perform that action at this time.
0 commit comments