FILE: ...odules/contrib/vote_up_down/tests/src/Unit/VoteUpDownWidgetManagerTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
40 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead

CommentFileSizeAuthor
#3 3135788-3.patch570 bytesdxvargas
#2 3135788-2.patch581 bytesmo_farhaz

Comments

mo_farhaz created an issue. See original summary.

mo_farhaz’s picture

Assigned: mo_farhaz » Unassigned
Status: Active » Needs review
StatusFileSize
new581 bytes

please review.

dxvargas’s picture

StatusFileSize
new570 bytes

I've looked in many drupal modules for other unit tests and I don't find the t() method wrapping strings.
Just an example form user core module. here .
While running unit tests Drupal is not bootstrapped and also class UnitTestCase doesn't have the t() method.

So I really think we just need the plain label without any t() wrapping it. Just like it's done for the description.
I'm now submitting a patch with this change.

marvil07’s picture

Status: Needs review » Fixed

Thanks for the report and the changes!

Sorry I missed this, but it was also included as part of #3145725: Drupal 9 compatibility for the Vote Up/Down module, so it is no longer a problem on 8.x-1.x.

Status: Fixed » Closed (fixed)

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