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

Breadcrumb

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

function TestCase::assertSniffWarning

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TestCase.php, line 122

Class

TestCase
@codeCoverageIgnore

Namespace

SlevomatCodingStandard\Sniffs

Code

protected static function assertSniffWarning(File $phpcsFile, int $line, string $code, ?string $message = null) : void {
    $errors = $phpcsFile->getWarnings();
    self::assertTrue(isset($errors[$line]), sprintf('Expected warning on line %s, but none found.', $line));
    $sniffCode = sprintf('%s.%s', self::getSniffName(), $code);
    self::assertTrue(self::hasError($errors[$line], $sniffCode, $message), sprintf('Expected warning %s%s, but none found on line %d.%sWarnings found on line %d:%s%s%s', $sniffCode, $message !== null ? sprintf(' with message "%s"', $message) : '', $line, PHP_EOL . PHP_EOL, $line, PHP_EOL, self::getFormattedErrors($errors[$line]), PHP_EOL));
}
RSS feed
Powered by Drupal