Commit Graph

55 Commits

Author SHA1 Message Date
Ingo Schommer
aa72425e84 Fixed PHPUnit assertions for incomplete tests in core
Avoid PHPUnit throwing "test didn't run any assertions"
notices in PHP. If nothing else, it keeps test output
looking less broken by default, making it more likely
that actual errors do get noticed.
2012-11-23 15:16:39 +01:00
Sean Harvey
2c5c4886b0 Set method visibility to public in FileNameFilterTest 2012-11-02 14:02:22 +13:00
Sean Harvey
cd29b8c74c Adding additional tests for special characters in FileNameFilterTest 2012-11-02 09:34:34 +13:00
Sean Harvey
1ce279ec9d BUG FileNameFilter should remove any amount of underscores from start of filename
When a user renames a file to "__test.txt" (two underscores or more),
then FileNameFilter will only remove the very first underscore from the
filename. This is not sufficient, as any number of underscores in the
filename will be problematic when Filesystem::sync() is called, it will
remove that File record thinking it's an internal file. This fixes it
so any number of underscores are stripped out at the start of the filename.
2012-10-29 17:07:58 +13:00
Sam Minnee
1f7fc1f76a FIX Remove instances of lines longer than 120c
The entire framework repo (with the exception of system-generated files) has been amended to respect the 120c line-length limit.  This is in preparation for the enforcement of this rule with PHP_CodeSniffer.
2012-09-30 17:18:13 +13:00
Ingo Schommer
e2f073f38a Method visibility according to coding conventions 2012-09-20 10:46:59 +02:00
Will Rossiter
d82b67cf97 ENHANCEMENT: remove dependencies between framework tests and cms module. 2012-06-20 16:28:06 +02:00
Simon Welsh
9bd7765272 API CHANGE Renames Transliterator to SS_Transliterator
The intl extension in PHP 5.4 provides a Transliterator class, which
conflicts with the SilverStripe one. This leads to some really weird
ReflectionExceptions about Transliterator's constructor being
private.
2012-06-15 15:54:47 +12:00
Sean Harvey
5462cdaab2 MINOR Removing "." from the end of validation messages 2012-06-01 13:13:06 +12:00
Sean Harvey
b1e17578c7 API CHANGE Removed assertType() and assertEmpty() workarounds. Use assertInstanceOf()
instead of assertType(), assertEmpty() is available in PHPUnit 3.5+.
PHPUnit 3.4 is no longer supported, so please upgrade your version to
work.

