Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while running php artisan route:list #50

Open
craftisan opened this issue Sep 22, 2020 · 5 comments
Open

Error while running php artisan route:list #50

craftisan opened this issue Sep 22, 2020 · 5 comments

Comments

@craftisan
Copy link

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:

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.

craftisan added a commit to craftisan/laravel-api-tester that referenced this issue Sep 22, 2020
- Renamed namespaces
- Updated package versions compatible only for laravel 7.0 & above
- changed config('api-tester.enabled') value to env('API_TESTER')
- Fixed asvae#50 (comment)
- Fixed asvae#49 (comment)
@gundamew
Copy link

Same issue here. 😕

@ldanielduarte
Copy link

Also need this fix.
JsonStorage.php in line 57 - just change from . to ,

@craftisan
Copy link
Author

@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

@ldanielduarte
Copy link

ldanielduarte commented Feb 24, 2021

@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.

@chintan-meek
Copy link

@craftisan I tried your package but it is not working on laravel 8.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants