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.
Problem/Motivation
core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css:3
/*
* A sample css file, designed to test the effectiveness and stability
* of function <code>drupal_load_stylesheet_content()
.
*
*/
drupal_load_stylesheet_content()
does not exist in d8.
Proposed resolution
Replace non-existing function with proper one Drupal\Core\Asset\CssOptimizer::loadFile()
Remaining tasks
commit
User interface changes
no
API changes
no
Comment | File | Size | Author |
---|---|---|---|
#24 | 2448691-23.patch | 59.45 KB | lakshminp |
#22 | interdiff.txt | 843 bytes | joshi.rohit100 |
#22 | 2448691-22.patch | 59.57 KB | joshi.rohit100 |
#20 | 2448691-20.patch | 59.58 KB | rpayanm |
#20 | 2448691-interdiff.txt | 852 bytes | rpayanm |
Comments
Comment #1
jhodgdonFile is: core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css
Fixing issue title.
Comment #2
Robin Sharma CreditAttribution: Robin Sharma commentedTo do more alot in Drupal8. I have to learn alot.
Comment #3
andypostComment #4
joshi.rohit100Comment #5
joshi.rohit100Comment #6
andypostNo, you just need to replace
drupal_load_stylesheet_content
with proper reference to curent functionComment #7
joshi.rohit100I think CssOptimizer::loadFile will replace the drupal_load_stylesheet_content() method.
Comment #8
andypostThe function is removed in #352951: Make JS & CSS Preprocessing Pluggable
But test still there, so please check the usage of that file
.
Please use full namespaced path to class
Comment #9
joshi.rohit100Added namespace for class.
Comment #10
andypost.
s/loadFile/loadFile() this is a function so please add () at the end
Comment #11
ameymudras CreditAttribution: ameymudras commentedFixed this minor issue
Comment #12
andypostGreat!
Comment #13
jhodgdonSo... It looks like this hacks CSS file is used in Core only in \Drupal\system\Tests\Asset\CssOptimizerUnitTest.
The method that this test is testing appears to be \Drupal\Core\Asset\CssOptimizer::optimize().
So, I think maybe the @file comment at the top of this file should maybe say something like "This file is used in testing CssOptimizer::optimize() in CssOptimizerUnitTest" (cleaned up and with the full namespaces).
Also, there are standards issues with the current patch:
- Namespaces in docs need to start with \
- This file doesn't have a @file block. The comment here should be made into a @file block.
- See https://www.drupal.org/node/1354 for standards on how to write a @file block, including that the first line should be 80 characters.
Comment #14
rpayanmPlease review.
Comment #15
andypostas declared, but
.
should be 1 line!
Comment #16
rpayanmComment #19
jhodgdon.
+ *
+ * This file is used in testing CssOptimizer::optimize() in
+ * CssOptimizerUnitTest.
+ */
Ok. The first line needs to be one sentence summarizing what the file is. How about:
CSS file with special comments for testing.
Then you can put in the other documentation in additional paragraphs. And still, EVERY mention of a class in documentation is supposed to include the FULL NAMESPACE. And don't use CODE tags in docs.
Comment #20
rpayanm@jhodgdon thank you for your review.
Comment #21
jhodgdonCloser!
This line needs to end in .
And then I think the two separate paragraphs below can be combined? Is the file really used for testing all of those things?
Comment #22
joshi.rohit100Done as per #21.
Yes, this file is being used for testing.
Comment #23
jhodgdonSee comment #13 above. I am aware the file is used in testing. I'm not sure it is used to test all the things the @file block says it is used for; specifically, \Drupal\Core\Asset\CssOptimizer::loadFile(). All I see it being used for is testing the optimize() method.
Other than that question, the patch looks good. Thanks!
Comment #24
lakshminp CreditAttribution: lakshminp at Axelerant commentedrerolling patch in accordance with #13.
Comment #25
jhodgdonThanks! Sorry for the delay in reviewing. This looks fine to me.
Comment #26
alexpottMe too. Committed bf39af8 and pushed to 8.0.x. Thanks!