This is a child of a meta issue #2344799: [Meta issue] Clear _toString is not implemented errors.

This is causing a lint error

Method __toString is not implemented for the following objects.

Comments

tstoeckler’s picture

So, it seems editorXssFilterClass is a pretty poor variable name if it in fact does not contain a class?!

Status: Needs review » Needs work

The last submitted patch, toString-0.patch, failed testing.

martin107’s picture

StatusFileSize
new1.6 KB

Ok so that taught me a lesson!!! Here is plan B

We have a variable defined in setup() to be a string constant and read in ONLY one place to where it is concatenated with another string constant!!!!!

This should conventually be reduced to just one in-line string constant.

But I am reading the intent of the original developer.. and seeing that the way of doing things is primed for extension.

So I am just refining the poorly name variable and clearing the lint error.

editorXssFilterClass becomes filterUnderTest

and I've added some annotations so the next programmer can see at a glance the intent..

martin107’s picture

Status: Needs work » Needs review
wim leers’s picture

Priority: Normal » Minor
Status: Needs review » Needs work
Issue tags: +Quick fix

Thanks!

This is indeed odd. It's because I copy/pasted bits of code from editor_filter_xss(), which uses that same variable name.

However, in this test, which tests only \Drupal\editor\EditorXssFilter\Standard, we should just hardcode \Drupal\editor\EditorXssFilter\Standard and remove the variable altogether.

martin107’s picture

Issue summary: View changes
StatusFileSize
new1.43 KB
new1.49 KB

Simplifled.

martin107’s picture

Status: Needs work » Needs review
wim leers’s picture

Title: core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php has trivial lint error. » core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php has trivial lint error
Status: Needs review » Reviewed & tested by the community

Thanks!

wim leers’s picture

Title: core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php has trivial lint error » Drupal\Tests\editor\Unit\EditorXssFilter\StandardTest has trivial lint error
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

  • webchick committed c5a0c9f on 8.0.x
    Issue #2344823 by martin107: Drupal\Tests\editor\Unit\EditorXssFilter\...

Status: Fixed » Closed (fixed)

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