2011-11-15 18:07:01 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @copyright NetMonsters <team@netmonsters.ru>
|
|
|
|
* @link http://netmonsters.ru
|
|
|
|
* @package Majestic
|
|
|
|
* @subpackage UnitTests
|
|
|
|
* @since 2011-11-15
|
|
|
|
*
|
|
|
|
* Unit tests for MySQLiStatement class
|
|
|
|
*/
|
|
|
|
|
2012-06-28 16:18:28 +04:00
|
|
|
require_once dirname(__FILE__) . '/../../Registry.php';
|
|
|
|
require_once dirname(__FILE__) . '/../../Config.php';
|
2011-11-15 18:07:01 +04:00
|
|
|
require_once dirname(__FILE__) . '/../../util/profiler/CommandProfiler.php';
|
|
|
|
require_once dirname(__FILE__) . '/../../util/profiler/Profiler.php';
|
|
|
|
require_once dirname(__FILE__) . '/../../model/Db.php';
|
|
|
|
require_once dirname(__FILE__) . '/../../model/DbDriver.php';
|
|
|
|
require_once dirname(__FILE__) . '/../../model/DbStatement.php';
|
|
|
|
require_once dirname(__FILE__) . '/../../model/MongoStatement.php';
|
2011-12-06 14:05:18 +04:00
|
|
|
require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
|
2011-11-15 18:07:01 +04:00
|
|
|
|
|
|
|
class MongoStatementTest extends PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
private $driver;
|
|
|
|
|
|
|
|
private $stmt;
|
|
|
|
|
|
|
|
private $request;
|
|
|
|
|
|
|
|
private $testData = array(
|
|
|
|
array('one' => 11, 'two' => 12),
|
|
|
|
array('one' => 21, 'two' => 22),
|
|
|
|
array('one' => 31, 'two' => 32),
|
|
|
|
);
|
|
|
|
|
|
|
|
public function run(PHPUnit_Framework_TestResult $result = NULL)
|
|
|
|
{
|
|
|
|
$this->setPreserveGlobalState(false);
|
|
|
|
return parent::run($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
if (!isset($this->stmt)) {
|
|
|
|
$this->driver = $this->getMockBuilder('DbDriverMock')
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
->setMethods(array('getConnection'))
|
|
|
|
->getMock();
|
|
|
|
$this->request = $this->getMockBuilder('MongoDbCommandMock')
|
|
|
|
->disableOriginalConstructor()
|
2012-07-10 17:03:55 +04:00
|
|
|
->setMethods(array('execute', 'bindParam', 'getInsertId', '__toString'))
|
2011-11-15 18:07:01 +04:00
|
|
|
->getMock();
|
|
|
|
$this->stmt = new MongoStatement($this->driver, $this->request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @runInSeparateProcess
|
2011-12-06 16:53:16 +04:00
|
|
|
* @group Mongo
|
2011-11-15 18:07:01 +04:00
|
|
|
*/
|
|
|
|
public function testAffectedNumRowsNoResul |