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

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

Open
NaLogo opened this issue May 29, 2020 · 2 comments
Open

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

NaLogo opened this issue May 29, 2020 · 2 comments

Comments

@NaLogo
Copy link

NaLogo commented May 29, 2020

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.

@royfandi
Copy link

royfandi commented Jun 1, 2020

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 ( #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)

@NaLogo
Copy link
Author

NaLogo commented Jul 8, 2020

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.

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

2 participants