Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Behat / Output / Node / EventListener / AST / SuiteListener.php
1 <?php
2
3 /*
4  * This file is part of the Behat.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Behat\Output\Node\EventListener\AST;
12
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;
19
20 /**
21  * Behat suite listener.
22  *
23  * @author Konstantin Kudryashov <ever.zet@gmail.com>
24  */
25 final class SuiteListener implements EventListener
26 {
27     /**
28      * @var SetupPrinter
29      */
30     private $setupPrinter;
31
32     /**
33      * Initializes listener.
34      *
35      * @param SetupPrinter $setupPrinter
36      */
37     public function __construct(SetupPrinter $setupPrinter)
38     {
39         $this->setupPrinter = $setupPrinter;
40     }
41
42     /**
43      * {@inheritdoc}
44      */
45     public function listenEvent(Formatter $formatter, Event $event, $eventName)
46     {
47         if ($event instanceof AfterSuiteSetup) {
48             $this->setupPrinter->printSetup($formatter, $event->getSetup());
49         }
50
51         if ($event instanceof AfterSuiteTested) {
52             $this->setupPrinter->printTeardown($formatter, $event->getTeardown());
53         }
54     }
55 }