Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I understand that this isn't really needed, but it does allow us to ensure that all static caches are clear during testing and when the caches are cleared.
Comment | File | Size | Author |
---|---|---|---|
#9 | libraries.flush-statics_0_reroll.patch | 706 bytes | tstoeckler |
#7 | libraries.flush-statics.patch | 581 bytes | tstoeckler |
#4 | libraries.test-cache-reset.4.patch | 485 bytes | sun |
#3 | libraries.flush-statics.patch | 581 bytes | tstoeckler |
static.patch | 1.12 KB | RobLoach | |
Comments
Comment #1
tstoecklerHmm... I'm fine with clearing the 'libraries_get_path' and 'libraries_info' in libraries_flush_caches, I think that's a good idea. I don't think we should be clearing 'libraries_load', though. That would mean that any library, that has been loaded prior to that call of libraries_flush_caches() could be loaded again afterwards, which would wreak terrible havoc. In that specific test, we are just interested in the contents of the $library array, we don't care about the actual files being loaded (twice), so we do that there.
Comment #2
sunhook_flush_caches() is not limited to testing, but invoked whenever drupal_flush_all_caches() is. If we want a helper for testing, then we should add that to a generic base testing class; i.e., LibrariesTestCase.
That said, we should split our tests into multiple test case classes (extending the base LibrariesTestCase) at some point.
Comment #3
tstoecklerSomething like this?
Comment #4
sunWhat I meant was: If this is for testing, then it should be available for testing only.
Overall, the discussion here is a bit hard though, as I don't see an actual use-case currently, so we're kinda designing into the blue.
Comment #5
tstoecklerIf this is seen as related to testing, then I think you're right.
I think flushing static caches in hook_flush_caches() is a good idea and something I would consider best practice, regardless of what we do in the test. I don't think I can come up with an actual use-case where you would want the statics to be reset, but if only for debugging purposes I would like that.
Comment #7
tstoecklerStill can't find anything wrong with #3. Re-uploading to see if it's still green. If so, I will commit this now.
Comment #9
tstoecklerHere we go.
Comment #10
tstoecklerCommitted this to 7.x-2.x (http://drupalcode.org/project/libraries.git/commit/c54270fa35cd78f0a14b2...) and 7.x-3.x (http://drupalcode.org/project/libraries.git/commit/7be5e52bd8f3e845707a0...).
Thanks @RobLoach!!!