@@ -52,6 +52,16 @@ public function testNormalizeTextContent()
5252 $ this ->assertSame ([['text ' => 'Write a story about a magic backpack. ' ]], $ normalized );
5353 }
5454
55+ /**
56+ * @return iterable<string, array{0: File, 1: string, 2: string}>
57+ */
58+ public static function binaryContentProvider (): iterable
59+ {
60+ yield 'image ' => [Image::fromFile (\dirname (__DIR__ , 5 ).'/tests/Fixtures/image.jpg ' ), 'image/jpeg ' , '/9j/ ' ];
61+ yield 'document ' => [Document::fromFile (\dirname (__DIR__ , 5 ).'/tests/Fixtures/document.pdf ' ), 'application/pdf ' , 'JVBE ' ];
62+ yield 'audio ' => [Audio::fromFile (\dirname (__DIR__ , 5 ).'/tests/Fixtures/audio.mp3 ' ), 'audio/mpeg ' , 'SUQz ' ];
63+ }
64+
5565 #[DataProvider('binaryContentProvider ' )]
5666 public function testNormalizeBinaryContent (File $ content , string $ expectedMimeType , string $ expectedPrefix )
5767 {
@@ -69,14 +79,4 @@ public function testNormalizeBinaryContent(File $content, string $expectedMimeTy
6979 // Verify that the base64 data string starts correctly
7080 $ this ->assertStringStartsWith ($ expectedPrefix , $ normalized [1 ]['inline_data ' ]['data ' ]);
7181 }
72-
73- /**
74- * @return iterable<string, array{0: File, 1: string, 2: string}>
75- */
76- public static function binaryContentProvider (): iterable
77- {
78- yield 'image ' => [Image::fromFile (\dirname (__DIR__ , 5 ).'/tests/Fixtures/image.jpg ' ), 'image/jpeg ' , '/9j/ ' ];
79- yield 'document ' => [Document::fromFile (\dirname (__DIR__ , 5 ).'/tests/Fixtures/document.pdf ' ), 'application/pdf ' , 'JVBE ' ];
80- yield 'audio ' => [Audio::fromFile (\dirname (__DIR__ , 5 ).'/tests/Fixtures/audio.mp3 ' ), 'audio/mpeg ' , 'SUQz ' ];
81- }
8282}
0 commit comments