function TestBase::fail

Fire an assertion that is always negative.

Parameters

$message: (optional) A message to display with the assertion. Do not translate messages: use \Drupal\Component\Render\FormattableMarkup to embed variables in the message text, not t(). If left blank, a default message will be displayed.

$group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.

Return value

FALSE.

18 calls to TestBase::fail()
ConfigAfterInstallerTestBase::assertInstalledConfig in core/modules/system/src/Tests/Installer/ConfigAfterInstallerTestBase.php
Ensures that all the installed config looks like the exported one.
GenericCacheBackendUnitTestBase::testSetGet in core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
Tests the get and set methods of Drupal\Core\Cache\CacheBackendInterface.
GenericCacheBackendUnitTestBase::testSetMultiple in core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
Tests \Drupal\Core\Cache\CacheBackendInterface::setMultiple().
KernelTestBase::installEntitySchema in core/modules/simpletest/src/KernelTestBase.php
Installs the storage schema for a specific entity type.
KernelTestBase::setUp in core/modules/simpletest/src/KernelTestBase.php
Performs setup tasks before each individual test method is run.

... See full list

File

core/modules/simpletest/src/TestBase.php, line 814

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function fail($message = NULL, $group = 'Other') {
    return $this->assert(FALSE, $message, $group);
}

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