Skip to content

Commit 167c824

Browse files
committed
[Gemini][VertexAi] Reorder data provider methods in UserMessageNormalizerTest
Move binaryContentProvider methods before their associated test methods and add @return PHPDoc annotations.
1 parent 430aa55 commit 167c824

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/platform/src/Bridge/Gemini/Tests/Contract/UserMessageNormalizerTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/platform/src/Bridge/VertexAi/Tests/Contract/UserMessageNormalizerTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
{
@@ -68,14 +78,4 @@ public function testNormalizeBinaryContent(File $content, string $expectedMimeTy
6878

6979
$this->assertStringStartsWith($expectedPrefix, $normalized[1]['inlineData']['data']);
7080
}
71-
72-
/**
73-
* @return iterable<string, array{0: File, 1: string, 2: string}>
74-
*/
75-
public static function binaryContentProvider(): iterable
76-
{
77-
yield 'image' => [Image::fromFile(\dirname(__DIR__, 5).'/tests/Fixtures/image.jpg'), 'image/jpeg', '/9j/'];
78-
yield 'document' => [Document::fromFile(\dirname(__DIR__, 5).'/tests/Fixtures/document.pdf'), 'application/pdf', 'JVBE'];
79-
yield 'audio' => [Audio::fromFile(\dirname(__DIR__, 5).'/tests/Fixtures/audio.mp3'), 'audio/mpeg', 'SUQz'];
80-
}
8181
}

0 commit comments

Comments
 (0)