MINOR Removed FullTestSuite which was a workaround for PHPUnit but not
used.
2012-05-09 23:05:39 +12:00
Ingo Schommer
7b18d9d0da MINOR Switching _t() calls from sprintf() to using injection parameters (#7170) 2012-05-01 22:17:00 +02:00
Ingo Schommer
d44f6b3e1f MINOR Removed deprecated usage of $priority argument in _t() calls 2012-04-15 17:17:17 +02:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +12:00
Simon Welsh
f8082e4814 MINOR Add newline to end of files without one 2012-04-15 10:50:19 +12:00
Sean Harvey
898c8f5497 ENHANCEMENT [file_link id=n] shortcode support for file links in HtmlEditorField 2012-03-01 22:20:58 +13:00
Ingo Schommer
1b4dda491a MINOR Moving File->OwnerID setting to model layer 2012-02-08 01:04:56 +01:00
Stig Lindqvist
3c516b7b97 API CHANGE: Refactored GridField modifiers into GridField_ColumnProvider, GridField_HTMLProvider, GridField_ActionProvider, and GridField_DataModifier interfaces, all added as components in the config.
API CHANGE: Simplified state handling so that it's just a key store. Affectors are replaced with GridField_ActionProviders. API CHANGE: Removed GridField state manipulation actions instead opting for GridField_ActionProvider actions.
API CHANGE: Removed support for modifiers that add "body" rows, instead having core support for generating the body rows hardcoded into the GridField.
API CHANGE: Allow modification of columns across the whole GridField with the GridField_ColumnProvider interface.
API CHANGE: Renamed GridField_AlterAction to GridField_Action, and added actionName/args parameters, since it can be used for all actions (including batch actions and row actions)
API CHANGE: Removed GridFieldRow class.
2012-01-09 13:30:34 +13:00
Ingo Schommer
ea7310c36a MINOR Specifically turning off Transliterator in FileNameFilterTest, was assumed to be on regardless of setting (surfaced by d1ebe1ce9) 2011-11-14 16:30:53 +01:00
Ingo Schommer
da0ac49d5f API CHANGE Rewriting underscores to dashes in files uploaded through Upload->load(), Folder->addUploadToFolder() or Image->loadUploadedImage(). Transliterating non-ASCII characters automatically (turn off via FileNameFilter::$default_use_transliterator=false)
ENHANCEMENT New FileNameFilter class for a more customisable way to influence filename filtering in Upload->load(), Folder->addUploadToFolder() or Image->loadUploadedImage()
2011-10-07 14:12:46 +02:00
Ingo Schommer
afeccbc9cb ENHANCEMENT Added File::get_class_for_file_extension() instead of hardcoding it in Folder->constructChild(). Allows for custom classes in files uploaded through core functionality like the Upload and FileField logic. 2011-10-07 14:12:45 +02:00
Ingo Schommer
2870eb9212 MINOR Changed $fixture_path to relative filenames in all sapphire test cases in order to allow easier file moving and less verbosity in tests 2011-03-30 23:04:48 +13:00
Julian Seidenberg
5efdc60029 API-CHANGE: Renaming a folder did not update the folder's filename on the disk. This is now fixed. There is now a one-to-one mapping between a folder and its "Title" label. Files still can have a Title that is different from the Filename (fixes #6088, thanks Pike) 2011-03-30 18:16:16 +13:00
ajshort
a0f66099ed FEATURE: Added the SS_FileFinder class for finding files within a directory true that match a set of rules. 2011-03-24 20:14:42 +11:00
Ingo Schommer
2184acf17d Revert "MINOR Replaced assertType() calls with assertInstanceOf(), deprecated in PHPUnit 3.6 (throws warnings as of 3.5.10)" - cased too many problems with mixed build environments that require PHP 3.4
This reverts commit 65f6104cd6.
2011-03-11 15:06:09 +13:00
Ingo Schommer
65f6104cd6 MINOR Replaced assertType() calls with assertInstanceOf(), deprecated in PHPUnit 3.6 (throws warnings as of 3.5.10) 2011-02-21 18:49:09 +13:00
Sam Minnee
8222d72d39 MINOR #6083 FileTest doesn't remove test folders and files created during test (from r111903)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112943 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 05:06:39 +00:00
Sam Minnee
2dca48ba09 MINOR: Unit test breaks if another module or project extends Folder (from r111669)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112917 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 04:52:20 +00:00
Sam Minnee
d6c1d3b28d MINOR Fixed SQL quoting bug in FolderTest (caused by r111493) (from r111496)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112916 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 04:51:22 +00:00
Sam Minnee
b2624e0012 BUGFIX Moving folder after executing Folder::findOrMake will not set the Filenames properly. Invoking updateFilesystem() in File->onAfterWrite() instead of onBeforeWrite(), and avoid caching in FIle->getRelativePath() (fixes #5994 and #5937, thanks muzdowski) (from r111493)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112908 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 04:00:57 +00:00
Sam Minnee
db8035e1a1 MINOR Added tests for File::getURL() and File::getAbsoluteURL() (from r109066)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112772 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 00:52:57 +00:00
Ingo Schommer
1c54a6dc77 BUGFIX Case insensitive extension checks in File::validate() (fixes #5781, thanks simon_w) (from r107539)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112604 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 03:53:54 +00:00
Ingo Schommer
706553ee95 MINOR Checking that Folder::findOrMake() can create an assets/assets/ folder (from r107276)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112567 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 03:21:41 +00:00
Ingo Schommer
5d5bb2618a API CHANGE Don't reflect changes in File and Folder property setters on filesystem before write() is called, to ensure that validate() applies in all cases. This fixes a problem where File->setName() would circumvent restrictions in File::$allowed_extensions (fixes #5693)
API CHANGE Removed File->resetFilename(), use File->updateFilesystem() to update the filesystem, and File->getRelativePath() to just update the "Filename" property without any filesystem changes (emulating the old $renamePhysicalFile method argument in resetFilename())
API CHANGE Removed File->autosetFilename(), please set the "Filename" property via File->getRelativePath()
MINOR Added unit tests to FileTest and FolderTest (some of them copied from FileTest, to test Folder behaviour separately) (from r107273)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112563 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 03:20:47 +00:00
Ingo Schommer
9d227ba2e4 MINOR Making FileTest->setUp()/tearDown() more resilient against in-test file/folder renames (from r107271)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112560 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 03:16:33 +00:00
Ingo Schommer
8b88f4aaf4 MINOR More identifiable file naming in FileTest (from r107270)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112559 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 03:16:16 +00:00
Ingo Schommer
96d1625102 MINOR Made File::get_file_extension() more readable, and added unit test (from r107267)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112555 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 03:14:59 +00:00
Ingo Schommer
dcb402479a MINOR Added FileTest->testValidateExtension() (related to #5693) (from r106805)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112539 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 03:04:54 +00:00
Ingo Schommer
bf9a3d43f6 MINOR: Unit test fails if the previous build left temp files behind, so they are removed at the start of the test (from r104050)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112330 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-14 23:55:31 +00:00
Sam Minnee
5ba7760f35 MINOR: Compiled duplicate tests
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112138 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-13 03:48:33 +00:00
Sam Minnee
767bfedd30 BUGFIX Fixed Folder writing by overloading validate() (was inheriting File->validate() which does extension checks)
BUGFIX Fixed Folder::findOrMake() not to create "new-folder" through File->setName() if using a trailing slash in the path (which causes an empty name). Added FolderTest to verify this. (from r101266)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111984 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-12 23:02:10 +00:00
Sam Minnee
81ce1e358d BUGFIX Fixed Upload and checking for size with files that don't have any extension (from r101061)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111580 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-04 04:44:03 +00:00
Sam Minnee
2ea0e3e331 BUGFIX #5188 Upload and Folder don't handle the duplicate naming of files that have no extension (from r101050)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111572 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-04 04:42:13 +00:00
Sam Minnee
0abbef5fa3 MINOR UploadTest now cleans up after itself when it creates a custom folder relative to assets (from r100991)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111562 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-04 04:30:14 +00:00
Sam Minnee
7f147f9fab MINOR Added tests for Upload_Validator/UploadTest_Validator for allowed extensions validation (from r100990)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111561 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-04 04:29:58 +00:00
Ingo Schommer
75b98970e4 API CHANGE #5107 Upload now uses Upload_Validator to separate the validation rules from the File loading done in the Upload class (from r100057)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105549 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-05-25 03:42:52 +00:00
Ingo Schommer
f86c05ba08 MINOR Reinstated UploadTest (from r99862)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105540 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-05-25 03:18:49 +00:00
Ingo Schommer
ca2916c948 MINOR: Fixed FileTest execution if the assets/ directory doesn't exist. (from r88353) (from r98086)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102579 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-04-13 02:01:14 +00:00
Ingo Schommer
40899c3bfb BUGFIX: Don't rely on the current working directory for any file access; use BASE_PATH. (from r97728)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102527 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-04-12 23:14:36 +00:00
Sean Harvey
a0c4ddfa4b MINOR Fixed FileTest for changes to getFileType() on the File class
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64362 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-10-16 04:33:35 +00:00
Ingo Schommer
9371f4688b ENHANCEMENT Introduced constants for system paths like /sapphire in preparation for a more flexible directory reorganisation. Instead of hardcoding your path, please use the following constants: BASE_PATH, BASE_URL, SAPPHIRE_DIR, SAPPHIRE_PATH, CMS_DIR, CMS_PATH, THIRDPARTY_DIR, THIRDPARTY_PATH, ASSETS_DIR, ASSETS_PATH, THEMES_DIR, THEMES_PATH
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63154 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-09-27 16:02:38 +00:00