diff --git a/composer.json b/composer.json index 8b6faad2..62e89e4a 100644 --- a/composer.json +++ b/composer.json @@ -26,9 +26,8 @@ "league/flysystem": "^1.0.70" }, "require-dev": { + "silverstripe/recipe-testing": "dev-two", "silverstripe/versioned": "^1@dev", - "sminnee/phpunit-mock-objects": "^3.4.5", - "sminnee/phpunit": "^5.7.29", "squizlabs/php_codesniffer": "^3", "mikey179/vfsstream": "^1.6" }, diff --git a/tests/php/AssetControlExtensionTest.php b/tests/php/AssetControlExtensionTest.php index cc12f376..9608f509 100644 --- a/tests/php/AssetControlExtensionTest.php +++ b/tests/php/AssetControlExtensionTest.php @@ -25,7 +25,7 @@ class AssetControlExtensionTest extends SapphireTest TestObject::class ]; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -55,7 +55,7 @@ public function setUp() $object3->publishSingle(); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); @@ -224,7 +224,7 @@ public function testReplaceFile() $this->assertEquals(AssetStore::VISIBILITY_PUBLIC, $object3->Header->getVisibility()); } - + public function testReplaceWithVariant() { $store = $this->getAssetStore(); @@ -250,7 +250,7 @@ public function testReplaceWithVariant() $store->exists($v1->getFilename(), $v1->getHash(), 'boom'), sprintf('A variant of %s has been created', $v1->getFilename()) ); - + // Let's replace the content of the main file and publish it $download->setFromString($v2Content, $v2->getFilename()); $object1->write(); diff --git a/tests/php/Dev/Tasks/FileMigrationHelperTest.php b/tests/php/Dev/Tasks/FileMigrationHelperTest.php index 2ea42fb8..e7f13120 100644 --- a/tests/php/Dev/Tasks/FileMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/FileMigrationHelperTest.php @@ -50,7 +50,7 @@ protected function getBasePath() } - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -164,7 +164,7 @@ function ($args) { )->execute(); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); Filesystem::removeFolder($this->getBasePath()); @@ -283,7 +283,7 @@ private function individualImage(Image $file) $fullFilename = TestAssetStore::base_path() . '/' . $file->getFilename(); $dir = dirname($fullFilename); $baseFilename = basename($fullFilename); - $this->assertFileNotExists($dir . '/_resampled'); + $this->assertFileDoesNotExist($dir . '/_resampled'); $this->assertFileExists($dir . '/' . $baseFilename); // Test that SS3.3 variants have been migrated diff --git a/tests/php/Dev/Tasks/LegacyThumbnailMigrationHelperTest.php b/tests/php/Dev/Tasks/LegacyThumbnailMigrationHelperTest.php index b03ed5a7..515e9043 100644 --- a/tests/php/Dev/Tasks/LegacyThumbnailMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/LegacyThumbnailMigrationHelperTest.php @@ -41,7 +41,7 @@ protected function getBasePath() } - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -61,7 +61,7 @@ public function setUp() } } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); Filesystem::removeFolder($this->getBasePath()); @@ -90,7 +90,7 @@ public function testMigratesWithExistingThumbnailInNewLocation($coreVersion) // Moved contains store relative paths $base = TestAssetStore::base_path(); - $this->assertFileNotExists( + $this->assertFileDoesNotExist( $this->joinPaths($base, $expectedLegacyPath), 'Legacy file has been removed' ); @@ -131,7 +131,7 @@ public function testMigratesMultipleFilesInSameFolder($coreVersion) $base = TestAssetStore::base_path(); foreach ($expected as $expectedLegacyPath => $expectedNewPath) { - $this->assertFileNotExists( + $this->assertFileDoesNotExist( $this->joinPaths($base, $expectedLegacyPath), 'Legacy file has been removed' ); @@ -176,7 +176,7 @@ public function testMigrate($fixtureId, $formats, $coreVersion) $expectedNewPath, 'New file is mapped as expected' ); - $this->assertFileNotExists( + $this->assertFileDoesNotExist( $this->joinPaths($base, $expectedLegacyPath), 'Legacy file has been removed' ); diff --git a/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperTest.php b/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperTest.php index 093e025c..981e4e6b 100644 --- a/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/NormaliseAccessMigrationHelperTest.php @@ -41,7 +41,7 @@ protected function getBasePath() } - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -62,7 +62,7 @@ protected function setUpAssetStore() TestAssetStore::activate('NormaliseAccessMigrationHelperTest/assets'); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); Filesystem::removeFolder($this->getBasePath()); @@ -112,11 +112,9 @@ private function getHelper() return new Helper('/assets/NormaliseAccessMigrationHelperTest/'); } - /** - * @expectedException InvalidArgumentException - */ public function testNeedToMoveWithFolder() { + $this->expectException(\InvalidArgumentException::class); /** @var File $file */ $folder = Folder::find('Uploads'); $helper = $this->getHelper(); @@ -630,11 +628,9 @@ public function testFindBadFilesWithMultiPublishedVersions() ); } - /** - * @expectedException LogicException - */ public function testNeedToMoveNonExistentFile() { + $this->expectException(\LogicException::class); /** @var File $file */ $file = $this->objFromFixture(File::class, 'file1'); $file->CanViewType = InheritedPermissions::LOGGED_IN_USERS; diff --git a/tests/php/Dev/Tasks/SS4FileMigrationHelperTest.php b/tests/php/Dev/Tasks/SS4FileMigrationHelperTest.php index 544593d8..fc6a800c 100644 --- a/tests/php/Dev/Tasks/SS4FileMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/SS4FileMigrationHelperTest.php @@ -45,7 +45,7 @@ class SS4FileMigrationHelperTest extends SapphireTest ] ]; - public function setUp() + protected function setUp(): void { Config::nest(); // additional nesting here necessary Config::modify()->merge(File::class, 'migrate_legacy_file', false); @@ -181,7 +181,7 @@ protected function defineDestinationStrategy() $store->setPublicResolutionStrategy($public); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/Dev/Tasks/SecureAssetsMigrationHelperTest.php b/tests/php/Dev/Tasks/SecureAssetsMigrationHelperTest.php index cbda97e0..f74c1bf6 100644 --- a/tests/php/Dev/Tasks/SecureAssetsMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/SecureAssetsMigrationHelperTest.php @@ -28,7 +28,7 @@ protected function getBasePath() } - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -52,7 +52,7 @@ public function setUp() } } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); Filesystem::removeFolder($this->getBasePath()); diff --git a/tests/php/Dev/Tasks/TagsToShortcodeHelperTest.php b/tests/php/Dev/Tasks/TagsToShortcodeHelperTest.php index 2831765d..3b370571 100644 --- a/tests/php/Dev/Tasks/TagsToShortcodeHelperTest.php +++ b/tests/php/Dev/Tasks/TagsToShortcodeHelperTest.php @@ -44,7 +44,7 @@ protected function getBasePath() return ASSETS_PATH . '/TagsToShortcodeHelperTest'; } - public function setUp() + protected function setUp(): void { parent::setUp(); $this->setupAssetStore(); @@ -67,7 +67,7 @@ private function setupAssetStore() } } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); Filesystem::removeFolder($this->getBasePath()); @@ -84,17 +84,17 @@ public function testRewrite() $documentID = $this->idFromFixture(File::class, 'document'); $imageID = $this->idFromFixture(Image::class, 'image1'); - $this->assertContains( + $this->assertStringContainsString( sprintf('
file link link to file
', $documentID), $newPage->Content ); - $this->assertContains( + $this->assertStringContainsString( sprintf('[image src="/assets/33be1b95cb/myimage.jpg" id="%d"]
', $imageID), $newPage->Content ); - $this->assertContains( + $this->assertStringContainsString( sprintf( '[image src="/assets/33be1b95cb/myimage.jpg" width="64" height="64" id="%d"]
', $imageID @@ -137,17 +137,17 @@ public function testLivePageRewrite() $documentID = $this->idFromFixture(File::class, 'document'); $imageID = $this->idFromFixture(Image::class, 'image1'); - $this->assertContains( + $this->assertStringContainsString( sprintf('file link link to file
', $documentID), $newPage->Content ); - $this->assertContains( + $this->assertStringContainsString( sprintf('[image src="/assets/33be1b95cb/myimage.jpg" id="%d"]
', $imageID), $newPage->Content ); - $this->assertContains( + $this->assertStringContainsString( sprintf( '[image src="/assets/33be1b95cb/myimage.jpg" width="64" height="64" id="%d"]
', $imageID diff --git a/tests/php/FileFinderTest.php b/tests/php/FileFinderTest.php index 03a6b187..d4e0e017 100644 --- a/tests/php/FileFinderTest.php +++ b/tests/php/FileFinderTest.php @@ -35,11 +35,9 @@ public function testBasicOperation() ); } - /** - * @expectedException InvalidArgumentException - */ public function testInvalidOptionThrowsException() { + $this->expectException(\InvalidArgumentException::class); $finder = new FileFinder(); $finder->setOption('this_doesnt_exist', 'ok'); } diff --git a/tests/php/FileNameFilterTest.php b/tests/php/FileNameFilterTest.php index e8c38b0e..4c8ebad8 100644 --- a/tests/php/FileNameFilterTest.php +++ b/tests/php/FileNameFilterTest.php @@ -8,7 +8,7 @@ class FileNameFilterTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/FileTest.php b/tests/php/FileTest.php index dfc3b6fa..33022b2f 100644 --- a/tests/php/FileTest.php +++ b/tests/php/FileTest.php @@ -37,7 +37,7 @@ class FileTest extends SapphireTest MyCustomFile::class ]; - public function setUp() + protected function setUp(): void { parent::setUp(); $this->logInWithPermission('ADMIN'); @@ -70,7 +70,7 @@ public function setUp() } } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/FilenameParsing/FileIDHelperResolutionStrategyTest.php b/tests/php/FilenameParsing/FileIDHelperResolutionStrategyTest.php index 4665954b..07c9fc20 100644 --- a/tests/php/FilenameParsing/FileIDHelperResolutionStrategyTest.php +++ b/tests/php/FilenameParsing/FileIDHelperResolutionStrategyTest.php @@ -30,7 +30,7 @@ class FileIDHelperResolutionStrategyTest extends SapphireTest /** @var Filesystem */ private $fs; - public function setUp() + protected function setUp(): void { parent::setUp(); Sha1FileHashingService::flush(); @@ -49,7 +49,7 @@ public function setUp() Injector::inst()->registerService($this->fs, Filesystem::class . '.public'); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); diff --git a/tests/php/FilenameParsing/HashFileIDHelperTest.php b/tests/php/FilenameParsing/HashFileIDHelperTest.php index f13194b5..616e890f 100644 --- a/tests/php/FilenameParsing/HashFileIDHelperTest.php +++ b/tests/php/FilenameParsing/HashFileIDHelperTest.php @@ -168,11 +168,9 @@ public function variantIn() ]; } - /** - * @expectedException InvalidArgumentException - */ public function testHashlessBuildFileID() { + $this->expectException(\InvalidArgumentException::class); $this->getHelper()->buildFileID('Filename.txt', ''); } } diff --git a/tests/php/FilesystemTest.php b/tests/php/FilesystemTest.php index 62fc2c79..5c436cb0 100644 --- a/tests/php/FilesystemTest.php +++ b/tests/php/FilesystemTest.php @@ -24,7 +24,7 @@ class FilesystemTest extends SapphireTest */ protected $root; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->root = vfsStream::setup( @@ -74,7 +74,7 @@ public function testRemoveFolderWithFiles() Filesystem::removeFolder($folderPath); $this->assertDirectoryNotExists($folderPath); - $this->assertFileNotExists($filePath); + $this->assertFileDoesNotExist($filePath); } public function testRemoveFolderWithSubFolder() @@ -90,7 +90,7 @@ public function testRemoveFolderWithSubFolder() Filesystem::removeFolder($folderPath); $this->assertDirectoryNotExists($folderPath); $this->assertDirectoryNotExists($emptySubfolder); - $this->assertFileNotExists($filePath); + $this->assertFileDoesNotExist($filePath); } public function testRemoveFolderWithFalsyFile() @@ -102,7 +102,7 @@ public function testRemoveFolderWithFalsyFile() Filesystem::removeFolder($folderPath); $this->assertDirectoryNotExists($folderPath); - $this->assertFileNotExists($filePath); + $this->assertFileDoesNotExist($filePath); } public function testRemovedFolderContentsOnly() @@ -121,6 +121,6 @@ public function testRemovedFolderContentsOnly() $this->assertDirectoryExists($folderPath); $this->assertDirectoryNotExists($emptySubfolder); $this->assertDirectoryNotExists($notEmptySubfolder); - $this->assertFileNotExists($filePath); + $this->assertFileDoesNotExist($filePath); } } diff --git a/tests/php/Flysystem/AssetAdapterTest.php b/tests/php/Flysystem/AssetAdapterTest.php index 59afc730..117888e5 100644 --- a/tests/php/Flysystem/AssetAdapterTest.php +++ b/tests/php/Flysystem/AssetAdapterTest.php @@ -17,7 +17,7 @@ class AssetAdapterTest extends SapphireTest protected $originalServer = null; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -38,7 +38,7 @@ public function setUp() $this->originalServer = $_SERVER; } - public function tearDown() + protected function tearDown(): void { if ($this->rootDir) { Filesystem::removeFolder($this->rootDir); @@ -56,19 +56,19 @@ public function testPublicAdapter() $_SERVER['SERVER_SOFTWARE'] = 'Apache/2.2.22 (Win64) PHP/5.3.13'; $adapter = new PublicAssetAdapter($this->rootDir); $this->assertFileExists($this->rootDir . '/.htaccess'); - $this->assertFileNotExists($this->rootDir . '/web.config'); + $this->assertFileDoesNotExist($this->rootDir . '/web.config'); $htaccess = $adapter->read('.htaccess'); $content = $htaccess['contents']; // Allowed extensions set - $this->assertContains('RewriteCond %{REQUEST_URI} !^[^.]*[^\/]*\.(?i:', $content); + $this->assertStringContainsString('RewriteCond %{REQUEST_URI} !^[^.]*[^\/]*\.(?i:', $content); foreach (File::getAllowedExtensions() as $extension) { - $this->assertRegExp('/\b'.preg_quote($extension).'\b/', $content); + $this->assertMatchesRegularExpression('/\b'.preg_quote($extension).'\b/', $content); } // Rewrite rules - $this->assertContains('RewriteRule .* ../index.php [QSA]', $content); - $this->assertContains('RewriteRule error[^\\\\/]*\\.html$ - [L]', $content); + $this->assertStringContainsString('RewriteRule .* ../index.php [QSA]', $content); + $this->assertStringContainsString('RewriteRule error[^\\\\/]*\\.html$ - [L]', $content); // Test flush restores invalid content file_put_contents($this->rootDir . '/.htaccess', '# broken content'); @@ -85,7 +85,7 @@ public function testProtectedAdapter() $_SERVER['SERVER_SOFTWARE'] = 'Apache/2.2.22 (Win64) PHP/5.3.13'; $adapter = new ProtectedAssetAdapter($this->rootDir . '/.protected'); $this->assertFileExists($this->rootDir . '/.protected/.htaccess'); - $this->assertFileNotExists($this->rootDir . '/.protected/web.config'); + $this->assertFileDoesNotExist($this->rootDir . '/.protected/web.config'); // Test url $this->assertEquals('/assets/file.jpg', $adapter->getProtectedUrl('file.jpg')); diff --git a/tests/php/Flysystem/FlysystemAssetStoreTest.php b/tests/php/Flysystem/FlysystemAssetStoreTest.php index 1410a45a..a2f1dc6e 100644 --- a/tests/php/Flysystem/FlysystemAssetStoreTest.php +++ b/tests/php/Flysystem/FlysystemAssetStoreTest.php @@ -41,7 +41,7 @@ class FlysystemAssetStoreTest extends SapphireTest /** @var FileResolutionStrategy */ protected $protectedStrategy; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -136,11 +136,9 @@ public function testPublicFilesystem() $this->assertEquals($this->publicFilesystem, $assetStore->getPublicFilesystem()); } - /** - * @expectedException InvalidArgumentException - */ public function testBadPublicFilesystem() { + $this->expectException(\InvalidArgumentException::class); $assetStore = new FlysystemAssetStore(); $assetStore->setPublicFilesystem($this->protectedFilesystem); } @@ -152,11 +150,9 @@ public function testProtectedFilesystem() $this->assertEquals($this->protectedFilesystem, $assetStore->getProtectedFilesystem()); } - /** - * @expectedException InvalidArgumentException - */ public function testBadProtectedFilesystem() { + $this->expectException(\InvalidArgumentException::class); $assetStore = new FlysystemAssetStore(); $assetStore->setProtectedFilesystem($this->publicFilesystem); } diff --git a/tests/php/Flysystem/FlysystemAssetStoreUpdateResponseTest.php b/tests/php/Flysystem/FlysystemAssetStoreUpdateResponseTest.php index 379a79cf..2827ff95 100644 --- a/tests/php/Flysystem/FlysystemAssetStoreUpdateResponseTest.php +++ b/tests/php/Flysystem/FlysystemAssetStoreUpdateResponseTest.php @@ -26,7 +26,7 @@ class FlysystemAssetStoreUpdateResponseTest extends SapphireTest /** * @skipUpgrade */ - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -59,7 +59,7 @@ public function setUp() $this->hash = substr(sha1('hello'), 0, 10); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/FolderNameFilterTest.php b/tests/php/FolderNameFilterTest.php index 4951d211..66609209 100644 --- a/tests/php/FolderNameFilterTest.php +++ b/tests/php/FolderNameFilterTest.php @@ -8,7 +8,7 @@ class FolderNameFilterTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/FolderTest.php b/tests/php/FolderTest.php index f3ba7b89..eeb78ace 100644 --- a/tests/php/FolderTest.php +++ b/tests/php/FolderTest.php @@ -24,7 +24,7 @@ class FolderTest extends SapphireTest protected static $fixture_file = 'FileTest.yml'; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -66,7 +66,7 @@ public function setUp() } } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); @@ -131,7 +131,7 @@ public function testFindOrMake() ); // Folder does not exist until it contains files - $this->assertFileNotExists( + $this->assertFileDoesNotExist( TestAssetStore::getLocalPath($folder), 'Empty folder does not have a filesystem record automatically' ); diff --git a/tests/php/GDImageTest.php b/tests/php/GDImageTest.php index 024921a6..4e57f66c 100644 --- a/tests/php/GDImageTest.php +++ b/tests/php/GDImageTest.php @@ -11,7 +11,7 @@ class GDImageTest extends ImageTest { - public function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/ImageManipulationTest.php b/tests/php/ImageManipulationTest.php index 2726388f..5c7bf078 100644 --- a/tests/php/ImageManipulationTest.php +++ b/tests/php/ImageManipulationTest.php @@ -29,7 +29,7 @@ class ImageManipulationTest extends SapphireTest { protected static $fixture_file = 'ImageTest.yml'; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -53,7 +53,7 @@ public function setUp() ]); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/ImageTest.php b/tests/php/ImageTest.php index 21485e11..68a744b3 100644 --- a/tests/php/ImageTest.php +++ b/tests/php/ImageTest.php @@ -28,7 +28,7 @@ abstract class ImageTest extends SapphireTest { protected static $fixture_file = 'ImageTest.yml'; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -52,7 +52,7 @@ public function setUp() ]); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); @@ -315,7 +315,7 @@ public function testImageResizeValidate() */ public function testImageResizeInvalid($width, $height, $error) { - $this->expectException(InvalidArgumentException::class); + $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage($error); /** @var Image $image */ $image = $this->objFromFixture(Image::class, 'imageWithoutTitle'); @@ -331,11 +331,9 @@ public function providerTestImageResizeInvalid() ]; } - /** - * @expectedException InvalidArgumentException - */ public function testGenerateImageWithInvalidParameters() { + $this->expectException(\InvalidArgumentException::class); $image = $this->objFromFixture(Image::class, 'imageWithoutTitle'); $image->ScaleHeight('String'); $image->Pad(600, 600, 'XXXXXX'); @@ -348,7 +346,7 @@ public function testCacheFilename() $imageFilename = $imageFirst->getURL(); // Encoding of the arguments is duplicated from cacheFilename $neededPart = 'Pad' . Convert::base64url_encode([200,200,'CCCCCC', 0]); - $this->assertContains($neededPart, $imageFilename, 'Filename for cached image is correctly generated'); + $this->assertStringContainsString($neededPart, $imageFilename, 'Filename for cached image is correctly generated'); } public function testGenerateImageInSameFolderAsOriginal() @@ -404,11 +402,9 @@ public function testVariantParts() ); } - /** - * @expectedException \InvalidArgumentException - */ public function testVariantPartsThrowsOnInvalidName() { + $this->expectException(\InvalidArgumentException::class); /** @var Image $image */ $image = singleton(Image::class); $args = ['foo']; diff --git a/tests/php/ImagickImageTest.php b/tests/php/ImagickImageTest.php index d1194cd5..d9ca5ba3 100644 --- a/tests/php/ImagickImageTest.php +++ b/tests/php/ImagickImageTest.php @@ -11,7 +11,7 @@ class ImagickImageTest extends ImageTest { - public function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/ProtectedFileControllerTest.php b/tests/php/ProtectedFileControllerTest.php index 7047e31c..6ec9903d 100644 --- a/tests/php/ProtectedFileControllerTest.php +++ b/tests/php/ProtectedFileControllerTest.php @@ -20,7 +20,7 @@ class ProtectedFileControllerTest extends FunctionalTest { protected static $fixture_file = 'FileTest.yml'; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -47,7 +47,7 @@ public function setUp() $protectedFile->protectFile(); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/PublicAssetAdapterTest.php b/tests/php/PublicAssetAdapterTest.php index 257c340d..e726b092 100644 --- a/tests/php/PublicAssetAdapterTest.php +++ b/tests/php/PublicAssetAdapterTest.php @@ -8,7 +8,7 @@ class PublicAssetAdapterTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); Director::config()->set( diff --git a/tests/php/RedirectFileControllerTest.php b/tests/php/RedirectFileControllerTest.php index fcbf7da3..14ec74e3 100644 --- a/tests/php/RedirectFileControllerTest.php +++ b/tests/php/RedirectFileControllerTest.php @@ -25,7 +25,7 @@ class RedirectFileControllerTest extends FunctionalTest protected $autoFollowRedirection = false; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -57,7 +57,7 @@ public function setUp() } } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); @@ -216,7 +216,7 @@ public function testRedirectWithDraftFile($fixtureID) public function testRedirectAfterPublishSecondVersion($fixtureID) { $hashHelper = new HashFileIDHelper(); - + /** @var File $file */ $file = $this->objFromFixture(File::class, $fixtureID); $file->publishSingle(); @@ -384,7 +384,7 @@ public function testVariantRedirect($folderFixture, $filename, $ext) $hash = substr($file->getHash(), 0, 10); $ico = $file->ScaleWidth(32); $icoUrl = $ico->getURL(false); - + $suffix = $ico->getVariant(); $response = $this->get($icoUrl); diff --git a/tests/php/RedirectKeepArchiveFileControllerTest.php b/tests/php/RedirectKeepArchiveFileControllerTest.php index 8fb63943..9562e4eb 100644 --- a/tests/php/RedirectKeepArchiveFileControllerTest.php +++ b/tests/php/RedirectKeepArchiveFileControllerTest.php @@ -20,7 +20,7 @@ class RedirectKeepArchiveFileControllerTest extends RedirectFileControllerTest { - public function setUp() + protected function setUp(): void { File::config()->set('keep_archived_assets', true); parent::setUp(); @@ -43,7 +43,7 @@ public function testRedirectAfterUnpublish($fixtureID) ); $file->write(); $v2HashUrl = $file->getURL(false); - + $file->publishSingle(); $v2Url = $file->getURL(false); diff --git a/tests/php/Shortcodes/FileBrokenLinksTest.php b/tests/php/Shortcodes/FileBrokenLinksTest.php index 620664c0..5fefe562 100644 --- a/tests/php/Shortcodes/FileBrokenLinksTest.php +++ b/tests/php/Shortcodes/FileBrokenLinksTest.php @@ -17,7 +17,7 @@ class FileBrokenLinksTest extends SapphireTest EditableObject::class, ]; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -25,7 +25,7 @@ public function setUp() TestAssetStore::activate('FileBrokenLinksTest'); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/Shortcodes/FileLinkTrackingTest.php b/tests/php/Shortcodes/FileLinkTrackingTest.php index f42950f2..1e8dfaaf 100644 --- a/tests/php/Shortcodes/FileLinkTrackingTest.php +++ b/tests/php/Shortcodes/FileLinkTrackingTest.php @@ -19,7 +19,7 @@ class FileLinkTrackingTest extends SapphireTest protected static $fixture_file = "FileLinkTrackingTest.yml"; - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -59,7 +59,7 @@ public function setUp() $page->write(); } - public function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); @@ -77,11 +77,11 @@ public function testFileRenameUpdatesDraftAndPublishedPages() $page->publishRecursive(); // Live and stage pages both have link to public file - $this->assertContains( + $this->assertStringContainsString( '