File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace SimpleSAML \Test \Web ;
4+
5+ use Symfony \Component \Yaml \Parser ;
6+ use PHPUnit \Framework \TestCase ;
7+ use \SimpleSAML \Configuration ;
8+ use \SimpleSAML \Module ;
9+
10+ class RouterTest extends TestCase
11+ {
12+ public function testSyntax ()
13+ {
14+ $ config = Configuration::loadFromArray ([
15+ 'module.enable ' => array_fill_keys (Module::getModules (), true ),
16+ ]);
17+ Configuration::setPreLoadedConfig ($ config );
18+
19+ $ yaml = new Parser ();
20+
21+ // Module templates
22+ foreach (Module::getModules () as $ module ) {
23+ $ basedir = Module::getModuleDir ($ module );
24+ if (file_exists ($ basedir )) {
25+ $ files = array_diff (scandir ($ basedir ), ['. ' , '.. ' ]);
26+ foreach ($ files as $ file ) {
27+ if (preg_match ('/.(yml|yaml)$/ ' , $ file )) {
28+ try {
29+ $ value = $ yaml ->parse (file_get_contents ('../../modules/ ' .$ module .'/ ' .$ file ));
30+ $ this ->addToAssertionCount (1 );
31+ } catch (\ParseException $ e ) {
32+ $ this ->fail ($ e ->getMessage ().' in ' .$ e ->getFile ().': ' .$ e ->getLine ());
33+ }
34+ }
35+ }
36+ }
37+ }
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments