diff --git a/composer.json b/composer.json index 56cfc4fb1c2d498a0a9e28d16edc612ae7cedea4..5c1cafb079fa85f5f53bdc64235aad3d79759e74 100644 --- a/composer.json +++ b/composer.json @@ -89,7 +89,7 @@ "mikey179/vfsstream": "~1.6", "phpunit/phpunit": "~5.7", "sensiolabs/security-checker": "^5.0.3", - "simplesamlphp/simplesamlphp-test-framework": "^0.0.12", + "simplesamlphp/simplesamlphp-test-framework": "^0.1.0", "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "~1.1.9" }, diff --git a/phpunit.xml b/phpunit.xml index bd3d874071e68e19a3de4e03ee666232c6ad8bd0..adb7b98ca2709c7f3f0ac83c6fc83d730a85a84a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -10,7 +10,8 @@ bootstrap="./tests/bootstrap.php"> <testsuites> <testsuite name="Unit tests"> - <directory>./tests/</directory> + <directory>./vendor/simplesamlphp/simplesamlphp-test-framework/src</directory> + <directory>./tests</directory> </testsuite> </testsuites> <filter> diff --git a/tests/www/TemplateTest.php b/tests/www/TemplateTest.php deleted file mode 100644 index 7bba7931b924de212b5423e438963f4535445f5d..0000000000000000000000000000000000000000 --- a/tests/www/TemplateTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -namespace SimpleSAML\Test\Web; - -use PHPUnit\Framework\TestCase; -use SimpleSAML\Configuration; -use SimpleSAML\XHTML\Template; -use SimpleSAML\Module; -use Twig\Error\SyntaxError; - -/** - * Simple test for syntax-checking Twig-templates. - * - * @author Tim van Dijen <tvdijen@gmail.com> - * @package SimpleSAMLphp - */ -class TemplateTest extends TestCase -{ - /** - * @return void - */ - public function testSyntax() - { - $config = Configuration::loadFromArray([ - 'usenewui' => true, - 'module.enable' => array_fill_keys(Module::getModules(), true), - ]); - Configuration::setPreLoadedConfig($config); - - $basedir = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'templates'; - - // Base templates - $files = array_diff(scandir($basedir), ['.', '..']); - foreach ($files as $file) { - if (preg_match('/.twig$/', $file)) { - $t = new Template($config, $file); - ob_start(); - try { - $t->show(); - $this->addToAssertionCount(1); - } catch (SyntaxError $e) { - $this->fail($e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine()); - } - ob_end_clean(); - } - } - - // Module templates - foreach (Module::getModules() as $module) { - $basedir = Module::getModuleDir($module) . DIRECTORY_SEPARATOR . 'templates'; - if (file_exists($basedir)) { - $files = array_diff(scandir($basedir), ['.', '..']); - foreach ($files as $file) { - if (preg_match('/.twig$/', $file)) { - $t = new Template($config, $module . ':' . $file); - ob_start(); - try { - $t->show(); - $this->addToAssertionCount(1); - } catch (SyntaxError $e) { - $this->fail($e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine()); - } - ob_end_clean(); - } - } - } - } - } -}