Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
3m1n3nc3 authored and github-actions[bot] committed Sep 21, 2024
1 parent 8e03336 commit a23923b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@
|
*/

'prefer_camel_casing' => true
'prefer_camel_casing' => true,
];
2 changes: 1 addition & 1 deletion src/Services/Json/JsonResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function resolve($request = null)

if (config('resource-modifier.prefer_camel_casing', false) === true) {
return collect($this->filter((array) $data))
->mapWithKeys(fn($value, $key) => [str($key)->camel()->toString() => $value])
->mapWithKeys(fn ($value, $key) => [str($key)->camel()->toString() => $value])
->toArray();
}

Expand Down
7 changes: 3 additions & 4 deletions tests/Feature/ResourceMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use App\Http\Resources\XyzCollection;
use App\Http\Resources\XyzResource;
use Illuminate\Support\Facades\File;
use ToneflixCode\ResourceModifier\Services\Json\ResourceCollection;
use ToneflixCode\ResourceModifier\Services\Json\JsonResource;
use ToneflixCode\ResourceModifier\Services\Json\ResourceCollection;
use ToneflixCode\ResourceModifier\Tests\Models\User;

test('can create modified resource collection', function () {
Expand All @@ -23,7 +23,7 @@

test('can assure that modified resource collection is valid', function () {

$outputPath = realpath(__DIR__ . '/../../vendor/orchestra/testbench-core/laravel/app/Http/Resources/XyzCollection.php');
$outputPath = realpath(__DIR__.'/../../vendor/orchestra/testbench-core/laravel/app/Http/Resources/XyzCollection.php');
if ($outputPath) {
unlink($outputPath);
}
Expand All @@ -40,10 +40,9 @@
expect(stripos($content, ResourceCollection::class) >= 0)->toBeTrue();
});


test('can assure that modified resource is valid', function () {

$outputPath = realpath(__DIR__ . '/../../vendor/orchestra/testbench-core/laravel/app/Http/Resources/XyzResource.php');
$outputPath = realpath(__DIR__.'/../../vendor/orchestra/testbench-core/laravel/app/Http/Resources/XyzResource.php');
if ($outputPath) {
unlink($outputPath);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/ResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$user = User::factory()->create();

Route::get('test/users', function () use ($user) {
return present(fn() => new UserResource($user));
return present(fn () => new UserResource($user));
});

$response = $this->get('/test/users');
Expand Down
2 changes: 1 addition & 1 deletion tests/app/Http/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function toArray(Request $request): array
'id' => $this->id,
'name' => $this->name,
'email' => $this->email,
'name_email' => $this->name . ' ' . $this->email,
'name_email' => $this->name.' '.$this->email,
];
}
}

0 comments on commit a23923b

Please sign in to comment.