function TestCompatibilityTrait::assertTrue

Same name in this branch
  1. 8.9.x core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit7/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit7\TestCompatibilityTrait::assertTrue()

@todo deprecate this method override in https://www.drupal.org/project/drupal/issues/2742585

See also

\Drupal\simpletest\TestBase::assertTrue()

File

core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit6/TestCompatibilityTrait.php, line 16

Class

TestCompatibilityTrait
Makes Drupal's test API forward compatible with multiple versions of PHPUnit.

Namespace

Drupal\TestTools\PhpUnitCompatibility\PhpUnit6

Code

public static function assertTrue($actual, $message = '') {
    if (is_bool($actual)) {
        parent::assertTrue($actual, $message);
    }
    else {
        @trigger_error('Support for asserting against non-boolean values in ::assertTrue is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use a different assert method, for example, ::assertNotEmpty(). See https://www.drupal.org/node/3082086', E_USER_DEPRECATED);
        parent::assertNotEmpty($actual, $message);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.