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