Skip to content

Instantly share code, notes, and snippets.

@mcfdn
mcfdn / EventDispatchingCommandTester.php
Created January 4, 2018 09:22 — forked from peterjmit/EventDispatchingCommandTester.php
Console events are not dispatched in Symfony when using the CommandTester class shown in http://symfony.com/doc/current/components/console/introduction.html#testing-commands. This class fixes that
<?php
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;