Code to run after each test

@param TestInterface $test
483270
public function _after(TestInterface $test)
    {
        if ($this->config['reconnect']) {
            $this->disconnect();
        }

        parent::_after($test);
    }
709613
public function run(ContainerInterface $container): void
    {
        foreach ($this->getSeeds($container) as $seederClass) {
            $this->getIO()->writeInfo("Starting seed for `$seederClass`..." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE);
            $this->executeSeedInit($container, $seederClass);
            /** @var SeedInterface $seeder */
            $seeder = new $seederClass();
            $seeder->init($container)->run();
            $this->getIO()->writeInfo("Seed finished for `$seederClass`." . PHP_EOL, IoInterface::VERBOSITY_NORMAL);
        }
    }
1267167
public function afterElementSave(ElementInterface $element, bool $isNew)
    {
        Plugin::getInstance()->service->saveRelationship($this, $element);

        parent::afterElementSave($element, $isNew);
    }
1221678
public function run()
    {
        // Set the total count to zero
        $this->totalCount = 0;

        // Load the suites defined in the options
        $suites = $this->options->suites;

        // Check if a suite name has been passed via the command line
        if ($suite = $this->options->suite) {
            // If the suite hasn't been defined, throw an exception
            if (!$this->options->suites->{$suite}) {
                throw new TestNotFoundException('The suite '.$suite.' is not defined');
            }

            // Overwrite the array of suites, so that only the passed
            // suite is run
            $suites = [
                $suite => $this->options->suites->{$suite},
            ];
        }

        // If arguments exist, then we create a new suite from the
        // files/directories passed as arguments
        if ($this->args) {
            $suites = [
                'tests' => $this->args,
            ];
        }

        // Loop through each of the suites
        foreach ($suites as $suite => $dirs) {
            // Reset the runner's tests
            $this->tests = [];

            // Load the tests for the suite
            $this->loadTests($dirs);

            // Get the number of tests and increment the total count
            $total = count($this->tests);
            $this->totalCount += $total;

            // Get the suite name
            $name = Str::title($suite);

            // Output a message to the user
            echo "\n";
            echo $this->output->gray->render("Running $total tests in suite $name...");

            // Render the table of tests
            $this->output->table();

            // If the random option is set, shuffle the array of tests
            if ($this->options->random === true) {
                shuffle($this->tests);
            }

            // Loop through each of the tests
            foreach ($this->tests as $test) {
                // Run the test inside a try/catch block so that we can
                // include errors in results without stopping testing
                try {
                    $test->run();
                } catch (Exception $e) {
                    $bits = explode('\\', get_class($e));
                    // Mark the test as errored
                    $test->error(array_pop($bits).': '.$e->getMessage());
                }
            }
        }

        // Output the results to the CLI
        $this->output->results();
    }
105744
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->Selftest($input, $output);
        $this->Ping($input, $output);
        $this->Connect($input, $output);
    }
54157
public function run(TestResult $result)
    {
        $this->eventEmitter->emit('suite.start', [$this]);
        $this->eventEmitter->on('suite.halt', [$this, 'halt']);

        foreach ($this->getTestsToRun() as $test) {
            if ($this->halted) {
                break;
            }

            $this->runTest($test, $result);
        }

        $this->eventEmitter->emit('suite.end', [$this]);
    }
696474
public function _before(TestInterface $test)
    {
        if ($this->config['reconnect']) {
            $this->connect();
        }

        $this->removeInserted();

        parent::_before($test);
    }
1013013
public function addError(Test $test)
    {
        $this->output->updateTable($test->pos->x, $test->pos->y, Graphite::YELLOW);
        $this->errors[] = $test;
    }
1228113
public function init()
    {
        $this->eventEmitter->on('test.passed', [$this, 'onTestPassed']);
        $this->eventEmitter->on('test.failed', [$this, 'onTestFailed']);
        $this->eventEmitter->on('test.pending', [$this, 'onTestPending']);
        $this->eventEmitter->on('runner.end', [$this, 'onRunnerEnd']);
    }
933426
protected function execute(CommandInterface $command)
    {
        $runner = $this->getCommandRunner();

        $this->lastReturnValue = $runner->run($command);

        $this->checkReturnValue($runner);
    }
793699
public function addSkipped(Test $test)
    {
        $this->output->updateTable($test->pos->x, $test->pos->y, Graphite::MAGENTA);
        $this->skipped[] = $test;
    }
149415
public function _before(TestInterface $test)
    {
        if (class_exists('\Memcache')) {
            $this->memcache = new \Memcache;
            $this->memcache->connect($this->config['host'], $this->config['port']);
        } elseif (class_exists('\Memcached')) {
            $this->memcache = new \Memcached;
            $this->memcache->addServer($this->config['host'], $this->config['port']);
        } else {
            throw new ModuleConfigException(__CLASS__, 'Memcache classes not loaded');
        }
    }
968704
public function prepareExecute(InputInterface $input)
    {
        $this->coverFishHelper = new CoverFishHelper();

        $phpUnitConfigFile = $input->getArgument('phpunit-config');
        if (false === empty($phpUnitConfigFile) &&
            false === $this->coverFishHelper->checkFileOrPath($phpUnitConfigFile)) {
            throw new \Exception(sprintf('phpunit config file "%s" not found! please define your phpunit.xml config file to use (e.g. tests/phpunit.xml)', $phpUnitConfigFile));
        }

        $testPathOrFile = $input->getOption('raw-scan-path');
        if (false === empty($testPathOrFile) &&
            false === $this->coverFishHelper->checkFileOrPath($testPathOrFile)) {
            throw new \Exception(sprintf('test path/file "%s" not found! please define test file path (e.g. tests/)', $testPathOrFile));
        }
    }
99900
public function _after(TestCase $testCase)
    {
        parent::_after($testCase);
        $this->throwExceptionOnHttpMockError();
        $this->diManager->get('httpMockServer')->clean();
    }
829205
private function printFooterOnAfterEvent(Formatter $formatter, Event $event)
    {
        if (!$event instanceof AfterOutlineTested) {
            return;
        }

        $this->tablePrinter->printFooter($formatter, $event->getTestResult());
    }
537291
protected void run(List<TestDescription> selectedTests) {
    mRunning = true;
    mTotalTestCount = selectedTests.size();
    mRunnerBean.run(this, selectedTests);
  }
221126
public function run(TestResult $result)
    {
        $this->applyFocus($result);

        $this->eventEmitter->on('test.failed', function () {
            if ($this->configuration->shouldStopOnFailure()) {
                $this->eventEmitter->emit('suite.halt');
            }
        });

        $this->eventEmitter->emit('runner.start');
        $this->suite->setEventEmitter($this->eventEmitter);
        $start = microtime(true);
        $this->suite->run($result);
        $this->eventEmitter->emit('runner.end', [microtime(true) - $start, $result]);
    }