From 7a26da1034aee2229797efe15d5cbceeba236915 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Thu, 28 Jun 2012 16:18:28 +0400 Subject: [PATCH] Fixed tests with inc Config and Registry classes. Use LOGGING in logger tests. --- tests/LoadTest.php | 2 ++ tests/app/Action_TestCase.php | 2 ++ tests/layout/ErrorLayoutTest.php | 2 ++ tests/layout/LayoutTest.php | 2 ++ tests/logger/CliLoggerTest.php | 3 ++- tests/logger/FileLoggerTest.php | 1 + tests/model/MongoStatementTest.php | 28 +++++++++++++++------------- tests/model/MySQLiStatementTest.php | 2 ++ tests/redis/RedisDebugTest.php | 2 ++ tests/util/profiler/ProfilerTest.php | 2 ++ 10 files changed, 32 insertions(+), 14 deletions(-) diff --git a/tests/LoadTest.php b/tests/LoadTest.php index 104f9ee..2ea7e76 100644 --- a/tests/LoadTest.php +++ b/tests/LoadTest.php @@ -10,6 +10,8 @@ * Unit tests for Load class */ +require_once dirname(__FILE__) . '/../Registry.php'; +require_once dirname(__FILE__) . '/../Config.php'; require_once dirname(__FILE__) . '/../Load.php'; require_once 'vfsStream/vfsStream.php'; diff --git a/tests/app/Action_TestCase.php b/tests/app/Action_TestCase.php index 44abf38..d552117 100644 --- a/tests/app/Action_TestCase.php +++ b/tests/app/Action_TestCase.php @@ -10,6 +10,8 @@ * Action_TestCase class for testing Actions */ +require_once dirname(__FILE__) . '/../../Registry.php'; +require_once dirname(__FILE__) . '/../../Config.php'; require_once dirname(__FILE__) . '/../../Load.php'; require_once dirname(__FILE__) . '/../../classes/Env.class.php'; require_once dirname(__FILE__) . '/../../exception/ErrorHandler.php'; diff --git a/tests/layout/ErrorLayoutTest.php b/tests/layout/ErrorLayoutTest.php index 9affe12..7ec97fd 100644 --- a/tests/layout/ErrorLayoutTest.php +++ b/tests/layout/ErrorLayoutTest.php @@ -8,6 +8,8 @@ * @user: agrebnev */ +require_once dirname(__FILE__) . '/../../Registry.php'; +require_once dirname(__FILE__) . '/../../Config.php'; require_once dirname(__FILE__) . '/../../exception/ErrorHandler.php'; require_once dirname(__FILE__) . '/../../exception/GeneralException.php'; require_once dirname(__FILE__) . '/../../app/FrontController.php'; diff --git a/tests/layout/LayoutTest.php b/tests/layout/LayoutTest.php index e7029ea..44038a4 100644 --- a/tests/layout/LayoutTest.php +++ b/tests/layout/LayoutTest.php @@ -10,6 +10,8 @@ * Unit tests for Layout class */ +require_once dirname(__FILE__) . '/../../Registry.php'; +require_once dirname(__FILE__) . '/../../Config.php'; require_once dirname(__FILE__) . '/../../exception/ErrorHandler.php'; require_once dirname(__FILE__) . '/../../app/FrontController.php'; require_once dirname(__FILE__) . '/../../layout/Layout.php'; diff --git a/tests/logger/CliLoggerTest.php b/tests/logger/CliLoggerTest.php index 8874834..ae6fa45 100644 --- a/tests/logger/CliLoggerTest.php +++ b/tests/logger/CliLoggerTest.php @@ -44,7 +44,8 @@ class CliLoggerTest extends PHPUnit_Framework_TestCase public function testLog() { - Config::set('DEBUG', 1); + Config::set('LOGGING', 1); + Config::set('Logger', array('logger' => 'CliLogger')); $logger = Logger::getInstance(); ob_start(); $logger->setPid(123); diff --git a/tests/logger/FileLoggerTest.php b/tests/logger/FileLoggerTest.php index cfe763e..c108f3d 100644 --- a/tests/logger/FileLoggerTest.php +++ b/tests/logger/FileLoggerTest.php @@ -33,6 +33,7 @@ class FileLoggerTest extends PHPUnit_Framework_TestCase vfsStream::setup(); $root = vfsStream::create(array()); vfsStreamWrapper::setRoot($root); + Config::set('LOGGING', 1); $this->conf = array('logger' => 'FileLogger', 'filepath' => vfsStream::url('root/log.txt')); Config::set('Logger', $this->conf); if ($root->hasChild('log.txt')) { diff --git a/tests/model/MongoStatementTest.php b/tests/model/MongoStatementTest.php index a857051..6bcd833 100644 --- a/tests/model/MongoStatementTest.php +++ b/tests/model/MongoStatementTest.php @@ -10,6 +10,8 @@ * Unit tests for MySQLiStatement class */ +require_once dirname(__FILE__) . '/../../Registry.php'; +require_once dirname(__FILE__) . '/../../Config.php'; require_once dirname(__FILE__) . '/../../util/profiler/CommandProfiler.php'; require_once dirname(__FILE__) . '/../../util/profiler/Profiler.php'; require_once dirname(__FILE__) . '/../../model/Db.php'; @@ -168,7 +170,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testExecuteWithDebug() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->setDriverGetConnectionMethod()->setRequestExecuteMethod(); $this->assertTrue($this->stmt->execute()); $this->assertEquals(10, $this->stmt->numRows()); @@ -180,7 +182,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testBindParam() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->request ->expects($this->once()) @@ -201,7 +203,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetch() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod()->setRequestForFetch(); @@ -218,7 +220,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetchWithInitialArray() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod(); @@ -237,7 +239,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetchAssocFromCursor() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod()->setRequestForFetch(); @@ -254,7 +256,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetchAssocFromArray() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod(); @@ -274,7 +276,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetchWrongMode() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod(); @@ -294,7 +296,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testSkipOrderLimit() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->setDriverGetConnectionMethod()->setRequestForFetch(); $this->stmt->execute(); @@ -312,7 +314,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testCount() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->setDriverGetConnectionMethod()->setRequestForFetch(); $this->stmt->execute(); @@ -327,7 +329,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testCountException() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) @@ -345,7 +347,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testOrderException() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) @@ -363,7 +365,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testSkipException() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) @@ -381,7 +383,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testLimitException() { - Config::set('DEBUG', 1; + Config::set('DEBUG', 1); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) diff --git a/tests/model/MySQLiStatementTest.php b/tests/model/MySQLiStatementTest.php index e372c01..e360150 100644 --- a/tests/model/MySQLiStatementTest.php +++ b/tests/model/MySQLiStatementTest.php @@ -10,6 +10,8 @@ * Unit tests for MySQLiStatement class */ +require_once dirname(__FILE__) . '/../../Registry.php'; +require_once dirname(__FILE__) . '/../../Config.php'; require_once dirname(__FILE__) . '/../../util/profiler/CommandProfiler.php'; require_once dirname(__FILE__) . '/../../util/profiler/Profiler.php'; require_once dirname(__FILE__) . '/../../model/Db.php'; diff --git a/tests/redis/RedisDebugTest.php b/tests/redis/RedisDebugTest.php index e79a063..c479daa 100644 --- a/tests/redis/RedisDebugTest.php +++ b/tests/redis/RedisDebugTest.php @@ -10,6 +10,8 @@ * Unit tests for RedisDebug class */ +require_once dirname(__FILE__) . '/../../Registry.php'; +require_once dirname(__FILE__) . '/../../Config.php'; require_once dirname(__FILE__) . '/../../exception/GeneralException.php'; require_once dirname(__FILE__) . '/../../util/profiler/CommandProfiler.php'; require_once dirname(__FILE__) . '/../../util/profiler/Profiler.php'; diff --git a/tests/util/profiler/ProfilerTest.php b/tests/util/profiler/ProfilerTest.php index 3fef636..1e7000d 100644 --- a/tests/util/profiler/ProfilerTest.php +++ b/tests/util/profiler/ProfilerTest.php @@ -10,6 +10,8 @@ * Unit tests for CommandProfiler class */ +require_once dirname(__FILE__) . '/../../../Registry.php'; +require_once dirname(__FILE__) . '/../../../Config.php'; require_once dirname(__FILE__) . '/../../../exception/GeneralException.php'; require_once dirname(__FILE__) . '/../../../util/FirePHPCore-0.3.2/lib/FirePHPCore/fb.php'; require_once dirname(__FILE__) . '/../../../util/profiler/Profiler.php';