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);
}
}
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()); } }