Using late static binding makes it possible to override SS_Log to create
logs which are separate to the main Silverstripe log but still use the
built in functionality.
Add test for SS_Log subclassing.
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.
In the case of errors arising during setUp or setUpOnce a unit test will fail to run any individual tests. However, this situation was incorrectly being reported as a test pass (as no tests were run, thus no tests had errors). E.g. the output of a test run that raised an error during setUp would be "0 tests run: 0 passes, 0 failures, and 0 incomplete" with a green background.
To rectify this the following fixes were made:
- Non-cleanly ended tests and test suites are now automatically ended at the end of the test run, as well as at the beginning of subsequent test/suites. This should make catching of errors a lot more robust.
- Errors raised during setup are now no longer lost to the mist of time. The test suite itself will record any error status which was generated outside the scope of any individual tests.
- An additional "errors" count is added to the output at the end of test running. For example, in the case where setup failed and no tests could be run the error would be written to the browser (along with stacktrace) with a message similar to "0 tests run: 0 passes, 0 failures, and 0 incomplete with 1 errors". The intent of this is to separate the concepts of failed/succeeded/incomplete tests from any errors which may have arisen. I.e. no tests "failed" due to the error, but the test run itself is highlighted as an error (red background on the output).
This problem has been a severe cause of issue when testing code that interacts with the database, as any database error during setup would refuse to be shown.
Attempt to create the path a log file will be written to before blindly
attempting to write the file. This makes dynamically named log paths
(i.e. rotation by date) possible.
This is now the default setting for both "sake" and "phpunit"
runs, because of performance reasons (every manifest flush takes
multiple seconds). On the other hand, we want to make errors
like missing classes more obvious to developers.
See discussion in https://github.com/silverstripe/sapphire/pull/620
Use third party tools like XHProf instead.
Removed defunct or unnecessary debug GET parameters:
debug_profile, debug_memory, profile_trace, debug_javascript, debug_behaviour
Installation problems often come down to a 'white screen of death' either during installation or after it. The WSOD is generally caused by a PHP error that isn't picked up by SilverStripe's error handler. This change fixes the first of those.
As a bigger fix, I'd like to see us allow the installation of sites in dev mode, the enabling of display_errors=on in dev mode, and perhaps even the ability to easily perform an initial installation in dev mode before switching to live mode. However, that's a bigger change for another time.