Skip to content

Commit

Permalink
Fixed test validation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Helldar committed May 19, 2021
1 parent 1380030 commit baa494f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
9 changes: 5 additions & 4 deletions app/main/Services/Filesystem/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace LaravelLang\Lang\Services\Filesystem;

use Helldar\Support\Concerns\Makeable;
use Helldar\Support\Facades\Helpers\Arr;
use Helldar\Support\Facades\Helpers\Ables\Arrayable;
use LaravelLang\Lang\Application;
use LaravelLang\Lang\Concerns\Storable;
use LaravelLang\Lang\Contracts\Filesystem;
Expand Down Expand Up @@ -31,8 +31,9 @@ protected function correctValues(array $items): array
{
$callback = static fn ($value) => stripslashes($value);

$items = Arr::map($items, $callback, true);

return Arr::renameKeys($items, $callback);
return Arrayable::of($items)
->map($callback, true)
->renameKeys($callback)
->get();
}
}
18 changes: 10 additions & 8 deletions app/tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests;

use Helldar\PrettyArray\Services\File;
use Helldar\Support\Facades\Helpers\Ables\Arrayable;
use Helldar\Support\Facades\Helpers\Arr;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Filesystem\File as Filesystem;
Expand All @@ -27,11 +28,11 @@ protected function source(string $filename): array
$custom = Arr::get($content, 'custom', []);
$attributes = Arr::get($content, 'attributes', []);

$content = Arr::except($content, ['custom', 'attributes']);

$content = Arr::ksort($content);

return array_merge($content, compact('custom', 'attributes'));
return Arrayable::of($content)
->except(['custom', 'attributes'])
->ksort()
->merge(compact('custom', 'attributes'))
->get();
}

return Arr::ksort($content);
Expand Down Expand Up @@ -106,8 +107,9 @@ protected function correctValues(array $items): array
{
$callback = static fn ($value) => stripslashes($value);

$items = Arr::map($items, $callback, true);

return Arr::renameKeys($items, $callback);
return Arrayable::of($items)
->map($callback, true)
->renameKeys($callback)
->get();
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"require-dev": {
"php": "^8.0",
"andrey-helldar/pretty-array": "^2.3",
"andrey-helldar/support": "^3.13",
"andrey-helldar/support": "^3.16.1",
"guzzlehttp/guzzle": "^7.3",
"laravel/fortify": "^1.7",
"laravel/jetstream": "^2.3",
Expand Down

0 comments on commit baa494f

Please sign in to comment.