The Needs Review Queue Bot โ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- ๐ณ๐ฟNew Zealand quietone
Tagging for coding standards and moving to the 'other' component where such issues live.
- Status changed to Needs review
almost 2 years ago 4:40pm 2 June 2023 - last update
almost 2 years ago Patch Failed to Apply - Status changed to Needs work
almost 2 years ago 4:49pm 2 June 2023 - ๐บ๐ธUnited States smustgrave
Issue summary is incomplete.
And this feels like counter active of only using t() in tests when testing translation.
- ๐ฎ๐ณIndia atul4drupal
Added patch for 11.x
Interdiff is not generated as the patch at #49 is not applying to have the interdiff generated (interdiff: Error applying patch1 to reconstructed file)IS to be updated...
- last update
over 1 year ago 30,392 pass - Status changed to Needs review
8 months ago 4:54am 30 July 2024 - ๐ณ๐ฟNew Zealand quietone
The reason for this change is not in any of the comments and the documentation https://www.drupal.org/docs/develop/automated-testing/phpunit-in-drupal/phpunit-browser-test-tutorial#t clearly states not to do this. Thanks to @AJV009 for pointing that out.
What is the reason for doing this? How does it help developers?
- Status changed to Needs work
8 months ago 5:05am 30 July 2024 The Needs Review Queue Bot โ tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request โ . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
- ๐ณ๐ฟNew Zealand quietone
What is the scope here? The patch here is for test modules but the issue title is for all tests.
- ๐ฆ๐บAustralia acbramley
Re #55 it definitely shouldn't be in actual test code (i.e inside PHPUnit tests) as that is unnecessary and will break phpstan typing as well, we've been trying to move away from using t() inside phpunit tests entirely.
IMO this issue doesn't seem that necessary to begin with. The IS states it's for easier copy-paste but the vast majority of test code and modules are very specific and should not be copy-pasted into runtime code. In fact I'd almost go the opposite way and remove t() calls in tests if anything.
We also need the changes in an MR.
- ๐ณ๐ฟNew Zealand quietone
@acbramley, thanks. Seems this needs more discussion.
Let's hold off on an MR for more discussion.
- ๐ณ๐ฟNew Zealand quietone
I brought this up in committer slack where catch, alexpott, gรกbor hojtsy, longwave and myself, We agreed that it is not good practice to copy/pasted test code to production. As @acbramley points out test code can be specific. It may not be a good example to use which poses a risk when a less experience developer copies it. So let's avoid that. There was also a suggestion that a better way to enforce the use of t() for these properties would be to do so in the Form API itself. That is, if we want to do it.
I added on the doc page that Drupal core does use t(0 in browser tests that are testing translation.
Thank you to everyone who worked on this, which led to clarifying the situation.