Skip to content
Snippets Groups Projects
Commit 084f7f2f authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Remove Yaml syntax check; we already have the binary in the test-framework

parent 0129c26e
No related branches found
No related tags found
No related merge requests found
<?php
declare(strict_types=1);
namespace SimpleSAML\Test\Web;
use PHPUnit\Framework\TestCase;
use SimpleSAML\Configuration;
use SimpleSAML\Module;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Exception\ParseException;
class RouterTest extends TestCase
{
/**
* @return void
*/
public function testSyntax(): void
{
$config = Configuration::loadFromArray([
'module.enable' => array_fill_keys(Module::getModules(), true),
]);
Configuration::setPreLoadedConfig($config);
$yaml = new Parser();
// Module templates
foreach (Module::getModules() as $module) {
$basedir = Module::getModuleDir($module);
if (file_exists($basedir)) {
$files = array_diff(scandir($basedir), ['.', '..']);
foreach ($files as $file) {
if (preg_match('/.(yml|yaml)$/', $file)) {
try {
$yaml->parse(file_get_contents('modules/' . $module . '/' . $file));
$this->addToAssertionCount(1);
} catch (ParseException $e) {
$this->fail($e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine());
}
}
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment