Skip to content

Commit 0823bf4

Browse files
committed
ref
1 parent f3204e6 commit 0823bf4

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

.phpactor.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "/phpactor.schema.json",
3+
"language_server_phpstan.enabled": true
4+
}

src/platform/tests/Bridge/ElevenLabs/ElevenLabsSpeechProviderTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
use Symfony\AI\Platform\Result\RawResultInterface;
2222
use Symfony\AI\Platform\Result\TextResult;
2323
use Symfony\AI\Platform\ResultConverterInterface;
24+
use Symfony\AI\Platform\Speech\SpeechAwarePlatform;
2425
use Symfony\AI\Platform\Speech\SpeechConfiguration;
2526

2627
final class ElevenLabsSpeechProviderTest extends TestCase
2728
{
2829
public function testProviderCannotSupportOnWrongModel()
2930
{
30-
$speechConfiguration = new SpeechConfiguration(ttsModel: 'foo');
3131
$model = new ElevenLabs('foo');
3232

3333
$rawResult = $this->createMock(RawResultInterface::class);
@@ -39,17 +39,17 @@ public function testProviderCannotSupportOnWrongModel()
3939
$modelCatalog->expects($this->once())->method('getModel')->willReturn($model);
4040

4141
$platform = $this->createMock(PlatformInterface::class);
42-
$platform->expects($this->once())->method('getSpeechConfiguration')->willReturn($speechConfiguration);
4342
$platform->expects($this->once())->method('getModelCatalog')->willReturn($modelCatalog);
4443

45-
$speechListener = new ElevenLabsSpeechProvider($platform);
44+
$speechAwarePlatform = new SpeechAwarePlatform($platform, new SpeechConfiguration(ttsModel: 'foo'));
45+
46+
$speechListener = new ElevenLabsSpeechProvider($speechAwarePlatform);
4647

4748
$this->assertFalse($speechListener->support($deferredResult, []));
4849
}
4950

5051
public function testProviderCanSupportOnValidModel()
5152
{
52-
$speechConfiguration = new SpeechConfiguration(ttsModel: 'foo');
5353
$model = new ElevenLabs('foo', [
5454
Capability::TEXT_TO_SPEECH,
5555
]);
@@ -63,18 +63,17 @@ public function testProviderCanSupportOnValidModel()
6363
$modelCatalog->expects($this->once())->method('getModel')->willReturn($model);
6464

6565
$platform = $this->createMock(PlatformInterface::class);
66-
$platform->expects($this->once())->method('getSpeechConfiguration')->willReturn($speechConfiguration);
6766
$platform->expects($this->once())->method('getModelCatalog')->willReturn($modelCatalog);
6867

69-
$speechListener = new ElevenLabsSpeechProvider($platform);
68+
$speechAwarePlatform = new SpeechAwarePlatform($platform, new SpeechConfiguration(ttsModel: 'foo'));
69+
70+
$speechListener = new ElevenLabsSpeechProvider($speechAwarePlatform);
7071

7172
$this->assertTrue($speechListener->support($deferredResult, []));
7273
}
7374

7475
public function testProviderCanGenerate()
7576
{
76-
$configuration = new SpeechConfiguration(ttsModel: 'foo', ttsVoice: 'bar');
77-
7877
$rawResult = $this->createMock(RawResultInterface::class);
7978

8079
$resultConverter = $this->createMock(ResultConverterInterface::class);
@@ -88,10 +87,11 @@ public function testProviderCanGenerate()
8887
$speechResult = new DeferredResult($secondResultConverter, $rawResult);
8988

9089
$platform = $this->createMock(PlatformInterface::class);
91-
$platform->expects($this->once())->method('getSpeechConfiguration')->willReturn($configuration);
9290
$platform->expects($this->once())->method('invoke')->willReturn($speechResult);
9391

94-
$speechListener = new ElevenLabsSpeechProvider($platform);
92+
$speechAwarePlatform = new SpeechAwarePlatform($platform, new SpeechConfiguration(ttsModel: 'foo', ttsVoice: 'bar'));
93+
94+
$speechListener = new ElevenLabsSpeechProvider($speechAwarePlatform);
9595

9696
$speech = $speechListener->generate($deferredResult, []);
9797

0 commit comments

Comments
 (0)