public function testInitIsolationFromCursorShouldThrowRuntimeExceptionWhenMissingId() { $data = ['test' => 'test']; $mongoCursorMock = $this->getMockBuilder('\\MongoCursor')->disableOriginalConstructor()->getMock(); //Emulate foreach behavior $mongoCursorMock->expects($this->at(0))->method('rewind'); $mongoCursorMock->expects($this->at(1))->method('valid')->will($this->returnValue(true)); $mongoCursorMock->expects($this->at(2))->method('current')->will($this->returnValue($data)); $this->setExpectedException('\\Matryoshka\\Model\\Exception\\RuntimeException'); $this->documentStore->initIsolationFromCursor($this->mongoCollection, $mongoCursorMock); }