You are here

protected function YamlFormTestTrait::assertNotContains in YAML Form 8

Passes if the substring is not contained within text, fails otherwise.

1 call to YamlFormTestTrait::assertNotContains()
YamlFormHandlerEmailAdvancedTest::testAdvancedEmailHandler in src/Tests/YamlFormHandlerEmailAdvancedTest.php
Test advanced email handler.

File

src/Tests/YamlFormTestTrait.php, line 452

Class

YamlFormTestTrait
Defines form test trait.

Namespace

Drupal\yamlform\Tests

Code

protected function assertNotContains($haystack, $needle, $message = '', $group = 'Other') {
  if (!$message) {
    $t_args = [
      '@haystack' => Unicode::truncate($haystack, 150, TRUE, TRUE),
      '@needle' => $needle,
    ];
    $message = new FormattableMarkup('"@needle" not found', $t_args);
  }
  $result = strpos($haystack, $needle) === FALSE;
  if (!$result) {
    $this
      ->verbose($haystack);
  }
  return $this
    ->assert($result, $message, $group);
}