4 * This file is part of the Behat.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Behat\Output\Node\EventListener\AST;
13 use Behat\Behat\Output\Node\Printer\SetupPrinter;
14 use Behat\Testwork\EventDispatcher\Event\AfterSuiteSetup;
15 use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested;
16 use Behat\Testwork\Output\Formatter;
17 use Behat\Testwork\Output\Node\EventListener\EventListener;
18 use Symfony\Component\EventDispatcher\Event;
21 * Behat suite listener.
23 * @author Konstantin Kudryashov <ever.zet@gmail.com>
25 final class SuiteListener implements EventListener
30 private $setupPrinter;
33 * Initializes listener.
35 * @param SetupPrinter $setupPrinter
37 public function __construct(SetupPrinter $setupPrinter)
39 $this->setupPrinter = $setupPrinter;
45 public function listenEvent(Formatter $formatter, Event $event, $eventName)
47 if ($event instanceof AfterSuiteSetup) {
48 $this->setupPrinter->printSetup($formatter, $event->getSetup());
51 if ($event instanceof AfterSuiteTested) {
52 $this->setupPrinter->printTeardown($formatter, $event->getTeardown());