You are here

public static function TestCompatibilityTrait::assertTrue in Drupal 8

Same name in this branch
  1. 8 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit7/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit7\TestCompatibilityTrait::assertTrue()
  2. 8 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit6/TestCompatibilityTrait.php \Drupal\TestTools\PhpUnitCompatibility\PhpUnit6\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/PhpUnit7/TestCompatibilityTrait.php, line 16

Class

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

Namespace

Drupal\TestTools\PhpUnitCompatibility\PhpUnit7

Code

public static function assertTrue($actual, string $message = '') : void {
  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);
  }
}