How to migrate a testing database in Laravel 5?

Posted 3 years ago by mabasic

I have setup Codeception and Laravel 5 to work. And they work.

But now, I want to run codeception with a testing database, not local.

So in functional.suite.yml I have:

class_name: FunctionalTester
    enabled: [Filesystem, FunctionalHelper, Laravel5]
        environment_file: .env.testing

And that works. It loads the values from .env.testing and runs test on testing database.

The problem now is that I want to migrate the testing database before running the tests.

I do php artisan migrate --env=testing but that migrates my local database specified in .env file.

Is there a way to migrate a database different from one specified in .env ?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.