/** * @expectedException \Exception * @expectedExceptionMessage Failed to commit the transaction. */ public function testCommandSucceedsButTransactionFailsReturningFalse() { $this->connection->shouldReceive('begin')->once(); $this->connection->shouldReceive('commit')->once()->andReturn(false); $this->connection->shouldReceive('rollback')->once(); $next = function () { // no-op }; $this->middleware->execute(new \stdClass(), $next); }