File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727use OCP \Command \IBus ;
2828use OCP \DB \QueryBuilder \IQueryBuilder ;
2929use OCP \Files \IRootFolder ;
30+ use OCP \IAppConfig ;
3031use OCP \IConfig ;
3132use OCP \IDBConnection ;
3233use OCP \IUserManager ;
@@ -195,6 +196,22 @@ protected function tearDown(): void {
195196 call_user_func ([$ this , $ methodName ]);
196197 }
197198 }
199+
200+ // Clean up encryption state to prevent test pollution
201+ // This ensures encryption_enabled is reset after each test, preventing
202+ // MultiKeyEncryptException failures in subsequent tests when encryption
203+ // is left enabled but user keys don't exist
204+ try {
205+ $ appConfig = Server::get (IAppConfig::class);
206+ $ currentValue = $ appConfig ->getValueBool ('core ' , 'encryption_enabled ' , false );
207+ if ($ currentValue ) {
208+ $ appConfig ->setValueBool ('core ' , 'encryption_enabled ' , false );
209+ $ appConfig ->deleteKey ('core ' , 'default_encryption_module ' );
210+ $ appConfig ->deleteKey ('encryption ' , 'useMasterKey ' );
211+ }
212+ } catch (\Throwable $ e ) {
213+ // Ignore - may be called before bootstrap completes
214+ }
198215 }
199216
200217 /**
You can’t perform that action at this time.
0 commit comments