Commit c0c3ae6
committed
fix(tests): Add tearDown to encryption tests to prevent state pollution
Fixes 375 PHPUnit errors in php8.2-s3-minio CI caused by encryption
tests not cleaning up their state, polluting subsequent tests.
Root Cause:
- 5 tests using EncryptionTrait enable encryption but have NO tearDown
- After tests complete, encryption_enabled remains 'yes'
- EncryptionWrapper sees encryption enabled for ALL subsequent tests
- Tests without encryption keys fail with "multikeyencryption failed"
Tests Fixed:
1. apps/encryption/tests/EncryptedStorageTest.php
2. apps/encryption/tests/Command/FixEncryptedVersionTest.php
3. apps/files_sharing/tests/EncryptedSizePropagationTest.php
4. apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php
5. apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php
Fix:
Add tearDown() method to each test that calls tearDownEncryptionTrait(),
which restores encryption_enabled to its previous value.
Also Fixed:
- tests/lib/Encryption/EncryptionWrapperTest.php: Mock isEnabled() for
tests that expect wrapper to be applied
Testing:
- Local full suite run: 0 encryption errors (vs 375 in CI)
- Encryption state properly restored after tests
- ViewTest passes after encryption tests run
Impact:
- Prevents test state pollution in CI
- Each test properly cleans up encryption configuration
- No functional changes to production code
Signed-off-by: Stephen Cuppett <[email protected]>1 parent f32a1d2 commit c0c3ae6
File tree
5 files changed
+25
-0
lines changed- apps
- dav/tests/unit/Connector/Sabre/RequestTest
- encryption/tests
- Command
- files_sharing/tests
5 files changed
+25
-0
lines changedLines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
393 | 398 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
42 | 47 | | |
0 commit comments