The class assumes in many places that the assert methods return values, but they don't, not in phpunit. So, since we've converted that test to phpunit, only the first assertion actually runs in these helper assertions.

I've also removed the @return, but that's not an API change, or to be more exact, that change already happend back in 8.2 or something, when we updated kernel tests, I'm just updating the documentation.

Noticed in #2806009: Installing a module causes translations to be overwritten. With this, I now have two failing test methods in the LocaleConfigSubscriberForeignTest subclass, before only one.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir created an issue. See original summary.

Berdir’s picture

Berdir’s picture

Note: There are more problematic tests like this one, search for if \(\$this->assert.+\( to find conditional asserts, return $this->assert.. is also interesting, but mostly in legacy traits. The "assert() && secondAssert" is a bit harder to grep for, as there are a lot of false positives with things like assertTrue(A && B).

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Ghost of Drupal Past’s picture

Status: Needs review » Reviewed & tested by the community

The patch is fine as is and we would be ahead by it, thanks!

It would be nice to convert to the non legacy asserts while at it but whether this needs to be done in this issue is something I leave to decide to the committers.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 54d12c1 and pushed to 9.0.x. Thanks!

As a test only fix I backported to 8.9.x and 8.8.x too.

We can fix up the legacy asserts when we properly deprecate then,

  • alexpott committed 54d12c1 on 9.0.x
    Issue #3079330 by Berdir: LocaleConfigSubscriberTest has many assertions...

  • alexpott committed 117cb9c on 8.9.x
    Issue #3079330 by Berdir: LocaleConfigSubscriberTest has many assertions...

  • alexpott committed 736d930 on 8.8.x
    Issue #3079330 by Berdir: LocaleConfigSubscriberTest has many assertions...

Status: Fixed » Closed (fixed)

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