Browse Source

Fixed tests RedisDebugTest, ProfilerTest with use PROFILER setting.

master
Alexander Demidov 12 years ago
parent
commit
69cd61121e
  1. 6
      tests/redis/RedisDebugTest.php
  2. 16
      tests/util/profiler/ProfilerTest.php

6
tests/redis/RedisDebugTest.php

@ -59,7 +59,7 @@ class RedisDebugTest extends PHPUnit_Framework_TestCase
*/
public function testCallSimpleParams()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$mock = $this->getMock('Redis', array('connect'));
$mock->expects($this->once())
@ -77,7 +77,7 @@ class RedisDebugTest extends PHPUnit_Framework_TestCase
*/
public function testCallArrayParam()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$mock = $this->getMock('Redis', array('connect'));
$mock->expects($this->once())
@ -95,7 +95,7 @@ class RedisDebugTest extends PHPUnit_Framework_TestCase
*/
public function testCallUndefinedMethod()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$mock = $this->getMock('Redis', array('connect'));
$redisDebug = new RedisDebug($mock);

16
tests/util/profiler/ProfilerTest.php

@ -38,8 +38,8 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
*/
public function testGetInstaceNoDebug()
{
Config::set('DEBUG', false);
$this->setExpectedException('GeneralException', 'Need to turn on DEBUG before use.');
Config::set('PROFILER', false);
$this->setExpectedException('GeneralException', 'Need to turn on PROFILER before use.');
Profiler::getInstance();
}
@ -48,7 +48,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
*/
public function testGetInstance()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$profiler = Profiler::getInstance();
$this->assertInstanceOf('Profiler', $profiler);
$this->assertSame($profiler, Profiler::getInstance());
@ -59,7 +59,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
*/
public function testProfilerCommand()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false);
$profiler = Profiler::getInstance();
$cmdProfiler = $profiler->profilerCommand('command', 'type');
@ -71,7 +71,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
*/
public function testStartEndNoCommandProfiler()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$profiler = Profiler::getInstance();
$profiler->start();
$result = $profiler->end('<body></body>');
@ -89,7 +89,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
*/
public function testStartEndWithCommandProfiler()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false);
$profiler = Profiler::getInstance();
@ -107,7 +107,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
*/
public function testGetJSON()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false);
$profiler = Profiler::getInstance();
@ -120,7 +120,7 @@ class ProfilerTest extends PHPUnit_Framework_TestCase
*/
public function testGetCLI()
{
Config::set('DEBUG', true);
Config::set('PROFILER', true);
$this->getMock('CommandProfiler', array('getType', 'getCommand', 'getElapsed'), array(), 'CommandProfilerMock', false);
$profiler = Profiler::getInstance();

Loading…
Cancel
Save