-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.5 regressions, 4.5, 4.5.1, 4.5.2, 4.5.3, 4.5.4
-
None
-
MOODLE_405_STABLE
It has been impossible to write php unit integration tests with code that calls file_stoarge.php
create_file directly or indirectly since this commit:
72b43c3541e3ce2ff7e88d59490396a5b4bbcb79
I maintain a plugin (tool_ally). We have php unit tests to ensure a custom hook is called when creating files for different module types. This now fails because the create_file function aborts early if phpunit is running.
```
if (defined('PHPUNIT_TEST') && PHPUNIT_TEST)
```
There are two possible fixes I would like to propose:
1) Allow for create_file to be called in a way that the phpunit skip code condition is bypassed
2) Modify file_storage to being a moodle class where it works with dependency injection so that an alternative file_storage class can be used.
I'm happy to make this change and file a PR but would like to know which is the preferred fix.
- has been marked as being related by
-
MDL-84483 after_file_create hook is not run in unit tests
-
- Waiting for integration review
-