diff --git a/.travis.yml b/.travis.yml index fec43ab..208a6d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,10 +15,9 @@ env: before_script: - composer require "simplesamlphp/simplesamlphp:${SIMPLESAMLPHP_VERSION}" --no-update - composer update --no-interaction - - if [[ "$TRAVIS_PHP_VERSION" == "7.3" ]]; then composer require --dev vimeo/psalm:1.1.9; fi script: - - bin/check-syntax.sh + - vendor/simplesamlphp/simplesamlphp-test-framework/bin/check-syntax-php.sh - if [[ "$TRAVIS_PHP_VERSION" == "5.6" ]]; then php vendor/phpunit/phpunit/phpunit; else php vendor/phpunit/phpunit/phpunit --no-coverage; fi - if [[ "$TRAVIS_PHP_VERSION" == "7.3" ]]; then vendor/bin/psalm; fi diff --git a/bin/check-syntax.sh b/bin/check-syntax.sh deleted file mode 100755 index 8fc2e8e..0000000 --- a/bin/check-syntax.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -PHP='/usr/bin/env php' -RETURN=0 - -# check PHP files -for FILE in `find lib templates tests www -name "*.php"`; do - $PHP -l $FILE > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "Syntax check failed for ${FILE}" - RETURN=`expr ${RETURN} + 1` - fi -done - -exit $RETURN diff --git a/composer.json b/composer.json index 2423373..e38ff8d 100644 --- a/composer.json +++ b/composer.json @@ -33,10 +33,10 @@ }, "require-dev": { "simplesamlphp/simplesamlphp": "^1.17", - "phpunit/phpunit": "~5.7" + "simplesamlphp/simplesamlphp-test-framework": "^0.0.10" }, "support": { - "issues": "https://github.com/tvdijen/simplesamlphp-module-adfs/issues", - "source": "https://github.com/tvdijen/simplesamlphp-module-adfs" + "issues": "https://github.com/simplesamlphp/simplesamlphp-module-adfs/issues", + "source": "https://github.com/simplesamlphp/simplesamlphp-module-adfs" } } diff --git a/phpunit.xml b/phpunit.xml index c0985fd..0540658 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,6 +2,7 @@ + ./vendor/simplesamlphp/simplesamlphp-test-framework/tests/ tests/ diff --git a/tests/www/TemplateTest.php b/tests/www/TemplateTest.php deleted file mode 100644 index eba3dfd..0000000 --- a/tests/www/TemplateTest.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @package SimpleSAMLphp - */ - -namespace SimpleSAML\Test\Web; - -use PHPUnit\Framework\TestCase; -use SimpleSAML\Configuration; -use SimpleSAML\XHTML\Template; -use SimpleSAML\Module; -use Twig\Error\SyntaxError; - -class TemplateTest extends TestCase -{ - public function testSyntax() - { - $config = Configuration::loadFromArray([ - 'language.i18n.backend' => 'gettext/gettext', - '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, 'adfs:'.basename($file)); - ob_start(); - try { - $t->show(); - $this->addToAssertionCount(1); - } catch (SyntaxError $e) { - $this->fail($e->getMessage().' in '.$e->getFile().':'.$e->getLine()); - } - ob_end_clean(); - } - } - } -}