0

After updating from Laravel 10 to 11, the --parallel tag does not work when testing. Testing normally still works.

# php artisan test --parallel 
ParaTest v7.7.0 upon PHPUnit 11.5.2 by Sebastian Bergmann and contributors.

PHP Fatal error:  Uncaught Error: Call to undefined method class@anonymous::createApplication() in laravel/framework/src/Illuminate/Testing/Concerns/RunsInParallel.php:175

this is my TestCase.php

<?php

namespace Tests;

use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    /**
     * Creates the application.
     */
    public function createApplication()
    {
        $app = require __DIR__.'/../bootstrap/app.php';
        $app->make(Kernel::class)->bootstrap();

        return $app;
    }
}

This is some of the packages in my composer.json

        "php": "^8.2",
        "ext-imagick": "*",
        "ext-intl": "*",
        "ext-json": "*",
        "laravel/fortify": "^1.20",
        "laravel/framework": "^11.34",
        "laravel/horizon": "^5.22",
        "laravel/pennant": "^1.9",
        "laravel/reverb": "*",
        "laravel/sanctum": "^4.0",
        "laravel/scout": "^10.8",
        "laravel/slack-notification-channel": "^3.2",
        "laravel/telescope": "^5.0",
        "laravel/tinker": "^2.9",
        "laravel/ui": "^4.4",
   ...
   },
    "require-dev": {
        "brianium/paratest": "^7.7",
        "phpunit/phpunit": "^11.0.1",
...
2
  • 1
    This is the official way of testing in parallel, did you follow that? Commented Jan 19 at 19:04
  • yes, I've added brianium/paratest using composer require brianium/paratest --dev. parallel testing worked before the laravel 11 update Commented Jan 21 at 10:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.