Tester\Assert::match PHP Метод

match() публичный статический Метод

Compares result using regular expression or mask: %a% one or more of anything except the end of line characters %a?% zero or more of anything except the end of line characters %A% one or more of anything including the end of line characters %A?% zero or more of anything including the end of line characters %s% one or more white space characters except the end of line characters %s?% zero or more white space characters except the end of line characters %S% one or more of characters except the white space %S?% zero or more of characters except the white space %c% a single character of any sort (except the end of line) %d% one or more digits %d?% zero or more digits %i% signed integer value %f% floating point number %h% one or more HEX digits
public static match ( $pattern, $actual, $description = NULL ) : void
Результат void
    public static function match($pattern, $actual, $description = NULL)
    {
        self::$counter++;
        if (!is_string($pattern)) {
            throw new \Exception('Pattern must be a string.');
        } elseif (!is_scalar($actual)) {
            self::fail(self::describe('%1 should match %2', $description), $actual, $pattern);
        } elseif (!self::isMatching($pattern, $actual)) {
            list($pattern, $actual) = self::expandMatchingPatterns($pattern, $actual);
            self::fail(self::describe('%1 should match %2', $description), $actual, $pattern);
        }
    }

Usage Example

Пример #1
0
 protected function checkRenderOutput(IComponent $control, $expected, array $renderParameters = [])
 {
     if (!$control->getParent()) {
         $this->attachToPresenter($control);
     }
     ob_start();
     $control->render(...$renderParameters);
     if (is_file($expected)) {
         \Tester\Assert::matchFile($expected, ob_get_clean());
     } else {
         \Tester\Assert::match($expected, ob_get_clean());
     }
 }
All Usage Examples Of Tester\Assert::match