/** * @expectedException PHPUnit_Framework_Error */ public function testPrevError() { $m = new Mongo(); $m->resetError(); $err = $m->prevError(); $this->assertEquals($err['err'], null); $this->assertEquals($err['n'], 0); $this->assertEquals($err['nPrev'], -1); $this->assertEquals((bool)$err['ok'], true); $m->forceError(); $err = $m->prevError(); $this->assertNotNull($err['err']); $this->assertEquals($err['n'], 0); $this->assertEquals($err['nPrev'], 1); $this->assertEquals((bool)$err['ok'], true); }