laravel-api-tester
laravel-api-tester copied to clipboard
Error while running `php artisan route:list`
This is a follow up issue after fixing the route:cache problem mentioned in #42 If you fix that, please fix this also.
How to reproduce:
- Follow the solution mentioned in #42
- Run
php artisan route:list
Error:
Array to string conversion
at vendor/asvae/laravel-api-tester/src/Storages/JsonStorage.php:57
53| $this->files = $files;
54| $this->collection = $collection;
55| $path = explode('/', $path);
56| $this->filename = array_pop($path);
> 57| $this->path = implode('/'.$path);
58| }
59|
60| /**
61| * Return path to folder that can contain file.
+32 vendor frames
33 [internal]:0
Illuminate\Foundation\Console\RouteListCommand::Illuminate\Foundation\Console\{closure}(Object(Illuminate\Routing\Route))
+17 vendor frames
51 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Solution:
It's really just silly mistake though, pardon me for all the drama above, just replace .
with ,
in src/Storages/JsonStorage.php
:
public function __construct(Filesystem $files, RequestCollection $collection, $path)
{
$this->files = $files;
$this->collection = $collection;
$path = explode('/', $path);
$this->filename = array_pop($path);
// Here was the mistake:
$this->path = implode('/', $path);
}
Also raising a PR for this. Quick fix.
Same issue here. 😕
Also need this fix. JsonStorage.php in line 57 - just change from . to ,
@ldanielduarte @gundamew
I have created a forked version of this repo which works seamlessly with Laravel 7. You can install that if you are in need. I will be maintaining it on regular basis.
composer require craftisan/laravel-api-tester
@craftisan I've noticed that before you answered and was already using it. It also have the fix in the route alias. I am using with Laravel 8.
@craftisan I tried your package but it is not working on laravel 8.12