/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $m = new Mongo(); $this->object = $m->selectCollection('phpunit', 'c'); $this->object->drop(); // $this->object->start = memory_get_usage(true); }
public function testDrop() { $this->object->storeFile('tests/somefile'); $c = $this->object->chunks->count(); $this->assertGreaterThan(0, $c); $this->assertEquals($this->count(), 1); $this->object->drop(); $this->assertEquals($this->object->chunks->count(), 0); $this->assertEquals($this->object->count(), 0); }
public function testExplainLimit() { $this->object->drop(); for ($i = 0; $i < 100; $i++) { $this->object->save(array("x" => $i)); } $q = array("x" => array('$gt' => 50)); $soft = $this->object->find($q)->limit(20)->explain(); $hard = $this->object->find($q)->limit(-20)->explain(); $this->assertEquals(20, $soft['n']); $this->assertEquals(20, $hard['n']); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $this->object = $this->sharedFixture->selectCollection('phpunit', 'c'); $this->object->drop(); // $this->object->start = memory_get_usage(true); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $m = new Mongo(); $this->object = $m->selectCollection('phpunit', 'c'); $this->object->drop(); }