From f59e1f0ad4adabf3a8357119083d9cc1899880d5 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 15 Nov 2022 17:25:36 +1300 Subject: [PATCH] API Stop using deprecated API --- src/Dev/Tasks/FileMigrationHelper.php | 4 +- .../Tasks/NormaliseAccessMigrationHelper.php | 4 +- src/Dev/TestAssetStore.php | 3 +- src/FileMigrationHelper.php | 4 + src/FilenameParsing/LegacyFileIDHelper.php | 8 +- src/ImageBackendFactory.php | 10 +- src/Upload_Validator.php | 9 +- .../php/Dev/Tasks/FileMigrationHelperTest.php | 12 +- .../Tasks/FixFolderPermissionsHelperTest.php | 4 + .../LegacyThumbnailMigrationHelperTest.php | 10 + .../NormaliseAccessMigrationHelperTest.php | 100 +++++++ ...eAccessMigrationHelperWithHashPathTest.php | 7 + ...essMigrationHelperWithKeepArchivedTest.php | 4 + .../Tasks/SecureAssetsMigrationHelperTest.php | 15 + .../Dev/Tasks/TagsToShortcodeHelperTest.php | 24 ++ tests/php/FileTest.php | 4 + .../FilenameParsing/FileIDHelperTester.php | 23 ++ .../LegacyFileIDHelperTest.php | 10 +- .../MigrationLegacyFileIDHelperTest.php | 10 +- .../RedirectKeepArchiveFileControllerTest.php | 1 - .../Shortcodes/FileShortcodeProviderTest.php | 2 +- tests/php/Storage/AssetStoreTest.php | 266 +++++++++++++++++- tests/php/Storage/DBFileTest.php | 2 +- tests/php/VersionedFilesMigratorTest.php | 7 +- 24 files changed, 515 insertions(+), 28 deletions(-) diff --git a/src/Dev/Tasks/FileMigrationHelper.php b/src/Dev/Tasks/FileMigrationHelper.php index 3ee175b1..32842e1d 100644 --- a/src/Dev/Tasks/FileMigrationHelper.php +++ b/src/Dev/Tasks/FileMigrationHelper.php @@ -62,7 +62,9 @@ class FileMigrationHelper public function __construct() { - Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + Deprecation::withNoReplacement(function () { + Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); $this->logger = new NullLogger(); } diff --git a/src/Dev/Tasks/NormaliseAccessMigrationHelper.php b/src/Dev/Tasks/NormaliseAccessMigrationHelper.php index fe7bda67..20af05c8 100644 --- a/src/Dev/Tasks/NormaliseAccessMigrationHelper.php +++ b/src/Dev/Tasks/NormaliseAccessMigrationHelper.php @@ -91,7 +91,9 @@ class NormaliseAccessMigrationHelper */ public function __construct($base = '') { - Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + Deprecation::withNoReplacement(function () { + Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS); + }); $this->logger = new NullLogger(); if ($base) { $this->basePath = $base; diff --git a/src/Dev/TestAssetStore.php b/src/Dev/TestAssetStore.php index c4f354df..d78cdefa 100644 --- a/src/Dev/TestAssetStore.php +++ b/src/Dev/TestAssetStore.php @@ -90,8 +90,7 @@ public static function activate($basedir) Injector::inst()->registerService($generated, GeneratedAssetHandler::class); Requirements::backend()->setAssetHandler($generated); - // Disable legacy and set defaults - FlysystemAssetStore::config()->set('legacy_filenames', false); + // Set defaults Director::config()->set('alternate_base_url', '/'); DBFile::config()->set('force_resample', false); File::config()->set('force_resample', false); diff --git a/src/FileMigrationHelper.php b/src/FileMigrationHelper.php index bed8e6d0..9b28d17b 100644 --- a/src/FileMigrationHelper.php +++ b/src/FileMigrationHelper.php @@ -1,5 +1,9 @@ failNewerVariant = $failNewerVariant; } diff --git a/src/ImageBackendFactory.php b/src/ImageBackendFactory.php index 8cea50b9..81738ff7 100644 --- a/src/ImageBackendFactory.php +++ b/src/ImageBackendFactory.php @@ -37,21 +37,21 @@ public function __construct(Factory $creator) */ public function create($service, array $params = []) { - /** @var AssetContainer */ - $store = reset($params); - if (!$store instanceof AssetContainer) { + /** @var AssetContainer $assetContainer */ + $assetContainer = reset($params); + if (!$assetContainer instanceof AssetContainer) { throw new BadMethodCallException("Can only create Image_Backend for " . AssetContainer::class); } // Check cache - $key = sha1($store->getHash().'-'.$store->getVariant()); + $key = sha1($assetContainer->getHash().'-'.$assetContainer->getVariant()); if (array_key_exists($key, $this->cache ?? [])) { return $this->cache[$key]; } // Verify file exists before creating backend $backend = null; - if ($store->exists() && $store->getIsImage()) { + if ($assetContainer->exists() && $assetContainer->getIsImage()) { $backend = $this->creator->create($service, $params); } diff --git a/src/Upload_Validator.php b/src/Upload_Validator.php index 67451b70..5a25e739 100644 --- a/src/Upload_Validator.php +++ b/src/Upload_Validator.php @@ -2,6 +2,7 @@ namespace SilverStripe\Assets; +use SilverStripe\Core\Convert; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Injector\Injectable; @@ -121,8 +122,8 @@ public function getAllowedMaxFileSize($ext = null) $this->setAllowedMaxFileSize($fileSize); } else { // When no default is present, use maximum set by PHP - $maxUpload = File::ini2bytes(ini_get('upload_max_filesize')); - $maxPost = File::ini2bytes(ini_get('post_max_size')); + $maxUpload = Convert::memstring2bytes(ini_get('upload_max_filesize')); + $maxPost = Convert::memstring2bytes(ini_get('post_max_size')); $this->setAllowedMaxFileSize(min($maxUpload, $maxPost)); } } @@ -165,7 +166,7 @@ public function setAllowedMaxFileSize($rules) if (is_numeric($value)) { $tmpSize = $value; } else { - $tmpSize = File::ini2bytes($value); + $tmpSize = Convert::memstring2bytes($value); } $finalRules[$rule] = (int)$tmpSize; @@ -173,7 +174,7 @@ public function setAllowedMaxFileSize($rules) $this->allowedMaxFileSize = $finalRules; } elseif (is_string($rules)) { - $this->allowedMaxFileSize['*'] = File::ini2bytes($rules); + $this->allowedMaxFileSize['*'] = Convert::memstring2bytes($rules); } elseif ((int)$rules > 0) { $this->allowedMaxFileSize['*'] = (int)$rules; } diff --git a/tests/php/Dev/Tasks/FileMigrationHelperTest.php b/tests/php/Dev/Tasks/FileMigrationHelperTest.php index 6f4000cc..4fa31290 100644 --- a/tests/php/Dev/Tasks/FileMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/FileMigrationHelperTest.php @@ -18,8 +18,7 @@ use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injector; -use SilverStripe\Dev\SapphireTest; -use SilverStripe\ORM\Queries\SQLUpdate; +use SilverStripe\Dev\Deprecation; /** * Ensures that File dataobjects can be safely migrated from 3.x @@ -176,6 +175,9 @@ protected function tearDown(): void */ public function testMigration() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->preCondition(); // The EXE file, extensionless file and missing file won't be migrated @@ -428,6 +430,9 @@ private function missingFiles() */ public function testMigrationWithLegacyFilenames() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } Config::modify()->set(FlysystemAssetStore::class, 'legacy_filenames', true); $this->testMigration(); } @@ -438,6 +443,9 @@ public function testMigrationWithLegacyFilenames() */ public function testInvalidAssetStoreStrategy() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $strategy = FileIDHelperResolutionStrategy::create(); $strategy->setDefaultFileIDHelper(new HashFileIDHelper()); $strategy->setResolutionFileIDHelpers([new HashFileIDHelper()]); diff --git a/tests/php/Dev/Tasks/FixFolderPermissionsHelperTest.php b/tests/php/Dev/Tasks/FixFolderPermissionsHelperTest.php index 341a50bc..b68d0167 100644 --- a/tests/php/Dev/Tasks/FixFolderPermissionsHelperTest.php +++ b/tests/php/Dev/Tasks/FixFolderPermissionsHelperTest.php @@ -3,6 +3,7 @@ namespace SilverStripe\Assets\Tests\Dev\Tasks; use SilverStripe\Assets\Folder; +use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\Tasks\FixFolderPermissionsHelper; @@ -15,6 +16,9 @@ class FixFolderPermissionsHelperTest extends SapphireTest public function testTask() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $task = new FixFolderPermissionsHelper(); $updated = $task->run(); diff --git a/tests/php/Dev/Tasks/LegacyThumbnailMigrationHelperTest.php b/tests/php/Dev/Tasks/LegacyThumbnailMigrationHelperTest.php index f696442e..e32eac06 100644 --- a/tests/php/Dev/Tasks/LegacyThumbnailMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/LegacyThumbnailMigrationHelperTest.php @@ -11,6 +11,7 @@ use SilverStripe\Assets\Storage\AssetStore; use SilverStripe\Assets\Tests\Dev\Tasks\FileMigrationHelperTest\Extension; use SilverStripe\Core\Convert; +use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\SapphireTest; class LegacyThumbnailMigrationHelperTest extends SapphireTest @@ -73,6 +74,9 @@ protected function tearDown(): void */ public function testMigratesWithExistingThumbnailInNewLocation($coreVersion) { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var TestAssetStore $store */ $store = singleton(AssetStore::class); // will use TestAssetStore @@ -105,6 +109,9 @@ public function testMigratesWithExistingThumbnailInNewLocation($coreVersion) */ public function testMigratesMultipleFilesInSameFolder($coreVersion) { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var TestAssetStore $store */ $store = singleton(AssetStore::class); // will use TestAssetStore @@ -148,6 +155,9 @@ public function testMigratesMultipleFilesInSameFolder($coreVersion) */ public function testMigrate($fixtureId, $formats, $coreVersion) { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var TestAssetStore $store */ $store = singleton(AssetStore::class); // will use TestAssetStore diff --git a/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperTest.php b/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperTest.php index baa41062..460dfe79 100644 --- a/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperTest.php @@ -14,6 +14,7 @@ use SilverStripe\Assets\Folder; use SilverStripe\Assets\Image; use SilverStripe\Assets\Storage\AssetStore; +use SilverStripe\Dev\Deprecation; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\SapphireTest; @@ -74,6 +75,9 @@ protected function tearDown(): void */ public function testSanityCheck() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); @@ -114,6 +118,9 @@ private function getHelper() public function testNeedToMoveWithFolder() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->expectException(\InvalidArgumentException::class); /** @var File $file */ $folder = Folder::find('Uploads'); @@ -123,6 +130,9 @@ public function testNeedToMoveWithFolder() public function testNeedToMovePublishedNoRestrictionFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::ANYONE; @@ -147,6 +157,9 @@ public function testNeedToMovePublishedNoRestrictionFile() public function testNeedToMovePublishedRestrictedFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::LOGGED_IN_USERS; @@ -171,6 +184,9 @@ public function testNeedToMovePublishedRestrictedFile() public function testNeedToMoveMetaChangedOnlyNoRestrictionFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::ANYONE; @@ -199,6 +215,9 @@ public function testNeedToMoveMetaChangedOnlyNoRestrictionFile() public function testNeedToMoveMetaChangedOnlyRestrictedFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::LOGGED_IN_USERS; @@ -227,6 +246,9 @@ public function testNeedToMoveMetaChangedOnlyRestrictedFile() public function testNeedToMoveDraftNoRestrictionFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->doUnpublish(); @@ -252,6 +274,9 @@ public function testNeedToMoveDraftNoRestrictionFile() public function testNeedToMoveDraftRestrictedFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->doUnpublish(); @@ -277,6 +302,9 @@ public function testNeedToMoveDraftRestrictedFile() public function testNeedToMoveUnrestrictedMixedDraftLiveFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::ANYONE; @@ -318,6 +346,9 @@ public function testNeedToMoveUnrestrictedMixedDraftLiveFile() public function testNeedToMoveRestrictedMixedDraftLiveFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::LOGGED_IN_USERS; @@ -358,6 +389,9 @@ public function testNeedToMoveRestrictedMixedDraftLiveFile() public function testNeedToMoveRestrictedLiveFileUnrestrictedDraft() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::LOGGED_IN_USERS; @@ -389,6 +423,9 @@ public function testNeedToMoveRestrictedLiveFileUnrestrictedDraft() */ public function testNeedToMoveUnrestrictedLiveFileRestrictedDraft() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::ANYONE; @@ -418,6 +455,9 @@ public function testNeedToMoveUnrestrictedLiveFileRestrictedDraft() */ public function testNeedToMoveRestrictedLiveUnrestrictedDraft() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::LOGGED_IN_USERS; @@ -443,6 +483,9 @@ public function testNeedToMoveRestrictedLiveUnrestrictedDraft() public function testNeedToMoveFileInProtectedFolder() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'secret'); $file->doUnpublish(); @@ -479,6 +522,9 @@ public function testNeedToMoveFileInProtectedFolder() public function testNeedToMoveRenamedFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::ANYONE; @@ -503,6 +549,9 @@ public function testNeedToMoveRenamedFile() public function testNeedToMoveReplacedRenamedFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::ANYONE; @@ -536,6 +585,9 @@ public function testNeedToMoveReplacedRenamedFile() public function testFindBadFilesWithProtectedDraft() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ foreach (File::get()->exclude('ClassName', Folder::class) as $file) { $file->protectFile(); @@ -549,6 +601,9 @@ public function testFindBadFilesWithProtectedDraft() public function testFindBadFilesWithPublishedDraft() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ foreach (File::get()->exclude('ClassName', Folder::class) as $file) { $file->publishFile(); @@ -568,6 +623,9 @@ public function testFindBadFilesWithPublishedDraft() public function testFindBadFilesWithProtectedLive() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ foreach (File::get()->exclude('ClassName', Folder::class) as $file) { $file->publishSingle(); @@ -583,6 +641,9 @@ public function testFindBadFilesWithProtectedLive() public function testFindBadFilesWithPublishedLive() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ foreach (File::get()->exclude('ClassName', Folder::class) as $file) { $file->publishSingle(); @@ -602,6 +663,9 @@ public function testFindBadFilesWithPublishedLive() public function testFindBadFilesWithMultiPublishedVersions() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ foreach (File::get()->exclude('ClassName', Folder::class) as $file) { $file->publishSingle(); @@ -630,6 +694,9 @@ public function testFindBadFilesWithMultiPublishedVersions() public function testNeedToMoveNonExistentFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->expectException(\LogicException::class); /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); @@ -644,6 +711,9 @@ public function testNeedToMoveNonExistentFile() public function testRun() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ foreach (File::get()->exclude('ClassName', Folder::class) as $file) { $file->publishFile(); @@ -676,6 +746,9 @@ public function testRun() */ public function testRunWithLotsOfFiles() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } // Create a two hundred good files for ($i = 0; $i < 200; $i++) { $file = new File(); @@ -724,6 +797,9 @@ public function testRunWithLotsOfFiles() public function testFixWithProtectedDraftFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->protectFile(); @@ -739,6 +815,9 @@ public function testFixWithProtectedDraftFile() public function testFixWithPublicDraftFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->publishFile(); @@ -754,6 +833,9 @@ public function testFixWithPublicDraftFile() public function testFixWithPublicLiveFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->publishSingle(); @@ -770,6 +852,9 @@ public function testFixWithPublicLiveFile() public function testFixWithProtectedLiveFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->publishSingle(); @@ -786,6 +871,9 @@ public function testFixWithProtectedLiveFile() public function testFixWithPublicRestrictedLiveFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::LOGGED_IN_USERS; @@ -803,6 +891,9 @@ public function testFixWithPublicRestrictedLiveFile() public function testFixWithProtectedRestrictedLiveFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::LOGGED_IN_USERS; @@ -820,6 +911,9 @@ public function testFixWithProtectedRestrictedLiveFile() public function testFixWithUpdatedDraftMetadataFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->publishSingle(); @@ -844,6 +938,9 @@ public function testFixWithUpdatedDraftMetadataFile() public function testFixWithUpdatedDraftFile() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->publishSingle(); @@ -874,6 +971,9 @@ public function testFixWithUpdatedDraftFile() public function testFixWithImageVariants() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var FlysystemAssetStore $store */ $store = Injector::inst()->get(AssetStore::class); $public = $store->getPublicFilesystem(); diff --git a/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperWithHashPathTest.php b/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperWithHashPathTest.php index 3fe3cccb..c35afe20 100644 --- a/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperWithHashPathTest.php +++ b/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperWithHashPathTest.php @@ -27,6 +27,7 @@ use SilverStripe\ORM\Queries\SQLUpdate; use SilverStripe\Security\InheritedPermissions; use SilverStripe\Versioned\Versioned; +use SilverStripe\Dev\Deprecation; /** * Ensures that File dataobjects can be safely migrated from 3.x @@ -54,6 +55,9 @@ protected function setUpAssetStore() */ public function testSanityCheck() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); @@ -89,6 +93,9 @@ public function testSanityCheck() public function testFixWithImageVariants() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var FlysystemAssetStore $store */ $store = Injector::inst()->get(AssetStore::class); $public = $store->getPublicFilesystem(); diff --git a/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperWithKeepArchivedTest.php b/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperWithKeepArchivedTest.php index d724faf7..03b210b5 100644 --- a/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperWithKeepArchivedTest.php +++ b/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperWithKeepArchivedTest.php @@ -28,6 +28,7 @@ use SilverStripe\ORM\Queries\SQLUpdate; use SilverStripe\Security\InheritedPermissions; use SilverStripe\Versioned\Versioned; +use SilverStripe\Dev\Deprecation; /** * Ensures that File dataobjects can be safely migrated from 3.x @@ -50,6 +51,9 @@ protected function setUpAssetStore() */ public function testSanityCheck() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); diff --git a/tests/php/Dev/Tasks/SecureAssetsMigrationHelperTest.php b/tests/php/Dev/Tasks/SecureAssetsMigrationHelperTest.php index f74c1bf6..fb17a3f3 100644 --- a/tests/php/Dev/Tasks/SecureAssetsMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/SecureAssetsMigrationHelperTest.php @@ -64,6 +64,9 @@ protected function tearDown(): void */ public function testMigrate($fixture, $htaccess, $expected) { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $helper = new SecureAssetsMigrationHelper(); /** @var TestAssetStore $store */ @@ -125,6 +128,9 @@ public function dataMigrate() public function testHtaccessMatchesExact() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $htaccess = <<markTestSkipped('Test calls deprecated code'); + } $htaccess = <<markTestSkipped('Test calls deprecated code'); + } $htaccess = <<markTestSkipped('Test calls deprecated code'); + } $htaccess = <<markTestSkipped('Test calls deprecated code'); + } $tagsToShortcodeHelper = new TagsToShortcodeHelper(); $tagsToShortcodeHelper->run(); @@ -105,6 +108,9 @@ public function testRewrite() public function testPublishedFileRewrite() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $document = $this->objFromFixture(File::class, 'document'); $image = $this->objFromFixture(Image::class, 'image1'); @@ -116,6 +122,9 @@ public function testPublishedFileRewrite() public function testLivePageRewrite() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } /** @var PseudoPage $newPage */ $newPage = $this->objFromFixture(PseudoPage::class, 'page1'); $newPage->publishSingle(); @@ -158,6 +167,9 @@ public function testLivePageRewrite() public function testRewriteRegularObject() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $tagsToShortcodeHelper = new TagsToShortcodeHelper(); $tagsToShortcodeHelper->run(); @@ -183,6 +195,9 @@ public function testRewriteRegularObject() public function testRewriteSubclassObject() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $tagsToShortcodeHelper = new TagsToShortcodeHelper(); $tagsToShortcodeHelper->run(); @@ -209,6 +224,9 @@ public function testRewriteSubclassObject() public function testStagelessVersionedObject() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } // This is just here to make sure that the logic for converting live content doesn't fall on its face when // encountering a versioned object that does not support stages. @@ -235,6 +253,9 @@ public function testStagelessVersionedObject() */ public function testNewContent($input, $output = false) { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $tagsToShortcodeHelper = new TagsToShortcodeHelper(); $actual = $tagsToShortcodeHelper->getNewContent($input); $this->assertEquals($output ?: $input, $actual); @@ -484,6 +505,9 @@ public function newContentEasyFixDataProvider() */ public function testAmbigiousCleanedName() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $underscoreFile = 3; $trippleUnderscore = 4; diff --git a/tests/php/FileTest.php b/tests/php/FileTest.php index 294635a2..68e9b9c8 100644 --- a/tests/php/FileTest.php +++ b/tests/php/FileTest.php @@ -23,6 +23,7 @@ use SilverStripe\Security\Member; use SilverStripe\Security\PermissionChecker; use SilverStripe\Versioned\Versioned; +use SilverStripe\Dev\Deprecation; /** * Tests for the File class @@ -763,6 +764,9 @@ public function testJoinPaths() */ public function testIni2Bytes($iniValue, $expected) { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->assertSame($expected, File::ini2bytes($iniValue)); } diff --git a/tests/php/FilenameParsing/FileIDHelperTester.php b/tests/php/FilenameParsing/FileIDHelperTester.php index 252e80f1..fc733bbc 100644 --- a/tests/php/FilenameParsing/FileIDHelperTester.php +++ b/tests/php/FilenameParsing/FileIDHelperTester.php @@ -4,6 +4,8 @@ use SilverStripe\Assets\FilenameParsing\FileIDHelper; use SilverStripe\Assets\FilenameParsing\ParsedFileID; use SilverStripe\Dev\SapphireTest; +use SilverStripe\Assets\FilenameParsing\LegacyFileIDHelper; +use SilverStripe\Dev\Deprecation; /** * All the `FileIDHelper` have the exact same signature and very similar structure. Their basic tests will share the @@ -67,6 +69,9 @@ abstract public function variantIn(); public function testBuildFileID($expected, $input) { $help = $this->getHelper(); + if ($help instanceof LegacyFileIDHelper && Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->assertEquals($expected, $help->buildFileID(...$input)); $this->assertEquals($expected, $help->buildFileID(new ParsedFileID(...$input))); } @@ -79,6 +84,9 @@ public function testBuildFileID($expected, $input) public function testDirtyBuildFildID($expected, $input) { $help = $this->getHelper(); + if ($help instanceof LegacyFileIDHelper && Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->assertEquals($expected, $help->buildFileID(new ParsedFileID(...$input), null, null, false)); } @@ -89,6 +97,9 @@ public function testDirtyBuildFildID($expected, $input) public function testCleanFilename($expected, $input) { $help = $this->getHelper(); + if ($help instanceof LegacyFileIDHelper && Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->assertEquals($expected, $help->cleanFilename($input)); } @@ -98,6 +109,9 @@ public function testCleanFilename($expected, $input) public function testParseFileID($input, $expected) { $help = $this->getHelper(); + if ($help instanceof LegacyFileIDHelper && Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $parsedFiledID = $help->parseFileID($input); list($expectedFilename, $expectedHash) = $expected; @@ -117,6 +131,9 @@ public function testParseFileID($input, $expected) public function testParseBrokenFileID($input) { $help = $this->getHelper(); + if ($help instanceof LegacyFileIDHelper && Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $parsedFiledID = $help->parseFileID($input); $this->assertNull($parsedFiledID); } @@ -128,6 +145,9 @@ public function testParseBrokenFileID($input) public function testVariantOf($variantFileID, ParsedFileID $original, $expected) { $help = $this->getHelper(); + if ($help instanceof LegacyFileIDHelper && Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $isVariantOf = $help->isVariantOf($variantFileID, $original); $this->assertEquals($expected, $isVariantOf); } @@ -138,6 +158,9 @@ public function testVariantOf($variantFileID, ParsedFileID $original, $expected) public function testLookForVariantIn(ParsedFileID $original, $expected) { $help = $this->getHelper(); + if ($help instanceof LegacyFileIDHelper && Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $path = $help->lookForVariantIn($original); $this->assertEquals($expected, $path); } diff --git a/tests/php/FilenameParsing/LegacyFileIDHelperTest.php b/tests/php/FilenameParsing/LegacyFileIDHelperTest.php index a176423a..2036d18b 100644 --- a/tests/php/FilenameParsing/LegacyFileIDHelperTest.php +++ b/tests/php/FilenameParsing/LegacyFileIDHelperTest.php @@ -1,11 +1,19 @@ markTestSkipped('Test calls deprecated code'); + } + } protected function getHelper() { diff --git a/tests/php/FilenameParsing/MigrationLegacyFileIDHelperTest.php b/tests/php/FilenameParsing/MigrationLegacyFileIDHelperTest.php index f279f594..a3779ac7 100644 --- a/tests/php/FilenameParsing/MigrationLegacyFileIDHelperTest.php +++ b/tests/php/FilenameParsing/MigrationLegacyFileIDHelperTest.php @@ -1,11 +1,19 @@ markTestSkipped('Test calls deprecated code'); + } + } protected function getHelper() { diff --git a/tests/php/RedirectKeepArchiveFileControllerTest.php b/tests/php/RedirectKeepArchiveFileControllerTest.php index 9562e4eb..3321ace1 100644 --- a/tests/php/RedirectKeepArchiveFileControllerTest.php +++ b/tests/php/RedirectKeepArchiveFileControllerTest.php @@ -11,7 +11,6 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\FunctionalTest; use SilverStripe\Control\HTTPResponse; -use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore; /** * We rerun all the same test in `RedirectFileControllerTest` but with keep_archived_assets on diff --git a/tests/php/Shortcodes/FileShortcodeProviderTest.php b/tests/php/Shortcodes/FileShortcodeProviderTest.php index 05b0ff9e..90c79c5e 100644 --- a/tests/php/Shortcodes/FileShortcodeProviderTest.php +++ b/tests/php/Shortcodes/FileShortcodeProviderTest.php @@ -44,7 +44,7 @@ protected function setUp(): void // Conditional fixture creation in case the 'cms' and 'errorpage' modules are installed if (class_exists(ErrorPage::class)) { - Config::inst()->update(SiteTree::class, 'create_default_pages', true); + Config::inst()->set(SiteTree::class, 'create_default_pages', true); ErrorPage::singleton()->requireDefaultRecords(); } } diff --git a/tests/php/Storage/AssetStoreTest.php b/tests/php/Storage/AssetStoreTest.php index ca36f9da..255b7235 100644 --- a/tests/php/Storage/AssetStoreTest.php +++ b/tests/php/Storage/AssetStoreTest.php @@ -237,6 +237,9 @@ public function testConflictResolution() */ public function testGetOriginalFilename() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $store = new TestAssetStore(); $this->assertEquals( 'directory/lovely-fish.jpg', @@ -395,6 +398,9 @@ public function testGetFileID($fileID, $tuple) */ public function testParseFileID($fileID, $tuple) { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $store = new TestAssetStore(); $result = $store->parseFileID($fileID); if (is_null($tuple)) { @@ -441,6 +447,9 @@ public function testGetMetadata() */ public function testLegacyFilenames() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } Config::modify()->set(FlysystemAssetStore::class, 'legacy_filenames', true); $backend = $this->getBackend(); @@ -555,10 +564,19 @@ public function testDefaultConflictResolution() { $store = $this->getBackend(); - // Disable legacy filenames - Config::modify()->set(FlysystemAssetStore::class, 'legacy_filenames', false); $this->assertEquals(AssetStore::CONFLICT_OVERWRITE, $store->getDefaultConflictResolution(null)); $this->assertEquals(AssetStore::CONFLICT_OVERWRITE, $store->getDefaultConflictResolution('somevariant')); + } + + /** + * Test default conflict resolution for legacy filenames + */ + public function testDefaultConflictResolutionLegacy() + { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } + $store = $this->getBackend(); // Enable legacy filenames -- legacy filename used to have different conflict resolution prior to 1.4.0 Config::modify()->set(FlysystemAssetStore::class, 'legacy_filenames', true); @@ -775,6 +793,9 @@ public function testStoreLocationWritingLogic() public function testGetFilesystemFor() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $store = $this->getBackend(); $publicFs = $store->getPublicFilesystem(); @@ -899,6 +920,98 @@ public function listOfFilesToNormalise() $public = AssetStore::VISIBILITY_PUBLIC; $protected = AssetStore::VISIBILITY_PROTECTED; + /** @var FileIDHelper $hashHelper */ + $hashHelper = new HashFileIDHelper(); + $naturalHelper = new NaturalFileIDHelper(); + + $content = "The quick brown fox jumps over the lazy dog."; + $hash = sha1($content ?? ''); + $filename = 'folder/file.txt'; + $hashPath = $hashHelper->buildFileID($filename, $hash); + + $variant = 'uppercase'; + $vContent = strtoupper($content ?? ''); + $vNatural = $naturalHelper->buildFileID($filename, $hash, $variant); + $vHash = $hashHelper->buildFileID($filename, $hash, $variant); + + return [ + // Main file only + [$public, [$filename => $content], $filename, $hash, [$filename], [$hashPath, dirname($hashPath ?? '')]], + [$public, [$hashPath => $content], $filename, $hash, [$filename], [$hashPath, dirname($hashPath ?? '')]], + [$protected, [$filename => $content], $filename, $hash, [$hashPath], [$filename]], + [$protected, [$hashPath => $content], $filename, $hash, [$hashPath], [$filename]], + + // Main File with variant + [ + $public, + [$filename => $content, $vNatural => $vContent], + $filename, + $hash, + [$filename, $vNatural], + [$hashPath, $vHash, dirname($hashPath ?? '')] + ], + [ + $public, + [$hashPath => $content, $vHash => $vContent], + $filename, + $hash, + [$filename, $vNatural], + [$hashPath, $vHash, dirname($hashPath ?? '')] + ], + [ + $protected, + [$filename => $content, $vNatural => $vContent], + $filename, + $hash, + [$hashPath, $vHash], + [$filename, $vNatural] + ], + [ + $protected, + [$hashPath => $content, $vHash => $vContent], + $filename, + $hash, + [$hashPath, $vHash], + [$filename, $vNatural] + ], + ]; + } + + /** + * @dataProvider listOfFilesToNormalise + * @param string $fsName + * @param array $contents + * @param string $filename + * @param string $hash + * @param array $expected + * @param array $notExpected + */ + public function testNormalise($fsName, array $contents, $filename, $hash, array $expected, array $notExpected = []) + { + $this->writeDummyFiles($fsName, $contents); + + $results = $this->getBackend()->normalise($filename, $hash); + + $this->assertEquals($filename, $results['Filename']); + $this->assertEquals($hash, $results['Hash']); + + $fs = $this->getFilesystem($fsName); + + foreach ($expected as $expectedFile) { + $this->assertTrue($fs->has($expectedFile), "$expectedFile should exists"); + $this->assertNotEmpty($fs->read($expectedFile), "$expectedFile should be non empty"); + } + + foreach ($notExpected as $notExpectedFile) { + $this->assertFalse($fs->has($notExpectedFile), "$notExpectedFile should NOT exists"); + } + } + + public function listOfFilesToNormaliseWithLegacy() + { + $public = AssetStore::VISIBILITY_PUBLIC; + $protected = AssetStore::VISIBILITY_PROTECTED; + /** @var FileIDHelper $hashHelper */ $hashHelper = new HashFileIDHelper(); $naturalHelper = new NaturalFileIDHelper(); @@ -970,7 +1083,7 @@ public function listOfFilesToNormalise() } /** - * @dataProvider listOfFilesToNormalise + * @dataProvider listOfFilesToNormaliseWithLegacy * @param string $fsName * @param array $contents * @param string $filename @@ -978,8 +1091,14 @@ public function listOfFilesToNormalise() * @param array $expected * @param array $notExpected */ - public function testNormalise($fsName, array $contents, $filename, $hash, array $expected, array $notExpected = []) + public function testNormaliseWithLegacy($fsName, array $contents, $filename, $hash, array $expected, array $notExpected = []) { + // This is a duplicate of testNormalise that a dataprovider + // with the deprecated class LegacyFileIDHelper + // Delete the dataprovider at the same time as deleting this test + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->writeDummyFiles($fsName, $contents); $results = $this->getBackend()->normalise($filename, $hash); @@ -1004,6 +1123,135 @@ public function listOfFileIDsToNormalise() $public = AssetStore::VISIBILITY_PUBLIC; $protected = AssetStore::VISIBILITY_PROTECTED; + /** @var FileIDHelper $hashHelper */ + $hashHelper = new HashFileIDHelper(); + $naturalHelper = new NaturalFileIDHelper(); + + $content = "The quick brown fox jumps over the lazy dog."; + $hash = sha1($content ?? ''); + $filename = 'folder/file.txt'; + $hashPath = $hashHelper->buildFileID($filename, $hash); + + $variant = 'uppercase'; + $vContent = strtoupper($content ?? ''); + $vNatural = $naturalHelper->buildFileID($filename, $hash, $variant); + $vHash = $hashHelper->buildFileID($filename, $hash, $variant); + + return [ + // Main file only + [$public, [$filename => $content], $filename, [$filename], [$hashPath, dirname($hashPath ?? '')]], + [$public, [$hashPath => $content], $hashPath, [$filename], [$hashPath, dirname($hashPath ?? '')]], + [$protected, [$filename => $content], $filename, [$hashPath], [$filename]], + [$protected, [$hashPath => $content], $hashPath, [$hashPath], [$filename]], + + // Main File with variant + [ + $public, + [$filename => $content, $vNatural => $vContent], + $filename, + [$filename, $vNatural], + [$hashPath, $vHash, dirname($hashPath ?? '')] + ], + [ + $public, + [$hashPath => $content, $vHash => $vContent], + $hashPath, + [$filename, $vNatural], + [$hashPath, $vHash, dirname($hashPath ?? '')] + ], + [ + $protected, + [$filename => $content, $vNatural => $vContent], + $filename, + [$hashPath, $vHash], + [$filename, $vNatural] + ], + [ + $protected, + [$hashPath => $content, $vHash => $vContent], + $hashPath, + [$hashPath, $vHash], + [$filename, $vNatural] + ], + + // Test files with a parent folder that could be confused for an hash folder + 'natural path in public store with 10-char folder' => [ + $public, + ['multimedia/video.mp4' => $content], + 'multimedia/video.mp4', + ['multimedia/video.mp4'], + [], + 'multimedia/video.mp4' + ], + 'natural path in protected store with 10-char folder' => [ + $protected, + ['multimedia/video.mp4' => $content], + 'multimedia/video.mp4', + [$hashHelper->buildFileID('multimedia/video.mp4', $hash)], + [], + 'multimedia/video.mp4' + ], + 'natural path in public store with 10-hexadecimal-char folder' => [ + $public, + ['0123456789/video.mp4' => $content], + '0123456789/video.mp4', + ['0123456789/video.mp4'], + [], + '0123456789/video.mp4' + ], + 'natural path in protected store with 10-hexadecimal-char folder' => [ + $protected, + ['abcdef7890/video.mp4' => $content], + 'abcdef7890/video.mp4', + [$hashHelper->buildFileID('abcdef7890/video.mp4', $hash)], + [], + 'abcdef7890/video.mp4' + ], + ]; + } + + /** + * @dataProvider listOfFileIDsToNormalise + * @param string $fsName + * @param array $contents + * @param string $fileID + * @param array $expected + * @param array $notExpected + */ + public function testNormalisePath( + $fsName, + array $contents, + $fileID, + array $expected, + array $notExpected = [], + $expectedFilename = 'folder/file.txt' + ) { + $this->writeDummyFiles($fsName, $contents); + + $results = $this->getBackend()->normalisePath($fileID); + + $this->assertEquals($expectedFilename, $results['Filename']); + $this->assertTrue( + strpos(sha1("The quick brown fox jumps over the lazy dog."), $results['Hash'] ?? '') === 0 + ); + + $fs = $this->getFilesystem($fsName); + + foreach ($expected as $expectedFile) { + $this->assertTrue($fs->has($expectedFile), "$expectedFile should exists"); + $this->assertNotEmpty($fs->read($expectedFile), "$expectedFile should be non empty"); + } + + foreach ($notExpected as $notExpectedFile) { + $this->assertFalse($fs->has($notExpectedFile), "$notExpectedFile should NOT exists"); + } + } + + public function listOfFileIDsToNormaliseWithLegacy() + { + $public = AssetStore::VISIBILITY_PUBLIC; + $protected = AssetStore::VISIBILITY_PROTECTED; + /** @var FileIDHelper $hashHelper */ $hashHelper = new HashFileIDHelper(); $naturalHelper = new NaturalFileIDHelper(); @@ -1104,14 +1352,14 @@ public function listOfFileIDsToNormalise() } /** - * @dataProvider listOfFileIDsToNormalise + * @dataProvider listOfFileIDsToNormaliseWithLegacy * @param string $fsName * @param array $contents * @param string $fileID * @param array $expected * @param array $notExpected */ - public function testNormalisePath( + public function testNormalisePathWithLegacy( $fsName, array $contents, $fileID, @@ -1119,6 +1367,12 @@ public function testNormalisePath( array $notExpected = [], $expectedFilename = 'folder/file.txt' ) { + // This is a duplicate of testNormalise that a dataprovider + // with the deprecated class LegacyFileIDHelper + // Delete the dataprovider at the same time as deleting this test + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $this->writeDummyFiles($fsName, $contents); $results = $this->getBackend()->normalisePath($fileID); diff --git a/tests/php/Storage/DBFileTest.php b/tests/php/Storage/DBFileTest.php index f382badd..c23137cd 100644 --- a/tests/php/Storage/DBFileTest.php +++ b/tests/php/Storage/DBFileTest.php @@ -27,7 +27,7 @@ protected function setUp(): void // Set backend TestAssetStore::activate('DBFileTest'); - Director::config()->update('alternate_base_url', '/mysite/'); + Director::config()->set('alternate_base_url', '/mysite/'); } protected function tearDown(): void diff --git a/tests/php/VersionedFilesMigratorTest.php b/tests/php/VersionedFilesMigratorTest.php index 794f4050..90c4a080 100644 --- a/tests/php/VersionedFilesMigratorTest.php +++ b/tests/php/VersionedFilesMigratorTest.php @@ -30,7 +30,6 @@ protected function getBasePath() return ASSETS_PATH . '/VersionedFilesMigrationTest'; } - protected function setUp(): void { parent::setUp(); @@ -57,6 +56,9 @@ protected function tearDown(): void */ public function testMigrationDeletes() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $migrator = VersionedFilesMigrator::create( VersionedFilesMigrator::STRATEGY_DELETE, TestAssetStore::base_path(), @@ -75,6 +77,9 @@ public function testMigrationDeletes() */ public function testMigrationProtects() { + if (Deprecation::isEnabled()) { + $this->markTestSkipped('Test calls deprecated code'); + } $migrator = VersionedFilesMigrator::create( VersionedFilesMigrator::STRATEGY_PROTECT, TestAssetStore::base_path(),