File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 66
77use OpenAI ;
88use OpenAI \Client ;
9+ use OpenAI \Contracts \ClientContract ;
910use OpenAI \Factory ;
1011use Symfony \Component \HttpClient \Psr18Client ;
1112
2223 ->set (Client::class)
2324 ->factory ([service (Factory::class), 'make ' ])
2425
26+ ->alias (ClientContract::class, Client::class)
2527 ->alias ('openai ' , Client::class);
2628};
Original file line number Diff line number Diff line change 55namespace OpenAI \Symfony \Tests \DependencyInjection ;
66
77use OpenAI \Client ;
8+ use OpenAI \Contracts \ClientContract ;
89use OpenAI \Symfony \DependencyInjection \OpenAIExtension ;
910use PHPUnit \Framework \TestCase ;
1011use Symfony \Component \DependencyInjection \ContainerBuilder ;
1314
1415final class OpenAIExtensionTest extends TestCase
1516{
16- public function testService (): void
17+ public function test_service (): void
1718 {
1819 // Using a mock to test the service configuration
1920 $ httpClient = new MockHttpClient (function (string $ method , string $ url , array $ options = []) {
@@ -45,5 +46,7 @@ public function testService(): void
4546
4647 $ response = $ openai ->files ()->delete ('file.txt ' );
4748 self ::assertSame ('file.txt ' , $ response ->id );
49+
50+ self ::assertSame ($ openai , $ container ->get (ClientContract::class), 'Alias for the ClientContract interface ' );
4851 }
4952}
You can’t perform that action at this time.
0 commit comments