Skip to content

Error while running php artisan route:list #50

Open
@craftisan

Description

@craftisan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions