Skip to content

Commit 3daf4cb

Browse files
author
Mohamed Khaled
committed
Fix PHPCS line length warnings in test files
Break up long lines in test assertions to comply with 120 character limit: - FunctionResponseTest.php: Fix assertEquals with long array parameters - FunctionDeclarationTest.php: Fix assertArrayHasKeys with long parameter list - ModelConfigTest.php: Break up long expectedProperties array definition - FileTest.php: Fix expectExceptionMessage and assertEquals with long parameters All PHPCS warnings now resolved, CI checks will pass.
1 parent 1bf9ca5 commit 3daf4cb

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

tests/unit/Files/DTO/FileTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ public function testCreateFromPlainBase64(): void
117117
public function testPlainBase64WithoutMimeTypeThrowsException(): void
118118
{
119119
$this->expectException(InvalidArgumentException::class);
120-
$this->expectExceptionMessage('MIME type is required when providing plain base64 data without data URI format.');
120+
$this->expectExceptionMessage(
121+
'MIME type is required when providing plain base64 data without data URI format.'
122+
);
121123

122124
new File('SGVsbG8gV29ybGQ=');
123125
}
@@ -184,7 +186,9 @@ public function testDirectoryThrowsException(): void
184186

185187
try {
186188
$this->expectException(InvalidArgumentException::class);
187-
$this->expectExceptionMessage('Invalid file provided. Expected URL, base64 data, or valid local file path.');
189+
$this->expectExceptionMessage(
190+
'Invalid file provided. Expected URL, base64 data, or valid local file path.'
191+
);
188192

189193
new File($tempDir, 'text/plain');
190194
} finally {
@@ -237,7 +241,10 @@ public function testJsonSchema(): void
237241
$this->assertArrayHasKey(File::KEY_FILE_TYPE, $inlineSchema['properties']);
238242
$this->assertArrayHasKey(File::KEY_MIME_TYPE, $inlineSchema['properties']);
239243
$this->assertArrayHasKey(File::KEY_BASE64_DATA, $inlineSchema['properties']);
240-
$this->assertEquals([File::KEY_FILE_TYPE, File::KEY_MIME_TYPE, File::KEY_BASE64_DATA], $inlineSchema['required']);
244+
$this->assertEquals(
245+
[File::KEY_FILE_TYPE, File::KEY_MIME_TYPE, File::KEY_BASE64_DATA],
246+
$inlineSchema['required']
247+
);
241248
}
242249

243250
/**

tests/unit/Providers/Models/DTO/ModelConfigTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,14 @@ public function testGetJsonSchema(): void
160160

161161
// Check all properties exist
162162
$expectedProperties = [
163-
ModelConfig::KEY_OUTPUT_MODALITIES, ModelConfig::KEY_SYSTEM_INSTRUCTION, ModelConfig::KEY_CANDIDATE_COUNT, ModelConfig::KEY_MAX_TOKENS,
164-
ModelConfig::KEY_TEMPERATURE, ModelConfig::KEY_TOP_P, ModelConfig::KEY_TOP_K, ModelConfig::KEY_STOP_SEQUENCES, ModelConfig::KEY_PRESENCE_PENALTY,
165-
ModelConfig::KEY_FREQUENCY_PENALTY, ModelConfig::KEY_LOGPROBS, ModelConfig::KEY_TOP_LOGPROBS, ModelConfig::KEY_TOOLS,
166-
ModelConfig::KEY_OUTPUT_MIME_TYPE, ModelConfig::KEY_OUTPUT_SCHEMA, ModelConfig::KEY_CUSTOM_OPTIONS
163+
ModelConfig::KEY_OUTPUT_MODALITIES, ModelConfig::KEY_SYSTEM_INSTRUCTION,
164+
ModelConfig::KEY_CANDIDATE_COUNT, ModelConfig::KEY_MAX_TOKENS,
165+
ModelConfig::KEY_TEMPERATURE, ModelConfig::KEY_TOP_P, ModelConfig::KEY_TOP_K,
166+
ModelConfig::KEY_STOP_SEQUENCES, ModelConfig::KEY_PRESENCE_PENALTY,
167+
ModelConfig::KEY_FREQUENCY_PENALTY, ModelConfig::KEY_LOGPROBS,
168+
ModelConfig::KEY_TOP_LOGPROBS, ModelConfig::KEY_TOOLS,
169+
ModelConfig::KEY_OUTPUT_MIME_TYPE, ModelConfig::KEY_OUTPUT_SCHEMA,
170+
ModelConfig::KEY_CUSTOM_OPTIONS
167171
];
168172

169173
foreach ($expectedProperties as $property) {

tests/unit/Tools/DTO/FunctionDeclarationTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,16 @@ public function testToArrayWithParameters(): void
204204

205205
$json = $this->assertToArrayReturnsArray($declaration);
206206

207-
$this->assertArrayHasKeys($json, [FunctionDeclaration::KEY_NAME, FunctionDeclaration::KEY_DESCRIPTION, FunctionDeclaration::KEY_PARAMETERS]);
207+
$this->assertArrayHasKeys(
208+
$json,
209+
[FunctionDeclaration::KEY_NAME, FunctionDeclaration::KEY_DESCRIPTION, FunctionDeclaration::KEY_PARAMETERS]
210+
);
208211
$this->assertEquals('searchWeb', $json[FunctionDeclaration::KEY_NAME]);
209212
$this->assertEquals('Searches the web for information', $json[FunctionDeclaration::KEY_DESCRIPTION]);
210-
$this->assertEquals(['type' => 'object', 'properties' => ['query' => ['type' => 'string']]], $json[FunctionDeclaration::KEY_PARAMETERS]);
213+
$this->assertEquals(
214+
['type' => 'object', 'properties' => ['query' => ['type' => 'string']]],
215+
$json[FunctionDeclaration::KEY_PARAMETERS]
216+
);
211217
}
212218

213219
/**

tests/unit/Tools/DTO/FunctionResponseTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,16 @@ public function testJsonSchema(): void
127127
$this->assertCount(2, $schema['oneOf']);
128128

129129
// First option: response and id required
130-
$this->assertEquals([FunctionResponse::KEY_RESPONSE, FunctionResponse::KEY_ID], $schema['oneOf'][0]['required']);
130+
$this->assertEquals(
131+
[FunctionResponse::KEY_RESPONSE, FunctionResponse::KEY_ID],
132+
$schema['oneOf'][0]['required']
133+
);
131134

132135
// Second option: response and name required
133-
$this->assertEquals([FunctionResponse::KEY_RESPONSE, FunctionResponse::KEY_NAME], $schema['oneOf'][1]['required']);
136+
$this->assertEquals(
137+
[FunctionResponse::KEY_RESPONSE, FunctionResponse::KEY_NAME],
138+
$schema['oneOf'][1]['required']
139+
);
134140
}
135141

136142
/**
@@ -200,7 +206,10 @@ public function testToArray(): void
200206
$response = new FunctionResponse('func_123', 'calculate', ['result' => 42]);
201207
$json = $this->assertToArrayReturnsArray($response);
202208

203-
$this->assertArrayHasKeys($json, [FunctionResponse::KEY_ID, FunctionResponse::KEY_NAME, FunctionResponse::KEY_RESPONSE]);
209+
$this->assertArrayHasKeys(
210+
$json,
211+
[FunctionResponse::KEY_ID, FunctionResponse::KEY_NAME, FunctionResponse::KEY_RESPONSE]
212+
);
204213
$this->assertEquals('func_123', $json[FunctionResponse::KEY_ID]);
205214
$this->assertEquals('calculate', $json[FunctionResponse::KEY_NAME]);
206215
$this->assertEquals(['result' => 42], $json[FunctionResponse::KEY_RESPONSE]);

0 commit comments

Comments
 (0)