softonic/laravel-database-migrate-test-listener

This package is abandoned and no longer maintained. No replacement package was suggested.

PHPUnit listener to run Laravel database migrations before each testsuite

3.1.0 2022-10-04 08:07 UTC

This package is auto-updated.

Last update: 2023-03-04 08:56:10 UTC


README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads Average time to resolve an issue Percentage of issues still open

This PHPUnit listener run Laravel migrations before each testsuit

Installation

Via composer:

composer require --dev softonic/laravel-database-migrate-test-listener

Documentation

To use the listener add it to your phpunit.xml, defining on which test suites it should be activated, if it should seed data and the database connection to use.

<listeners>
    ...
    <listener class="Softonic\DatabaseMigrateTestListener\DatabaseMigrateTestListener">
        <arguments>
            <array>
              <element key="0">
                <string>Feature</string>
              </element>
              <element key="1">
                <string>Integration</string>
              </element>
            </array>
            <integer>1</integer> <!-- Set 1 if you want to seed data -->
            <string>sqlite</string> <!-- Database connection -->
            <string>>App\\Database\\Seeds\\Foo\\DatabaseSeeder</string> <!-- Database Seeder -->
        </arguments>
    </listener>
    ...
</listeners>

From now on before the specified test suite is run, the migrate:fresh Laravel command will be executed.

Testing

softonic/laravel-database-migrate-test-listener has a PHPUnit test suite and a coding style compliance test suite using PHP CS Fixer.

To run the tests, run the following command from the project folder.

$ docker-compose run test

License

The Apache 2.0 license. Please see LICENSE for more information.