added butchInsert to mongo model
This commit is contained in:
@ -112,6 +112,26 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
* @runInSeparateProcess
|
||||
* @group Mongo
|
||||
*/
|
||||
public function testBatchInsert()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
$data = array(
|
||||
array('name' => 'first object'),
|
||||
array('name' => 'second object'),
|
||||
array('name' => 'equal object'),
|
||||
array('name' => 'equal object')
|
||||
);
|
||||
$this->model->batchInsert($data);
|
||||
$this->assertEquals(1, $this->model->count(array('name' => 'first object')));
|
||||
$this->assertEquals(2, $this->model->count(array('name' => 'equal object')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @group Mongo
|
||||
*/
|
||||
public function testDeleteAll()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
@ -206,7 +226,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
$this->model->insert(array('_id' => 1, 'name' => 'testbread', 'price' => 3.2, 'quantity' => 10));
|
||||
$this->model->insert(array('_id' => 2, 'name' => 'testbread', 'price' => 12, 'quantity' => 2));
|
||||
$this->assertSame(2, $this->model->count(array('name' => 'testbread')));
|
||||
|
||||
|
||||
$prop->setValue($this->model, false);
|
||||
$this->model->delete(1);
|
||||
$this->assertSame(1, $this->model->count(array('name' => 'testbread')));
|
||||
|
Reference in New Issue
Block a user