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

[11.x] Allow parallel testing for multiple connections #51131

Closed

Conversation

lonnylot
Copy link
Contributor

Add support for parallel testing with multiple connections.

Framework users can override the options resolver to return the connections they intend to test on:

ParallelTesting::resolveOptionsUsing(function ($option) {
    if ($option === 'connections') {
        return [ 'mysql', 'pgsql' ];
    }

    $option = 'LARAVEL_PARALLEL_TESTING_'.Str::upper($option);

    return $_SERVER[$option] ?? false;
});

@lonnylot lonnylot changed the title Allow parallel testing for multiple connections [11.x] Allow parallel testing for multiple connections Apr 18, 2024
@crynobone
Copy link
Member

@lonnylot can you provide a demo application to test this out?

@lonnylot
Copy link
Contributor Author

lonnylot commented Apr 21, 2024

@crynobone https://github.com/lonnylot/paralell-testing-demo

You have to run: ./vendor/bin/sail artisan migrate --env=testing

You can try with and without this patch.

EDIT: I have to admit that I developed this patch using 10.x which has CreatesApplication as a trait. This trait was removed in 11.x laravel/laravel#6310 and I'm just realizing now. I still think it makes the most sense and we may want to consider adding it back as a trait because this is a good example of why some people may modify it.

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!

If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

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

Successfully merging this pull request may close these issues.

None yet

3 participants