Skip to content

Commit 3312380

Browse files
committed
initial attempt at test
1 parent 85ce067 commit 3312380

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\AI\Platform\Tests\Bridge\Anthropic;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\AI\Platform\Bridge\Anthropic\Claude;
16+
use Symfony\AI\Platform\Bridge\Anthropic\ModelClient;
17+
use Symfony\Contracts\HttpClient\HttpClientInterface;
18+
use Symfony\Contracts\HttpClient\ResponseInterface;
19+
20+
class ModelClientTest extends TestCase
21+
{
22+
public function testBetaFeaturesOption()
23+
{
24+
$httpClient = $this->createMock(HttpClientInterface::class);
25+
$response = $this->createMock(ResponseInterface::class);
26+
27+
$httpClient->expects($this->once())
28+
->method('request')
29+
->with('POST', 'https://api.anthropic.com/v1/messages', [
30+
'headers' => [
31+
'x-api-key' => 'test-api-key',
32+
'anthropic-version' => '2023-06-01',
33+
'anthropic-beta' => 'tool-use',
34+
],
35+
'json' => [],
36+
])
37+
->willReturn($response);
38+
39+
// Use the mock HttpClient directly instead of wrapping it
40+
$client = new ModelClient($httpClient, 'test-api-key');
41+
$model = new Claude();
42+
$payload = [];
43+
$options = ['beta_features' => ['tool-use']];
44+
45+
$client->request($model, $payload, $options);
46+
}
47+
}

0 commit comments

Comments
 (0)