Commit 0640a622 authored by totten's avatar totten

Civi/Test/TAP - Replace Symfony YAML dependency

This allows two paths:

1. If you have the YAML PECL extension, then that will be used.
   To get the best output, you can install it.
2. If you don't, then it'll output JSON. JSON is considered valid YAML.
   It's not clear that everyone reading the document will handle
   the full range YAML (incl JSON), but... we don't actually have any
   listeners that care to parse the TAP output...
parent 62e6c49c
......@@ -97,10 +97,21 @@ class TAP extends \PHPUnit\Util\Printer implements \PHPUnit\Framework\TestListen
);
}
}
$yaml = new \Symfony\Component\Yaml\Dumper();
$this
->write(sprintf(" ---\n%s ...\n", $yaml
->dump($diagnostic, 2, 2)));
if (function_exists('yaml_emit')) {
$content = \yaml_emit($diagnostic, YAML_UTF8_ENCODING);
$content = ' ' . strtr($content, ["\n" => "\n "]);
}
else {
// Any valid JSON document is a valid YAML document.
$content = json_encode($diagnostic, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
// For closest match, drop outermost {}'s. Realign indentation.
$content = substr($content, 0, strrpos($content, "}")) . ' }';
$content = ' ' . ltrim($content);
$content = sprintf(" ---\n%s\n ...\n", $content);
}
$this->write($content);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment