SilverStripe\Assets\Tests\FileTest
Tests for the File class
Synopsis
class FileTest
extends SapphireTest
{
- // members
- protected static string $fixture_file = 'FileTest.yml';
- protected static array $extra_dataobjects = ;
- // methods
- protected void setUp()
- protected void tearDown()
- public void testCreateWithFilenameWithSubfolder()
- public void testGetExtension()
- public void testValidateExtension()
- public void testInvalidImageManipulations()
- public void testAppCategory()
- public void testGetCategoryExtensions()
- public void testAllFilesHaveCategory()
- public void testSetNameChangesFilesystemOnWrite()
- public void testSetParentIDChangesFilesystemOnWrite()
- public void testSetNameWithInvalidExtensionDoesntChangeFilesystem()
- public void testGetURL()
- public void testGetAbsoluteURL()
- public void testNameAndTitleGeneration()
- public void testSizeAndAbsoluteSizeParameters()
- public void testFileType()
- public void testFormatSize()
- public void testDeleteFile()
- public void testRenameFolder()
- public void testRenamesDuplicateFilesInSameFolder()
- public void testSetsEmptyTitleToNameWithoutExtensionAndSpecialCharacters()
- public void testSetsEmptyNameToSingularNameWithoutTitle()
- public void testSetsEmptyNameToTitleIfPresent()
- public void testSetsOwnerOnFirstWrite()
- public void testCanEdit()
- public void testCanView()
- public void testCanCreate()
- public void testJoinPaths()
- public void testIni2Bytes()
- public array ini2BytesProvider()
- protected AssetStore getAssetStore()
- public void testRename()
- public void testGetAllowedExtensions()
- public array allowedExtensionsProvider()
- public void testCanViewReturnsExtendedResult()
- public void testCanViewDelegatesToParentWhenInheritingPermissions()
- public void testCanViewInheritsRecursively()
- public void testCanViewReturnsFalseForAnonymousUsersWithCanViewTypeLoggedInUsers()
- public void testCanViewReturnsFalseForAnonymousUsersWithCanViewTypeOnlyTheseUsers()
- public void testCanViewReturnsTrueForUserInGroupWithCanViewTypeOnlyTheseUsers()
- public void testCanViewFallsBackToCheckingDefaultFilePermissions()
- public void testCanEditReturnsExtendedResult()
- public void testCanEditReturnsTrueForUserWithEditAllPermissions()
- public void testCanEditDelegatesToParentWhenInheritingPermissions()
- public void testCanEditFallsBackToCheckingDefaultFilePermissions()
- public Generator restrictedAccessDataProvider()
- public void testHasRestrictedAccess()
- private void createModifiedFile()
- public void testCreateModifiedFile()
- private void createModifiedFileWithDifferentFilename()
- public void testCreateModifiedFileWithDifferentFilename()
- public void testUnpublishingModifiedDeletesLiveFile()
- public void testUnpublishingModifiedKeepArchivedLiveFile()
- public void testArchivingModifiedDeletesBothPhysicalFiles()
- public void testArchivingModifiedKeepArchivedBothPhysicalFiles()
- public void testUnpublishingModifiedDeletesLiveFileWithDifferentFilename()
- public void testUnpublishingModifiedKeepArchivedLiveFileWithDifferentFilename()
- public void testArchivingModifiedDeletesBothPhysicalFilesWithDifferentFilenames()
- public void testArchivingModifiedKeepArchivedBothPhysicalFilesWithDifferentFilenames()
Hierarchy
Extends
- SilverStripe\Dev\SapphireTest
Tasks
Line | Task |
---|---|
108 | This should be auto-detected, see File->updateFilesystem() |
Members
protected
- $extra_dataobjects
- $fixture_file
Methods
private
protected
public
- allowedExtensionsProvider()
- ini2BytesProvider()
- restrictedAccessDataProvider()
- testAllFilesHaveCategory()
- testAppCategory()
- testArchivingModifiedDeletesBothPhysicalFiles() — Assert that archiving a modified file dataObject removes both physical files
- testArchivingModifiedDeletesBothPhysicalFilesWithDifferentFilenames() — Assert that archiving a modified file dataObject removes both physical files (draft file has a different filename)
- testArchivingModifiedKeepArchivedBothPhysicalFiles() — Assert that archiving a modified file dataObject with keep_archived_assets moves both files to the protected store
- testArchivingModifiedKeepArchivedBothPhysicalFilesWithDifferentFilenames() — Assert that archiving a modified file dataObject with keep_archived_assets moves both physical files to the protected store (draft file has a different filename)
- testCanCreate()
- testCanEdit()
- testCanEditDelegatesToParentWhenInheritingPermissions()
- testCanEditFallsBackToCheckingDefaultFilePermissions()
- testCanEditReturnsExtendedResult()
- testCanEditReturnsTrueForUserWithEditAllPermissions()
- testCanView()
- testCanViewDelegatesToParentWhenInheritingPermissions()
- testCanViewFallsBackToCheckingDefaultFilePermissions()
- testCanViewInheritsRecursively()
- testCanViewReturnsExtendedResult()
- testCanViewReturnsFalseForAnonymousUsersWithCanViewTypeLoggedInUsers()
- testCanViewReturnsFalseForAnonymousUsersWithCanViewTypeOnlyTheseUsers()
- testCanViewReturnsTrueForUserInGroupWithCanViewTypeOnlyTheseUsers()
- testCreateModifiedFile() — Validate the private helper function above works correctly
- testCreateModifiedFileWithDifferentFilename() — Validate the private helper function above works correctly
- testCreateWithFilenameWithSubfolder()
- testDeleteFile()
- testFileType()
- testFormatSize() — Test the File::format_size() method
- testGetAbsoluteURL()
- testGetAllowedExtensions()
- testGetCategoryExtensions()
- testGetExtension()
- testGetURL()
- testHasRestrictedAccess()
- testIni2Bytes() — Test that ini2bytes returns the number of bytes for a PHP ini style size declaration
- testInvalidImageManipulations()
- testJoinPaths()
- testNameAndTitleGeneration()
- testRename()
- testRenameFolder()
- testRenamesDuplicateFilesInSameFolder()
- testSetNameChangesFilesystemOnWrite()
- testSetNameWithInvalidExtensionDoesntChangeFilesystem()
- testSetParentIDChangesFilesystemOnWrite()
- testSetsEmptyNameToSingularNameWithoutTitle()
- testSetsEmptyNameToTitleIfPresent()
- testSetsEmptyTitleToNameWithoutExtensionAndSpecialCharacters()
- testSetsOwnerOnFirstWrite()
- testSizeAndAbsoluteSizeParameters()
- testUnpublishingModifiedDeletesLiveFile() — Assert that unpublishing a modified file dataObject removes the live file only
- testUnpublishingModifiedDeletesLiveFileWithDifferentFilename() — Assert that archiving a modified file dataObject removes the live file only (draft file has a different filename)
- testUnpublishingModifiedKeepArchivedLiveFile() — Assert that unpublishing a modified file dataObject with keep_archived_assets moves the live file to the protected store
- testUnpublishingModifiedKeepArchivedLiveFileWithDifferentFilename() — Assert that archiving a modified file dataObject with keep_archived_assets moves the live file only to the protected store (draft file has a different filename)
- testValidateExtension()