X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FOutput%2FNode%2FEventListener%2FJUnit%2FJUnitOutlineStoreListener.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FOutput%2FNode%2FEventListener%2FJUnit%2FJUnitOutlineStoreListener.php;h=0000000000000000000000000000000000000000;hp=4458ebb73e810c876185e60ce87993c06c0dca13;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php b/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php deleted file mode 100644 index 4458ebb73..000000000 --- a/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\JUnit; - -use Behat\Behat\EventDispatcher\Event\BeforeOutlineTested; -use Behat\Behat\Output\Node\Printer\SuitePrinter; -use Behat\Gherkin\Node\ExampleNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested; -use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTested; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; -use Symfony\Component\EventDispatcher\Event; - -/** - * Listens for Outline events store the current one - * - * @author James Watson - */ -final class JUnitOutlineStoreListener implements EventListener -{ - - /** - * @var SuitePrinter - */ - private $suitePrinter; - - /** - * @var array - */ - private $lineScenarioMap = array(); - - /** - * Initializes listener. - * - * @param SuitePrinter $suitePrinter - */ - public function __construct(SuitePrinter $suitePrinter) - { - $this->suitePrinter = $suitePrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->captureOutlineOnBeforeOutlineEvent($event); - - $this->printHeaderOnBeforeSuiteTestedEvent($formatter, $event); - $this->printFooterOnAfterSuiteTestedEvent($formatter, $event); - } - - /** - * Captures outline into the ivar on outline BEFORE event. - * - * @param Event $event - */ - private function captureOutlineOnBeforeOutlineEvent(Event $event) - { - if (!$event instanceof BeforeOutlineTested) { - return; - } - - $outline = $event->getOutline(); - foreach ($outline->getExamples() as $example) { - $this->lineScenarioMap[$example->getLine()] = $outline; - } - } - - /** - * @param Formatter $formatter - * @param Event $event - */ - private function printHeaderOnBeforeSuiteTestedEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof BeforeSuiteTested) { - return; - } - $this->suitePrinter->printHeader($formatter, $event->getSuite()); - } - - /** - * @param Formatter $formatter - * @param Event $event - */ - private function printFooterOnAfterSuiteTestedEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterSuiteTested) { - return; - } - $this->suitePrinter->printFooter($formatter, $event->getSuite()); - } - - /** - * @param ExampleNode $scenario - * @return OutlineNode - */ - public function getCurrentOutline(ExampleNode $scenario) - { - return $this->lineScenarioMap[$scenario->getLine()]; - } -}