Comments

nick_schuch’s picture

Status: Active » Needs review
Issue tags: +Needs tests, +#pnx-sprint
StatusFileSize
new4.04 KB

Here is the patch. I also need to write some tests.

nick_schuch’s picture

Here we go. Migrated to use UnitTestBase. Also implemented in Tour module to prove this change is working.

larowlan’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests +PHPUnit
+++ b/core/lib/Drupal/Component/Utility/CSS.php
@@ -0,0 +1,46 @@
+   * http://www.w3.org/TR/CSS21/syndata.html#characters shows the syntax for valid

nitpick: 80 chars

Other than that looks good to go to me.

nick_schuch’s picture

Here we go. Thanks larowlan! :)

dawehner’s picture

  1. +++ b/core/lib/Drupal/Component/Utility/CSS.php
    @@ -0,0 +1,47 @@
    +   *
    +   * @param $identifier
    +   *   The identifier to clean.
    +   * @param $filter
    +   *   An array of string replacements to use on the identifier.
    +   *
    +   * @return
    +   *   The cleaned identifier.
    +   */
    

    Let's document the variable types as well.

  2. +++ b/core/tests/Drupal/Tests/Component/Utility/CSSTest.php
    @@ -0,0 +1,66 @@
    +/**
    + * Tests cleaning HTML identifiers.
    + */
    +class CSSTest extends UnitTestCase {
    

    It would be cool to have a @see (the class we test) and a @group Drupal

  3. +++ b/core/tests/Drupal/Tests/Component/Utility/CSSTest.php
    @@ -0,0 +1,66 @@
    +  public static function getInfo() {
    

    Let's introduce an empty line in here.

  4. +++ b/core/tests/Drupal/Tests/Component/Utility/CSSTest.php
    @@ -0,0 +1,66 @@
    +   * Tests that drupal_clean_css_identifier() cleans the identifier properly.
    +   *
    

    Should we just point to the CSS::cleanIdentifier method?

  5. +++ b/core/tests/Drupal/Tests/Component/Utility/CSSTest.php
    @@ -0,0 +1,66 @@
    +  public function provider() {
    

    We kind of have the "standard" in core to use providerTestNameofTheTest, so here providerTestDrupalCleanCSSIdenfier ... just mentioning as there are some small other points.

ParisLiakos’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Component/Utility/CSS.php
@@ -0,0 +1,47 @@
+class CSS {

+++ b/core/tests/Drupal/Tests/Component/Utility/CSSTest.php
@@ -0,0 +1,66 @@
+class CSSTest extends UnitTestCase {

should be
Css and CssTest

msmithcti’s picture

Status: Needs work » Needs review
StatusFileSize
new8.55 KB
new7.89 KB

This should cover all points in #5 and #6 as well as a much needed reroll.

Status: Needs review » Needs work
Issue tags: -PHPUnit, -#pnx-sprint

The last submitted patch, drupal_clean_css_identifier-to-component-2082103-7.patch, failed testing.

msmithcti’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +PHPUnit, +#pnx-sprint

The last submitted patch, drupal_clean_css_identifier-to-component-2082103-7.patch, failed testing.

tim.plunkett’s picture

So it turns out I completely duplicated the work of this issue.
I was working on #2121713: Move drupal_html_id() and drupal_html_class() to Drupal\Component\Utility, which forced me to do drupal_clean_css_identifier as well...

Want to merge them?

nick_schuch’s picture

Sounds good to me!

tim.plunkett’s picture

Status: Needs work » Closed (duplicate)

Updated the other issue to ensure you get commit credit, closing.