3 require_once 'PHPUnit/Framework/TestCase.php';
9 * @author Alain Peyrat <aljeux@free.fr>
10 * @copyright 2009 Alain Peyrat. All rights reserved.
11 * @license http://www.opensource.org/licenses/gpl-license.php GPL License
13 class Syntax_Tests extends PHPUnit_Framework_TestCase
16 * Validate all php code with php -l.
18 public function testPhpSyntax()
20 $output = `cd .. ; find gforge tests -name '*.php' -type f -exec php -l {} \; | grep -v '^No syntax errors detected'`;
21 $this->assertEquals('', $output);
25 * Validate all scripts with isutf8.
27 public function testUTF8Chars()
29 // Skip the wiki part which is not UTF-8 encoded.
30 $output = `cd .. ; find gforge tests -name '*.php' -not -path 'gforge/plugins/wiki/www/*' -type f | xargs isutf8`;
31 $this->assertEquals('', $output);
32 $output = `cd .. ; find gforge tests -name '*.sql' -type f | xargs isutf8`;
33 $this->assertEquals('', $output);
34 $output = `cd .. ; find gforge tests -name '*.sh' -type f | xargs isutf8`;
35 $this->assertEquals('', $output);
36 $output = `cd .. ; find gforge tests -name '*.pl' -type f | xargs isutf8`;
37 $this->assertEquals('', $output);
41 * Ensure all scripts use Unix-style line endings
43 public function testUnixLineEndings()
45 $output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -l '\r$'`;
46 $this->assertEquals('', $output);
47 $output = `cd .. ; find gforge tests -name '*.sql' -type f | xargs pcregrep -l '\r$'`;
48 $this->assertEquals('', $output);
49 $output = `cd .. ; find gforge tests -name '*.sh' -type f | xargs pcregrep -l '\r$'`;
50 $this->assertEquals('', $output);
51 $output = `cd .. ; find gforge tests -name '*.pl' -type f | xargs pcregrep -l '\r$'`;
52 $this->assertEquals('', $output);