Laravel-Migrations-Organiser: Adding Provider into the config/app.php causes test to fail

When we run the tests without the line in the config/app.php file they all pass. As soon as I add in Jaybizzle\MigrationsOrganiser\MigrationsOrganiserServiceProvider::class, phpunit fails not being able to find our migrations.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Hey @korygorsky

Thanks for that example repo, these kind of things really help when debugging this kind of stuff. I ran through the steps you mentioned and could indeed replicate the issue.

Great work on the PR, i have now merged that and released v4.0.2

Thanks again!

Hey @JayBizzle, I’m on a team with @ericadamski.

Thanks for taking the time to go back and forth with us.

It appears to be an issue on rollback. We didn’t realize it was on rollback because it was happening in our tests where we were using the DatabaseMigrations trait. This initiates a migrate and a rollback on every test and the error was happening in the rollback.

I’ve been able to create the issue using a fresh install of Laravel. I’ve created a repo for the issue.

Steps to reproduce

  1. Clone the repo (here: https://github.com/korygorsky/laravel-migrations-organiser-issue-13)
  2. Run composer install in the terminal
  3. No key generation needed as I’ve included the .env file in the repo
  4. run touch database/database.sqlite in the terminal
  5. run php artisan migrate:organise in the terminal
  6. run php artisan migrate in the terminal
  7. run php artisan migrate:rollback in the terminal
  • You should see the issue on Rollback

My Thoughts

Laravel’s rollback method in it’s Migrator.php calls your getMigrationFiles method, but its expecting a different format then it receives.

Returned Format from getMigrationFiles in Laravel-Migrations-Organiser
array:2 [
  0 => "2014_10_12_000000_create_users_table"
  1 => "2014_10_12_100000_create_password_resets_table"
]
Returned Format from getMigrationFiles in Built-in Laravel Migrator.php
array:2 [
  "2014_10_12_000000_create_users_table" => "/Users/kory/Sites/TestMigrationOrganise/database/migrations/2014_10_12_000000_create_users_table.php"
  "2014_10_12_100000_create_password_resets_table" => "/Users/kory/Sites/TestMigrationOrganise/database/migrations/2014_10_12_100000_create_password_resets_table.php"
]

I’m taking a look at this to see if I can resolve this with a PR. Let me know if you’ve run across this before.