public function tearDown() { // Flush redis after each run to prevent side effects try { if ($this->realRedis && $this->realRedis->isConnected()) { $this->realRedis->flushdb(); $this->realRedis->disconnect(); } } catch (Exception $e) { // we don't care about these exceptions } }