Skip to content

Commit

Permalink
Symfony test for php 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bkrukowski committed Nov 23, 2019
1 parent 0876950 commit 0fcb320
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tests/symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,25 @@

require \implode(\DIRECTORY_SEPARATOR, array(__DIR__, '..', 'vendor', 'autoload.php'));

\assert_options(\ASSERT_WARNING, 0);
\assert_options(
\ASSERT_CALLBACK,
function ($file, $line, $_, $message) {
throw new \RuntimeException(\sprintf('%s %s:%d', $message, $file, $line));
\set_error_handler(
function ($no, $message, $file, $line) {
throw new \ErrorException($message, 0, $no, $file, $no);
},
\E_ALL | \E_STRICT
);

\set_exception_handler(
function ($exception) {
/** @var \Exception $exception */
echo '[', \get_class($exception), '] ', $exception->getMessage(), "\n";
echo $exception->getTraceAsString(), "\n";
exit(1);
}
);

$dumper = new SymfonyVarDumper();
$dumped = $dumper->dumpAsString('Hello world!');
\assert(
\is_string($dumped) && '' !== $dumped,
'Method dumpAsString must return not empty string.'
);
if (!\is_string($dumped) || '' === $dumped) {
throw new \UnexpectedValueException('Method dumpAsString must return not empty string.');
}
$dumper->dump('Tests passed.');

0 comments on commit 0fcb320

Please sign in to comment.