Skip to content

Commit

Permalink
Fix faking response metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
gehrisandro committed May 28, 2024
1 parent ff83da9 commit 6a57c78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/Testing/Responses/Concerns/Fakeable.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ private static function buildAttributes(array $original, array $override): array
unset($override[$key]);
}

// we are going to append all remaining overrides with numeric keys
// we are going to append all remaining overrides
foreach ($override as $key => $value) {
if (! is_numeric($key)) {
continue;
}

$new[$key] = $value;
}

Expand Down
7 changes: 6 additions & 1 deletion tests/Responses/Assistants/AssistantResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@
test('fake with override', function () {
$response = AssistantResponse::fake([
'id' => 'asst_1234',
'metadata' => [
'key' => 'value',
],
]);

expect($response)
->id->toBe('asst_1234');
->id->toBe('asst_1234')
->metadata->toBeArray()
->metadata->key->toBe('value');
});

0 comments on commit 6a57c78

Please sign in to comment.