- When calling
file_unmanaged_*()functions in a test, exceptions are thrown, because custom stream wrappers are not properly registered.
- All registered custom stream wrappers of the parent site (test runner) are still registered when executing a (simple)test → they leak into the test environment.
- Tests do not register their own stream wrappers specific to the executed test.
file_get_stream_wrappers()only works for
WebTestBase, after static variables have been reset.
temporarystream wrappers can only work if System module and its configuration has been installed.
- Raw unit tests should not have access to any custom stream wrappers, but currently they do, because the stream wrappers of the test runner environment are leaking into unit tests, too.
Unlike all other global state in Drupal and tests, stream wrappers are a native global state construct of PHP core.
→ The state of registered stream wrappers has to properly managed and maintained manually.
TestBase::prepareEnvironment(), all custom stream wrappers of the parent site are unregistered/removed.
UnitTestBasedoes not get any stream wrappers.
DrupalUnitTestBasegets dedicated methods for managing stream wrappers and it ensures to clean up after itself in
WebTestBaseis not changed.
file_get_stream_wrappers()returns the new set of custom stream wrappers after the test site has been installed.
As stated in(and following), Drupal's Stream Wrapper API needs a major overhaul for D8 to properly maintain the state of registered stream wrappers for a particular
DrupalKernelboot, build, and rebuild.
The concept required for
DrupalKernelessentially has to follow the concept that is introduced for
→ The admittedly ugly workarounds for
file_get_stream_wrappers()should not hold up this patch, because this entire functionality has to be moved into
This issue blocks
→ which in turn blocks
PASSED: [[SimpleTest]]: [MySQL] 63,418 pass(es).
PASSED: [[SimpleTest]]: [MySQL] 63,235 pass(es).
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch test.streams.30.patch. Unable to apply patch. See the log in the details link for more information.