mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-21 17:11:53 +02:00
Merge pull request #3588 from nickvergessen/ticket/13809-asc
[ticket/13809] Perform the lint test prior to normal tests
This commit is contained in:
@@ -46,6 +46,7 @@ script:
|
|||||||
- travis/check-sami-parse-errors.sh $DB $TRAVIS_PHP_VERSION
|
- travis/check-sami-parse-errors.sh $DB $TRAVIS_PHP_VERSION
|
||||||
- travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION
|
- travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION
|
||||||
- travis/check-executable-files.sh $DB $TRAVIS_PHP_VERSION ./
|
- travis/check-executable-files.sh $DB $TRAVIS_PHP_VERSION ./
|
||||||
|
- sh -c "if [ '$SLOWTESTS' != '1' -a '$DB' = 'mysqli' ]; then phpBB/vendor/bin/phpunit tests/lint_test.php; fi"
|
||||||
- sh -c "if [ '$SLOWTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml; fi"
|
- sh -c "if [ '$SLOWTESTS' != '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml; fi"
|
||||||
- sh -c "if [ '$SLOWTESTS' = '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --group slow; fi"
|
- sh -c "if [ '$SLOWTESTS' = '1' ]; then phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml --group slow; fi"
|
||||||
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3.3' -a '$DB' = 'mysqli' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi"
|
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3.3' -a '$DB' = 'mysqli' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi"
|
||||||
|
@@ -38,31 +38,34 @@ class phpbb_lint_test extends phpbb_test_case
|
|||||||
self::markTestSkipped(sprintf('Could not run PHP_BINARY %s. Output: %s', self::$php_binary, $output));
|
self::markTestSkipped(sprintf('Could not run PHP_BINARY %s. Output: %s', self::$php_binary, $output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$exclude = array(
|
|
||||||
dirname(__FILE__) . '/../.git',
|
|
||||||
dirname(__FILE__) . '/../build/new_version',
|
|
||||||
dirname(__FILE__) . '/../build/old_versions',
|
|
||||||
dirname(__FILE__) . '/../phpBB/cache',
|
|
||||||
// PHP Fatal error: Cannot declare class Container because the name is already in use in /var/www/projects/phpbb3/tests/../phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php on line 20
|
|
||||||
// https://gist.github.com/e003913ffd493da63cbc
|
|
||||||
dirname(__FILE__) . '/../phpBB/vendor',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_lint()
|
/**
|
||||||
|
* @dataProvider lint_data
|
||||||
|
*/
|
||||||
|
public function test_lint($path)
|
||||||
{
|
{
|
||||||
if (version_compare(PHP_VERSION, '5.3.0', '<'))
|
if (version_compare(PHP_VERSION, '5.3.0', '<'))
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('phpBB uses PHP 5.3 syntax in some files, linting on PHP < 5.3 will fail');
|
$this->markTestSkipped('phpBB uses PHP 5.3 syntax in some files, linting on PHP < 5.3 will fail');
|
||||||
}
|
}
|
||||||
|
|
||||||
$root = dirname(__FILE__) . '/..';
|
$cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path));
|
||||||
$this->check($root);
|
$output = array();
|
||||||
|
$status = 1;
|
||||||
|
exec($cmd, $output, $status);
|
||||||
|
$output = implode("\n", $output);
|
||||||
|
$this->assertEquals(0, $status, "PHP lint failed for $path:\n$output");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function lint_data()
|
||||||
|
{
|
||||||
|
return $this->check(dirname(__FILE__) . '/..');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function check($root)
|
protected function check($root)
|
||||||
{
|
{
|
||||||
|
$files = array();
|
||||||
$dh = opendir($root);
|
$dh = opendir($root);
|
||||||
while (($filename = readdir($dh)) !== false)
|
while (($filename = readdir($dh)) !== false)
|
||||||
{
|
{
|
||||||
@@ -76,19 +79,23 @@ class phpbb_lint_test extends phpbb_test_case
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_dir($path) && !in_array($path, self::$exclude))
|
if (is_dir($path) && !in_array($path, array(
|
||||||
|
dirname(__FILE__) . '/../.git',
|
||||||
|
dirname(__FILE__) . '/../build/new_version',
|
||||||
|
dirname(__FILE__) . '/../build/old_versions',
|
||||||
|
dirname(__FILE__) . '/../phpBB/cache',
|
||||||
|
// PHP Fatal error: Cannot declare class Container because the name is already in use in /var/www/projects/phpbb3/tests/../phpBB/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php on line 20
|
||||||
|
// https://gist.github.com/e003913ffd493da63cbc
|
||||||
|
dirname(__FILE__) . '/../phpBB/vendor',
|
||||||
|
)))
|
||||||
{
|
{
|
||||||
$this->check($path);
|
$files = array_merge($files, $this->check($path));
|
||||||
}
|
}
|
||||||
else if (substr($filename, strlen($filename)-4) == '.php')
|
else if (substr($filename, strlen($filename)-4) == '.php')
|
||||||
{
|
{
|
||||||
$cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path));
|
$files[] = array($path);
|
||||||
$output = array();
|
|
||||||
$status = 1;
|
|
||||||
exec($cmd, $output, $status);
|
|
||||||
$output = implode("\n", $output);
|
|
||||||
$this->assertEquals(0, $status, "PHP lint failed for $path:\n$output");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,9 +18,6 @@
|
|||||||
<exclude>../tests/lint_test.php</exclude>
|
<exclude>../tests/lint_test.php</exclude>
|
||||||
<exclude>../tests/ui</exclude>
|
<exclude>../tests/ui</exclude>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="phpBB Lint Test">
|
|
||||||
<file>../tests/lint_test.php</file>
|
|
||||||
</testsuite>
|
|
||||||
<testsuite name="phpBB Functional Tests">
|
<testsuite name="phpBB Functional Tests">
|
||||||
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory>
|
<directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
|
Reference in New Issue
Block a user