Modified tests Mongo, Mysqli, Redis with checking work Profiler (with PROFILER_DETAILS).
This commit is contained in:
@ -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())
|
||||
|
Reference in New Issue
Block a user