ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç PKa\6e+Tester/MoodleEventDispatchingStepTester.phpnu[. namespace Moodle\BehatExtension\EventDispatcher\Tester; // phpcs:disable moodle.NamingConventions.ValidFunctionName.LowercaseMethod use Behat\Behat\EventDispatcher\Event\AfterStepSetup; use Behat\Behat\EventDispatcher\Event\AfterStepTested; use Behat\Behat\EventDispatcher\Event\BeforeStepTeardown; use Behat\Behat\EventDispatcher\Event\BeforeStepTested; use Behat\Behat\Tester\Result\StepResult; use Behat\Behat\Tester\StepTester; use Behat\Gherkin\Node\FeatureNode; use Behat\Gherkin\Node\StepNode; use Behat\Testwork\Environment\Environment; use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * Step tester dispatching BEFORE/AFTER events during tests. * * @package core * @copyright 2016 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ final class MoodleEventDispatchingStepTester implements StepTester { /** @var StepTester */ private $basetester; /** @var EventDispatcherInterface */ private $eventdispatcher; /** * Initializes tester. * * @param StepTester $basetester * @param EventDispatcherInterface $eventdispatcher */ public function __construct(StepTester $basetester, EventDispatcherInterface $eventdispatcher) { $this->basetester = $basetester; $this->eventdispatcher = $eventdispatcher; } /** * Sets up step for a test. * * @param Environment $env * @param FeatureNode $feature * @param StepNode $step * @param bool $skip * * @return Setup */ public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip) { $event = new BeforeStepTested($env, $feature, $step); if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) { // Symfony 4.3 and up. $this->eventdispatcher->dispatch($event, $event::BEFORE); } else { // TODO: Remove when our min supported version is >= 4.3. $this->eventdispatcher->dispatch($event::BEFORE, $event); } $setup = $this->basetester->setUp($env, $feature, $step, $skip); $this->basetester->setEventDispatcher($this->eventdispatcher); $event = new AfterStepSetup($env, $feature, $step, $setup); if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) { // Symfony 4.3 and up. $this->eventdispatcher->dispatch($event, $event::AFTER_SETUP); } else { // TODO: Remove when our min supported version is >= 4.3. $this->eventdispatcher->dispatch($event::AFTER_SETUP, $event); } return $setup; } /** * Tests step. * * @param Environment $env * @param FeatureNode $feature * @param StepNode $step * @param bool $skip * @return StepResult */ public function test(Environment $env, FeatureNode $feature, StepNode $step, $skip) { return $this->basetester->test($env, $feature, $step, $skip); } /** * Tears down step after a test. * * @param Environment $env * @param FeatureNode $feature * @param StepNode $step * @param bool $skip * @param StepResult $result * @return Teardown */ public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result) { $event = new BeforeStepTeardown($env, $feature, $step, $result); if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) { // Symfony 4.3 and up. $this->eventdispatcher->dispatch($event, $event::BEFORE_TEARDOWN); } else { // TODO: Remove when our min supported version is >= 4.3. $this->eventdispatcher->dispatch($event::BEFORE_TEARDOWN, $event); } $teardown = $this->basetester->tearDown($env, $feature, $step, $skip, $result); $event = new AfterStepTested($env, $feature, $step, $result, $teardown); if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) { // Symfony 4.3 and up. $this->eventdispatcher->dispatch($event, $event::AFTER); } else { // TODO: Remove when our min supported version is >= 4.3. $this->eventdispatcher->dispatch($event::AFTER, $event); } return $teardown; } } PKa\0&0&Tester/ChainedStepTester.phpnu[. namespace Moodle\BehatExtension\EventDispatcher\Tester; use Behat\Behat\EventDispatcher\Event\AfterStepSetup; use Behat\Behat\EventDispatcher\Event\AfterStepTested; use Behat\Behat\EventDispatcher\Event\BeforeStepTeardown; use Behat\Behat\EventDispatcher\Event\BeforeStepTested; use Behat\Behat\Tester\Result\ExecutedStepResult; use Behat\Behat\Tester\Result\SkippedStepResult; use Behat\Behat\Tester\Result\StepResult; use Behat\Behat\Tester\Result\UndefinedStepResult; use Behat\Behat\Tester\StepTester; use Behat\Gherkin\Node\FeatureNode; use Behat\Gherkin\Node\StepNode; use Behat\Testwork\Call\CallResult; use Behat\Testwork\Environment\Environment; use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; use Moodle\BehatExtension\Context\Step\ChainedStep; use Moodle\BehatExtension\Exception\SkippedException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; // phpcs:disable moodle.NamingConventions.ValidFunctionName.LowercaseMethod /** * Override step tester to ensure chained steps gets executed. * * @package core * @copyright 2016 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class ChainedStepTester implements StepTester { /** * The text of the step to look for exceptions / debugging messages. */ const EXCEPTIONS_STEP_TEXT = 'I look for exceptions'; /** * @var StepTester Base step tester. */ private $singlesteptester; /** * @var EventDispatcher keep step event dispatcher. */ private $eventdispatcher; /** * Keep status of chained steps if used. * @var bool */ protected static $chainedstepused = false; /** * Constructor. * * @param StepTester $steptester single step tester. */ public function __construct(StepTester $steptester) { $this->singlesteptester = $steptester; } /** * Set event dispatcher to use for events. * * @param EventDispatcherInterface $eventdispatcher */ public function setEventDispatcher(EventDispatcherInterface $eventdispatcher) { $this->eventdispatcher = $eventdispatcher; } /** * Sets up step for a test. * * @param Environment $env * @param FeatureNode $feature * @param StepNode $step * @param bool $skip * * @return Setup */ public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip) { return $this->singlesteptester->setUp($env, $feature, $step, $skip); } /** * Tests step. * * @param Environment $env * @param FeatureNode $feature * @param StepNode $step * @param bool $skip * @return StepResult */ public function test(Environment $env, FeatureNode $feature, StepNode $step, $skip) { $result = $this->singlesteptester->test($env, $feature, $step, $skip); if (!($result instanceof ExecutedStepResult) || !$this->supportsResult($result->getCallResult())) { $result = $this->checkSkipResult($result); // If undefined step then don't continue chained steps. if ($result instanceof UndefinedStepResult) { return $result; } // If exception caught, then don't continue chained steps. if (($result instanceof ExecutedStepResult) && $result->hasException()) { return $result; } // If step is skipped, then return. no need to continue chain steps. if ($result instanceof SkippedStepResult) { return $result; } // Check for exceptions. // Extra step, looking for a moodle exception, a debugging() message or a PHP debug message. $checkingstep = new StepNode('Given', self::EXCEPTIONS_STEP_TEXT, [], $step->getLine()); $afterexceptioncheckingevent = $this->singlesteptester->test($env, $feature, $checkingstep, $skip); $exceptioncheckresult = $this->checkSkipResult($afterexceptioncheckingevent); if (!$exceptioncheckresult->isPassed()) { return $exceptioncheckresult; } return $result; } return $this->runChainedSteps($env, $feature, $result, $skip); } /** * Tears down step after a test. * * @param Environment $env * @param FeatureNode $feature * @param StepNode $step * @param bool $skip * @param StepResult $result * @return Teardown */ public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result) { return $this->singlesteptester->tearDown($env, $feature, $step, $skip, $result); } /** * Check if results supported. * * @param CallResult $result * @return bool */ private function supportsResult(CallResult $result) { $return = $result->getReturn(); if ($return instanceof ChainedStep) { return true; } if (!is_array($return) || empty($return)) { return false; } foreach ($return as $value) { if (!$value instanceof ChainedStep) { return false; } } return true; } /** * Run chained steps. * * @param Environment $env * @param FeatureNode $feature * @param ExecutedStepResult $result * @param bool $skip * @return ExecutedStepResult|StepResult */ private function runChainedSteps(Environment $env, FeatureNode $feature, ExecutedStepResult $result, $skip) { // Set chained setp is used, so it can be used by formatter to o/p. self::$chainedstepused = true; $callresult = $result->getCallResult(); $steps = $callresult->getReturn(); if (!is_array($steps)) { // Test it, no need to dispatch events for single chain. $stepresult = $this->test($env, $feature, $steps, $skip); return $this->checkSkipResult($stepresult); } // Test all steps. foreach ($steps as $step) { // Setup new step. $event = new BeforeStepTested($env, $feature, $step); if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) { // Symfony 4.3 and up. $this->eventdispatcher->dispatch($event, $event::BEFORE); } else { // TODO: Remove when our min supported version is >= 4.3. $this->eventdispatcher->dispatch($event::BEFORE, $event); } $setup = $this->setUp($env, $feature, $step, $skip); $event = new AfterStepSetup($env, $feature, $step, $setup); if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) { // Symfony 4.3 and up. $this->eventdispatcher->dispatch($event, $event::AFTER_SETUP); } else { // TODO: Remove when our min supported version is >= 4.3. $this->eventdispatcher->dispatch($event::AFTER_SETUP, $event); } // Test it. $stepresult = $this->test($env, $feature, $step, $skip); // Tear down. $event = new BeforeStepTeardown($env, $feature, $step, $result); if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) { // Symfony 4.3 and up. $this->eventdispatcher->dispatch($event, $event::BEFORE_TEARDOWN); } else { // TODO: Remove when our min supported version is >= 4.3. $this->eventdispatcher->dispatch($event::BEFORE_TEARDOWN, $event); } $teardown = $this->tearDown($env, $feature, $step, $skip, $result); $event = new AfterStepTested($env, $feature, $step, $result, $teardown); if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) { // Symfony 4.3 and up. $this->eventdispatcher->dispatch($event, $event::AFTER); } else { // TODO: Remove when our min supported version is >= 4.3. $this->eventdispatcher->dispatch($event::AFTER, $event); } if (!$stepresult->isPassed()) { return $this->checkSkipResult($stepresult); } } return $this->checkSkipResult($stepresult); } /** * Handle skip exception. * * @param StepResult $result * * @return ExecutedStepResult|SkippedStepResult */ private function checkSkipResult(StepResult $result) { if ((method_exists($result, 'getException')) && ($result->getException() instanceof SkippedException)) { return new SkippedStepResult($result->getSearchResult()); } else { return $result; } } /** * Returns if cahined steps are used. * @return bool. */ public static function is_chained_step_used() { return self::$chainedstepused; } } PKa\6e+Tester/MoodleEventDispatchingStepTester.phpnu[PKa\0&0&UTester/ChainedStepTester.phpnu[PK: