|
|
@ -114,7 +114,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testFind() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$this->assertEquals(1, $mongo->find('items', array('name' => 'bread'))->numRows()); |
|
|
@ -143,7 +143,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testOrderSkipLimit() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
|
|
|
@ -180,7 +180,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testCount() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$this->assertEquals(5, $mongo->count('items')); |
|
|
|
$this->assertEquals(2, $mongo->count('items', array('name' => 'eggs'))); |
|
|
@ -193,7 +193,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testCursorCount() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$this->assertEquals(5, $mongo->find('items')->count(5)); |
|
|
|
$this->assertCount(3, $mongo->find('items')->limit(3)->fetchAll()); |
|
|
@ -206,7 +206,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testGet() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$eggs = $mongo->get('items', array('name' => 'eggs'))->fetchObject(); |
|
|
@ -222,7 +222,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testRemove() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$this->assertEquals(1, $mongo->find('items', array('name' => 'bread'))->numRows()); |
|
|
@ -238,7 +238,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testInsert() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$this->assertEquals(1, $mongo->find('items', array('name' => 'bread'))->numRows()); |
|
|
@ -255,7 +255,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testBatchInsert() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$data = array( |
|
|
|
array('name' => 'first object'), |
|
|
@ -276,7 +276,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testGetInsertId() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$this->assertEquals(0, $mongo->getInsertId()); |
|
|
@ -298,7 +298,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testUpdate() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$this->assertEquals(1, $mongo->find('items', array('name' => 'bread'))->numRows()); |
|
|
@ -316,7 +316,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testUpsert() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
|
|
|
@ -331,7 +331,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testFindAndModify() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
|
|
|
@ -347,7 +347,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testFindAndModifyNoItem() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
|
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
|
|
|
@ -363,7 +363,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testEvalCommand() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$result = $mongo->command('items', array('$eval' => 'function() { return db.items.count();}')); |
|
|
|
$this->assertEquals(5, $result->fetch()); |
|
|
@ -378,7 +378,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testEval() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$result = $mongo->command('items', array('$eval' => 'function() {return true; }')); |
|
|
|
$this->assertTrue($result->fetch()); |
|
|
@ -394,7 +394,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testCommand() |
|
|
|
{ |
|
|
|
Config::set('DEBUG', 0); |
|
|
|
Config::set('DEBUG', false); |
|
|
|
$mongo = new MongoDriver($this->conf); |
|
|
|
$result = $mongo->command('items', array('distinct' => 'items', 'key' => 'name')); |
|
|
|
$this->assertEquals(4, count($result->fetch(DB::FETCH_ASSOC))); |
|
|
|