diff --git a/tests/model/MongoStatementTest.php b/tests/model/MongoStatementTest.php index 5a854ac..bef39ef 100644 --- a/tests/model/MongoStatementTest.php +++ b/tests/model/MongoStatementTest.php @@ -51,7 +51,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase ->getMock(); $this->request = $this->getMockBuilder('MongoDbCommandMock') ->disableOriginalConstructor() - ->setMethods(array('execute', 'bindParam', 'getInsertId')) + ->setMethods(array('execute', 'bindParam', 'getInsertId', '__toString')) ->getMock(); $this->stmt = new MongoStatement($this->driver, $this->request); } @@ -63,7 +63,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testAffectedNumRowsNoResult() { - Config::set('DEBUG', false); + Config::set('PROFILER_DETAILS', false); $this->assertFalse($this->stmt->affectedRows()); $this->assertFalse($this->stmt->numRows()); @@ -82,7 +82,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testAffectedNumRows() { - Config::set('DEBUG', false); + Config::set('PROFILER_DETAILS', false); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) @@ -98,7 +98,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testGetInsertId() { - Config::set('DEBUG', false); + Config::set('PROFILER_DETAILS', false); $this->setDriverGetConnectionMethod(); $this->request = $this->getMockBuilder('InsertMongoCommand') @@ -127,7 +127,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testExecute() { - Config::set('DEBUG', false); + Config::set('PROFILER_DETAILS', false); $this->setDriverGetConnectionMethod()->setRequestExecuteMethod(); $this->assertTrue($this->stmt->execute()); @@ -139,7 +139,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testExecuteNoResult() { - Config::set('DEBUG', false); + Config::set('PROFILER_DETAILS', false); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->any()) @@ -155,7 +155,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testExecuteNoConnection() { - Config::set('DEBUG', false); + Config::set('PROFILER_DETAILS', false); $this->driver ->expects($this->any()) ->method('getConnection') @@ -170,10 +170,12 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testExecuteWithDebug() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->setDriverGetConnectionMethod()->setRequestExecuteMethod(); $this->assertTrue($this->stmt->execute()); $this->assertEquals(10, $this->stmt->numRows()); + $this->assertContains('Queries: 1', Profiler::getInstance()->getCli()); } /** @@ -182,7 +184,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testBindParam() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->request ->expects($this->once()) @@ -203,7 +206,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetch() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod()->setRequestForFetch(); @@ -220,7 +224,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetchWithInitialArray() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod(); @@ -239,7 +244,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetchAssocFromCursor() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod()->setRequestForFetch(); @@ -256,7 +262,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetchAssocFromArray() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod(); @@ -276,7 +283,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testFetchWrongMode() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->assertFalse($this->stmt->fetch()); $this->setDriverGetConnectionMethod(); @@ -296,7 +304,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testSkipOrderLimit() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->setDriverGetConnectionMethod()->setRequestForFetch(); $this->stmt->execute(); @@ -314,7 +323,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testCount() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->setDriverGetConnectionMethod()->setRequestForFetch(); $this->stmt->execute(); @@ -329,7 +339,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testCountException() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) @@ -347,7 +358,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testOrderException() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) @@ -365,7 +377,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testSkipException() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) @@ -383,7 +396,8 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase */ public function testLimitException() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->setDriverGetConnectionMethod(); $this->request ->expects($this->once()) diff --git a/tests/model/MySQLiStatementTest.php b/tests/model/MySQLiStatementTest.php index 38b0aba..22c13be 100644 --- a/tests/model/MySQLiStatementTest.php +++ b/tests/model/MySQLiStatementTest.php @@ -211,6 +211,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase $this->setDriverGetConnectionMethod(); $this->stmt->execute(array('place' => 'place_val', 'new' => 'new_val')); $this->assertSame('OBJECT', $this->stmt->fetch()); + $this->assertContains('Queries: 1', Profiler::getInstance()->getCli()); } /** diff --git a/tests/redis/RedisManagerTest.php b/tests/redis/RedisManagerTest.php index 37fd50c..1e60837 100644 --- a/tests/redis/RedisManagerTest.php +++ b/tests/redis/RedisManagerTest.php @@ -1,4 +1,4 @@ - @@ -107,7 +107,8 @@ class RedisManagerTest extends PHPUnit_Framework_TestCase */ public function testConnectWithDebug() { - Config::set('DEBUG', true); + Config::set('PROFILER', true); + Config::set('PROFILER_DETAILS', true); $this->getMock('RedisDebug'); Config::set('Redis', array('new' => array('host' => true, 'port' => 2023, 'database' => true)));