protected function FieldUnitTestBase::assertText

Pass if the text IS found in set string.

Parameters

$text: Text to look for.

$message: (optional) A message to display with the assertion. Do not translate messages: use format_string() 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

TRUE on pass, FALSE on fail.

3 calls to FieldUnitTestBase::assertText()
DisplayApiTest::testFieldEmpty in drupal/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php
Tests that the prepareView() formatter method still fires for empty values.
DisplayApiTest::testFieldViewField in drupal/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php
Test the field_view_field() function.
DisplayApiTest::testFieldViewValue in drupal/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php
Test the field_view_value() function.

File

drupal/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php, line 197
Contains \Drupal\field\Tests\FieldUnitTestBase.

Class

FieldUnitTestBase
Parent class for Field API unit tests.

Namespace

Drupal\field\Tests

Code

protected function assertText($text, $message = '', $group = 'Other') {
  if (!$message) {
    $message = t('Raw "@raw" found', array(
      '@raw' => $text,
    ));
  }
  return $this
    ->assert(strpos(filter_xss($this->content, array()), $text) !== FALSE, $message, $group);
}