Replace constant DEBUG to use in Config. Remove start profiler from FrontController (moved to bootstrap).
This commit is contained in:
@ -36,9 +36,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetInstaceNoDebug()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
$this->setExpectedException('GeneralException', 'Need to turn on DEBUG before use.');
|
||||
Profiler::getInstance();
|
||||
}
|
||||
@ -48,9 +46,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetInstance()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', true);
|
||||
}
|
||||
Config::set('DEBUG', 1);
|
||||
$profiler = Profiler::getInstance();
|
||||
$this->assertInstanceOf('Profiler', $profiler);
|
||||
$this->assertSame($profiler, Profiler::getInstance());
|
||||
@ -61,9 +57,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testProfilerCommand()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', true);
|
||||
}
|
||||
Config::set('DEBUG', 1);
|
||||
$this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false);
|
||||
$profiler = Profiler::getInstance();
|
||||
$cmdProfiler = $profiler->profilerCommand('command', 'type');
|
||||
@ -75,9 +69,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testStartEndNoCommandProfiler()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', true);
|
||||
}
|
||||
Config::set('DEBUG', 1);
|
||||
$profiler = Profiler::getInstance();
|
||||
$profiler->start();
|
||||
$result = $profiler->end('<body></body>');
|
||||
@ -95,9 +87,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testStartEndWithCommandProfiler()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', true);
|
||||
}
|
||||
Config::set('DEBUG', 1);
|
||||
|
||||
$this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false);
|
||||
$profiler = Profiler::getInstance();
|
||||
@ -115,9 +105,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetJSON()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', true);
|
||||
}
|
||||
Config::set('DEBUG', 1);
|
||||
|
||||
$this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false);
|
||||
$profiler = Profiler::getInstance();
|
||||
@ -130,9 +118,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetCLI()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', true);
|
||||
}
|
||||
Config::set('DEBUG', 1);
|
||||
|
||||
$this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false);
|
||||
$profiler = Profiler::getInstance();
|
||||
|
Reference in New Issue
Block a user