3 require_once 'PHPUnit/Framework/TestCase.php';
8 * @package DeprecationsTests
9 * @author Roland Mas <lolando@debian.org>
10 * @copyright 2009 Roland Mas
11 * @license http://www.opensource.org/licenses/gpl-license.php GPL License
13 class Deprecations_Tests extends PHPUnit_Framework_TestCase
16 * Check that no code uses db_query()
18 public function testdb_query()
20 $output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -l '\bdb_query\b' \
21 | grep -v ^tests/code/deprecations/DeprecationsTests.php \
22 | grep -v ^gforge/db/upgrade-db.php \
23 | grep -v ^gforge/www/include/database-oci8.php \
24 | grep -v ^gforge/common/include/database-pgsql.php \
25 | grep -v ^gforge/common/include/database-mysql.php`;
26 $this->assertEquals('', $output);
30 * Check that no code uses configuration items from global variables
32 public function testconfig_vars()
34 $vars = array ('sys_name',
35 'sys_user_reg_restricted') ;
37 $pattern = implode ('|', $vars) ;
39 $output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -n '\\$($pattern)\b' \
40 | grep -v ^gforge/www/include/pre.php`;
41 $this->assertEquals('', $output, "Found deprecated \$var for var in ($pattern):");
43 $output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -n '\\\$GLOBALS\\[.?($pattern).?\\]' \
44 | grep -v ^gforge/www/include/pre.php`;
45 $this->assertEquals('', $output, "Found deprecated \$GLOBALS['\$var'] for var in ($pattern):");
51 // c-file-style: "bsd"