aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-05-03 14:35:04 +0200
committerJoas Schilling <nickvergessen@gmx.de>2015-05-03 20:08:02 +0200
commit923fdb0aa094f8d4957b0ad36f7ea32ad2323042 (patch)
treeb81e7a3b3b98edad4e2faf1c6e46daed5d880bcf /tests
parentb73b9f1dec0f5f063808980684ba98020dc8974f (diff)
downloadforums-923fdb0aa094f8d4957b0ad36f7ea32ad2323042.tar
forums-923fdb0aa094f8d4957b0ad36f7ea32ad2323042.tar.gz
forums-923fdb0aa094f8d4957b0ad36f7ea32ad2323042.tar.bz2
forums-923fdb0aa094f8d4957b0ad36f7ea32ad2323042.tar.xz
forums-923fdb0aa094f8d4957b0ad36f7ea32ad2323042.zip
[ticket/13809] Test each file individually
PHPBB3-13809
Diffstat (limited to 'tests')
-rw-r--r--tests/lint_test.php49
1 files changed, 28 insertions, 21 deletions
diff --git a/tests/lint_test.php b/tests/lint_test.php
index 9fb1c7624c..fb43196bae 100644
--- a/tests/lint_test.php
+++ b/tests/lint_test.php
@@ -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::$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', '<'))
{
$this->markTestSkipped('phpBB uses PHP 5.3 syntax in some files, linting on PHP < 5.3 will fail');
}
- $root = dirname(__FILE__) . '/..';
- $this->check($root);
+ $cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path));
+ $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)
{
+ $files = array();
$dh = opendir($root);
while (($filename = readdir($dh)) !== false)
{
@@ -76,19 +79,23 @@ class phpbb_lint_test extends phpbb_test_case
{
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')
{
- $cmd = sprintf('(%s -l %s) 2>&1', self::$php_binary, escapeshellarg($path));
- $output = array();
- $status = 1;
- exec($cmd, $output, $status);
- $output = implode("\n", $output);
- $this->assertEquals(0, $status, "PHP lint failed for $path:\n$output");
+ $files[] = array($path);
}
}
+ return $files;
}
}