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

Breadcrumb

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

function TestCase::assertSniffError

File

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

Class

TestCase
@codeCoverageIgnore

Namespace

SlevomatCodingStandard\Sniffs

Code

protected static function assertSniffError(File $phpcsFile, int $line, string $code, ?string $message = null) : void {
    $errors = $phpcsFile->getErrors();
    self::assertTrue(isset($errors[$line]), sprintf('Expected error on line %s, but none found.', $line));
    $sniffCode = sprintf('%s.%s', self::getSniffName(), $code);
    self::assertTrue(self::hasError($errors[$line], $sniffCode, $message), sprintf('Expected error %s%s, but none found on line %d.%sErrors 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