master

laravel/framework

Last updated at: 29/12/2023 09:23

WithConsoleEvents.php

TLDR

This file contains a trait called WithConsoleEvents which has one method setUpWithConsoleEvents. This method is responsible for registering console events during the test setup.

Methods

setUpWithConsoleEvents

This method is called during the test setup and it registers console events. It retrieves the ConsoleKernel instance from the application container and calls the rerouteSymfonyCommandEvents method on it.

END

<?php

namespace Illuminate\Foundation\Testing;

use Illuminate\Contracts\Console\Kernel as ConsoleKernel;

trait WithConsoleEvents
{
    /**
     * Register console events.
     *
     * @return void
     */
    protected function setUpWithConsoleEvents()
    {
        $this->app[ConsoleKernel::class]->rerouteSymfonyCommandEvents();
    }
}