Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PhptTestCase.php

function PhptTestCase::shouldTestBeSkipped

1 call to PhptTestCase::shouldTestBeSkipped()
PhptTestCase::run in vendor/phpunit/phpunit/src/Runner/PhptTestCase.php
Runs a test and collects its result in a TestResult instance.

File

vendor/phpunit/phpunit/src/Runner/PhptTestCase.php, line 398

Class

PhptTestCase
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\Runner

Code

private function shouldTestBeSkipped(array $sections, array $settings) : bool {
    if (!isset($sections['SKIPIF'])) {
        return false;
    }
    $skipif = $this->render($sections['SKIPIF']);
    $jobResult = $this->phpUtil
        ->runJob($skipif, $this->stringifyIni($settings));
    if (!strncasecmp('skip', ltrim($jobResult['stdout']), 4)) {
        $message = '';
        if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $jobResult['stdout'], $skipMatch)) {
            $message = substr($skipMatch[1], 2);
        }
        EventFacade::emitter()->testSkipped($this->valueObjectForEvents(), $message);
        EventFacade::emitter()->testFinished($this->valueObjectForEvents(), 0);
        return true;
    }
    return false;
}
RSS feed
Powered by Drupal