snipe-migrations icon indicating copy to clipboard operation
snipe-migrations copied to clipboard

Running tests results in "The "" directory does not exist."

Open NaLogo opened this issue 4 years ago • 2 comments

I installed Snipe-Migrations according to the Readme, but running tests that use RefreshDatabase, the package is unable to create a snapshot and populate the database. Instead, I get an error telling me that "The "" directory does not exist.".

I did some digging and a possible issue might be that "app()['migrator']->paths()" includes an empty entry at index 0. Not sure if that's normal or where that's coming from. At least that's the point where the script seems to fail.

NaLogo avatar May 29 '20 07:05 NaLogo

Hello, I had a similar problem. It was not creating the snapshots, but I think that is not the same problem, but maybe my solution fixes the creation of the snapshots.

If you want, you can check my pull request to check it it works also for you ( https://github.com/drfraker/snipe-migrations/pull/34 )

You can use my branch in your composer.json editing it:

"require" {
        ...
        "drfraker/snipe-migrations": "dev-feature/windows-fixes"
        ...
},
"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/royfandi/snipe-migrations"
        }
],

(More info: https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository)

royfandi avatar Jun 01 '20 00:06 royfandi

Hello again. Took me a while to get around to trying this.

Unfortunately, the windows-fixes branch does not seem to include changes that fix this issue for me. It continues throwing the same error message.

I'm running this on a Laravel installation within a Homestead VM.

Edit: It seems like this issue is fixed by making the following change to Snipe.php on line 87:

return collect(array_filter(app()['migrator']->paths())) ->concat([database_path('migrations')]) ->map(function ($path) { return collect(File::allFiles($path)) ->sum(function ($file) { return $file->getMTime(); }); })->sum();

I'm running array_filter on the migration paths to remove empty paths from the result - which previously caused this error, apparently.

NaLogo avatar Jul 08 '20 06:07 NaLogo