-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Unable to resolve migration path when using #[WithMigration('jobs')]
#248
Comments
As a workaround for the time being, I've added this to my protected function defineDatabaseMigrations()
{
+ artisan($this, 'queue:batches-table');
artisan($this, 'migrate', ['--database' => 'testing']);
$this->beforeApplicationDestroyed(
fn () => artisan($this, 'migrate:rollback', ['--database' => 'testing'])
);
} |
#[WithMigration('job')]
#[WithMigration('jobs')]
Could this be something to do with the fact the jobs migration now ships with new Laravel 11 apps, where it didn't previously? 🤔 |
Sorry, the name should have been |
Just updated the doc as well: orchestral/toolkit-docs@7836c8a thanks for the report |
Thanks for the quick response! Changing it to However, now I'm running into a new issue with my Laravel 11 tests where it'll publish the migration to the Then, if I re-run my test suite again, the table will be created fine. 🤔 |
For context, we're using this version constraint in our package: "orchestra/testbench": "^8.0 || ^9.0.2", When testing Laravel 10, it uses |
I will need to debug your package directly to understand what's going on. |
Can you test Testbench Core 9.5.6 and see if that solve your issue? and also remove |
Just updated and it's working perfectly, thanks @crynobone! 🎉 |
Description:
In my package, I'm using Laravel's job batches feature to keep track of jobs relating to a specific import.
Since the job batches feature requires its own database table, I've uncommented the in-memory SQLite database in my
phpunit.xml
file and added theDatabaseMigrations
trait to the test which calls theBus::batch()
code.However, since Testbench doesn't ship with the queue migrations out-of-the-box, I reviewed the docs and tried to use the
WithMigration
attribute to load them, like this:However, that gives me this error:
I did some digging and it's trying to load/publish the migrations from this directory:
"/path/to/my/package/vendor/orchestra/testbench-core/laravel/migrations/jobs
However, that directory doesn't exist. Directories only exist for
notifications
andqueue
(but queue is essentially empty).I assume it should be loading/publishing the
0001_01_01_000002_testbench_create_jobs_table
migration in the parent directory?I'm happy to contribute a fix, if it'd be helpful.
Steps To Reproduce:
WithMigration
attribute to yourTestCase
class, like so:DatabaseMigrations
trait to one of your tests, like so:The text was updated successfully, but these errors were encountered: