piwik.php.test.php

来自「一款可以和GOOGLE媲美的开源统计系统,运用AJAX.功能强大. 无色提示:」· PHP 代码 · 共 59 行

PHP
59
字号
<?php// we def have problems with INCLUDE_PATH on these tests....if(!defined("PATH_TEST_TO_ROOT")) {	define('PATH_TEST_TO_ROOT', '..');	$content = file_get_contents('../../piwik.php');}else{	$content = file_get_contents('../piwik.php');}$GLOBALS['content'] = $content;if(!defined('CONFIG_TEST_INCLUDED')){	require_once PATH_TEST_TO_ROOT ."/../tests/config_test.php";	}class Test_PiwikPhp extends UnitTestCase{	function __construct( $title = '')	{		parent::__construct( $title );	}		function testDebugOff()	{		// catch that the string GLOBALS['DEBUGPIWIK'] = false		$ereg = "(GLOBALS\['DEBUGPIWIK'\])([ ])*=([ ])*(false;)";			// first we test the ereg :)				$good = array(			'$GLOBALS[\'DEBUGPIWIK\'] = false;',			'$GLOBALS[\'DEBUGPIWIK\']   =    false;',			' $GLOBALS[\'DEBUGPIWIK\']   =    false;',		);				foreach($good as $test)		{			$this->assertTrue( ereg($ereg,$test) !== false); 		}		$bad = array(			'$GLOBALS[\'DEBUGPIWIK\'] = true;',			'$GLOBALS[\'DEBUGPIWIK\']   =    1;',			' $GLOBALS[\'DEBUGPIWIK\']=\'false\';',		);				foreach($bad as $test)		{			$this->assertTrue( ereg($ereg,$test) === false); 		}						// then we check that the piwik.php content does have the DEBUG variable set to off		$this->assertTrue( ereg($ereg, $GLOBALS['content']) !== false,			'The $GLOBALS[\'DEBUGPIWIK\'] MUST BE SET TO false IN A PRODUCTION ENVIRONMENT !!!');	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?