/** * @expectedException \RuntimeException */ public function testMapReduceRuntimeExceptionOnError() { $collectionName = 'myCollectionName'; $result = array('ok' => false, 'errmsg' => $errmsg = 'foobarbarfooups'); $mongoDB = $this->getMockBuilder('MongoDB')->disableOriginalConstructor()->getMock(); $mongoDB->expects($this->once())->method('command')->will($this->returnValue($result)); $connection = $this->getMock('Mandango\\ConnectionInterface'); $connection->expects($this->any())->method('getMongoDB')->will($this->returnValue($mongoDB)); $repository = new RepositoryMock($this->mandango); $repository->setCollectionName($collectionName); $repository->setConnection($connection); $repository->mapReduce('foo', 'bar', array('inline' => 1)); }