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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Title: comment at top of comment_hacks.css makes no sense » comment at top of comment_hacks.css references removed function

File is: core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css

Fixing issue title.

Robin Sharma’s picture

To do more alot in Drupal8. I have to learn alot.

andypost’s picture

Issue summary: View changes
Issue tags: +Novice
joshi.rohit100’s picture

Issue tags: +SprintWeekend2015
joshi.rohit100’s picture

Status: Active » Needs review
FileSize
59.24 KB
andypost’s picture

Status: Needs review » Needs work

No, you just need to replace drupal_load_stylesheet_content with proper reference to curent function

joshi.rohit100’s picture

Status: Needs work » Needs review
FileSize
545 bytes

I think CssOptimizer::loadFile will replace the drupal_load_stylesheet_content() method.

andypost’s picture

The function is removed in #352951: Make JS & CSS Preprocessing Pluggable
But test still there, so please check the usage of that file

+++ b/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css
@@ -1,6 +1,6 @@
+* of function <code>CssOptimizer::loadFile

.

Please use full namespaced path to class

joshi.rohit100’s picture

FileSize
563 bytes
520 bytes

Added namespace for class.

andypost’s picture

Status: Needs review » Needs work
+++ b/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css
@@ -1,6 +1,6 @@
+* of function <code>Drupal\Core\Asset\CssOptimizer::loadFile

.

s/loadFile/loadFile() this is a function so please add () at the end

ameymudras’s picture

Status: Needs work » Needs review
Issue tags: +#drupalgoa2015
FileSize
565 bytes

Fixed this minor issue

andypost’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Great!

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

So... 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.

rpayanm’s picture

Status: Needs work » Needs review
FileSize
59.49 KB
59.5 KB

Please review.

andypost’s picture

Status: Needs review » Needs work

the first line should be 80 characters

as declared, but

+++ b/core/tests/Drupal/Tests/Core/Asset/css_test_files/comment_hacks.css
@@ -1,8 +1,12 @@
+ * @file
+ * A sample css file, designed to test the effectiveness and stability
+ * of function <code>\Drupal\Core\Asset\CssOptimizer::loadFile()

.

should be 1 line!

rpayanm’s picture

Status: Needs work » Needs review
FileSize
743 bytes
59.49 KB

Status: Needs review » Needs work

The last submitted patch, 16: 2448691-16.patch, failed testing.

Status: Needs work » Needs review

rpayanm queued 16: 2448691-16.patch for re-testing.

jhodgdon’s picture

Status: Needs review » Needs work
+/**
+ * @file
+ * A sample css file, designed to test the effectiveness and stability of
+ * function <code>\Drupal\Core\Asset\CssOptimizer::loadFile()

.
+ *
+ * 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.

rpayanm’s picture

Status: Needs work » Needs review
FileSize
852 bytes
59.58 KB

@jhodgdon thank you for your review.

jhodgdon’s picture

Status: Needs review » Needs work

Closer!

+ * @file
+ * CSS file with special comments for testing

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?

joshi.rohit100’s picture

Status: Needs work » Needs review
FileSize
59.57 KB
843 bytes

Done as per #21.

Is the file really used for testing all of those things?

Yes, this file is being used for testing.

jhodgdon’s picture

See 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!

lakshminp’s picture

FileSize
59.45 KB

rerolling patch in accordance with #13.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Sorry for the delay in reviewing. This looks fine to me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Me too. Committed bf39af8 and pushed to 8.0.x. Thanks!

  • alexpott committed bf39af8 on 8.0.x
    Issue #2448691 by joshi.rohit100, rpayanm, ameymudras, lakshminp:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.