added butchInsert to mongo model

This commit is contained in:
Anton Grebnev
2012-01-18 23:30:34 +04:00
parent d1723cb87b
commit 99a528fac3
6 changed files with 118 additions and 18 deletions

View File

@ -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')));