BrowserTestBase::pass() is deprecated

Created on 4 August 2021, almost 3 years ago
Updated 26 April 2023, about 1 year ago

pass() was deprecated as part of Simpletest's legacy assertion methods are deprecated β†’

The content_access tests use this many times, but always in the same way:

    if (!\Drupal::moduleHandler()->moduleExists('acl')) {
      $this->pass('No ACL module present, skipping test');
      return;
    }

This code checks for the existence of the ACL module and uses pass() to print a message then exit the test if ACL is not present on the test system.

This could be changed to:

    $this->assertTrue(
      \Drupal::moduleHandler()->moduleExists('acl'),
      'No ACL module present, skipping test'
    );

Which does the same thing, without the deprecated pass() (Note that PHPUnit will automatically end a test case when a failure is encountered, so no explicit "return" is needed.)

However, it makes even more sense just to eliminate this check for the ACL module because test dependencies are supposed to be set by the composer.json file or by the content_access.info.yml file. If those are correct, then the ACL module will *always* be present for testing as it is a *requirement*.

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States TR Cascadia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024