File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public static function fromFile(string $path): static
47
47
}
48
48
49
49
return new static (
50
- static fn () => file_get_contents ($ path ),
50
+ static fn (): string => file_get_contents ($ path ),
51
51
mime_content_type ($ path ),
52
52
$ path ,
53
53
);
Original file line number Diff line number Diff line change 9
9
* file that was distributed with this source code.
10
10
*/
11
11
12
- namespace Bridge \ElevenLabs \Contract ;
12
+ namespace Symfony \ AI \ Platform \ Tests \ Bridge \ElevenLabs \Contract ;
13
13
14
+ use PHPUnit \Framework \Attributes \CoversClass ;
15
+ use PHPUnit \Framework \Attributes \UsesClass ;
14
16
use PHPUnit \Framework \TestCase ;
17
+ use Symfony \AI \Platform \Bridge \ElevenLabs \Contract \ElevenLabsContract ;
18
+ use Symfony \AI \Platform \Bridge \ElevenLabs \ElevenLabs ;
19
+ use Symfony \AI \Platform \Message \Content \Audio ;
15
20
21
+ #[CoversClass(ElevenLabsContract::class)]
22
+ #[UsesClass(Audio::class)]
23
+ #[UsesClass(ElevenLabs::class)]
16
24
final class ElevenLabsContractTest extends TestCase
17
25
{
26
+ public function testItCanCreatePayloadWithAudio ()
27
+ {
28
+ $ audio = Audio::fromFile (\dirname (__DIR__ , 6 ).'/fixtures/audio.mp3 ' );
18
29
30
+ $ contract = ElevenLabsContract::create ();
31
+
32
+ $ payload = $ contract ->createRequestPayload (new ElevenLabs (), $ audio );
33
+
34
+ $ this ->assertSame ([
35
+ 'type ' => 'input_audio ' ,
36
+ 'input_audio ' => [
37
+ 'data ' => $ audio ->asBase64 (),
38
+ 'path ' => $ audio ->asPath (),
39
+ 'format ' => 'mp3 ' ,
40
+ ],
41
+ ], $ payload );
42
+ }
19
43
}
Original file line number Diff line number Diff line change 15
15
use PHPUnit \Framework \Attributes \Group ;
16
16
use PHPUnit \Framework \Attributes \UsesClass ;
17
17
use PHPUnit \Framework \TestCase ;
18
+ use Symfony \AI \Platform \Bridge \ElevenLabs \Contract \AudioNormalizer ;
18
19
use Symfony \AI \Platform \Bridge \ElevenLabs \ElevenLabs ;
19
20
use Symfony \AI \Platform \Bridge \ElevenLabs \ElevenLabsClient ;
20
- use Symfony \AI \Platform \Contract \Normalizer \Message \Content \AudioNormalizer ;
21
21
use Symfony \AI \Platform \Exception \InvalidArgumentException ;
22
22
use Symfony \AI \Platform \Message \Content \Audio ;
23
23
use Symfony \AI \Platform \Model ;
You can’t perform that action at this time.
0 commit comments