You are here

protected function FilterSpamspanUnitTest::variatedAssert in SpamSpan filter 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/FilterSpamspanUnitTest.php \Drupal\Tests\spamspan\Kernel\FilterSpamspanUnitTest::variatedAssert()

Helper function to assert variations.

1 call to FilterSpamspanUnitTest::variatedAssert()
FilterSpamspanUnitTest::testSpamSpanFilter in tests/src/Kernel/FilterSpamspanUnitTest.php
Tests the align filter.

File

tests/src/Kernel/FilterSpamspanUnitTest.php, line 109

Class

FilterSpamspanUnitTest
Tests spamspan filter.

Namespace

Drupal\Tests\spamspan\Kernel

Code

protected function variatedAssert($filter, $input, $shouldbe) {

  // Test for bare email;.
  $this
    ->wrappedAssert($filter, $input, $shouldbe);

  // Test for email with text at the start.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, 'some text at the start ');

  // Test for email with text at the end.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, '', ' some text at the end');

  // Test for email with text at the start and end.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, 'some text at the start ', ' some text at the end');

  // Test for email with tags at the start and end.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, '<p>', '</p>');

  // Test for email with trailing commas.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, 'some text at the start ', ', next clause.');

  // Test for email with trailing full stop.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, 'some text at the start ', '. next sentence.');

  // Test for email with preceding tag, and no closing tag.
  $this
    ->wrappedAssert($filter, $input, $this->withDom ? $shouldbe . '</dt>' : $shouldbe, '<dt>');

  // Test for brackets.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, '(', ')');

  // Test for newlines.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, PHP_EOL, PHP_EOL);

  // Test for spaces.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, ' ', ' ');

  // Test base64image.
  $this
    ->wrappedAssert($filter, $input, $shouldbe, $this->base64Image, $this->base64Image);
  if (!$this->withDom) {

    // Test for angular brackets.
    $this
      ->wrappedAssert($filter, $input, $shouldbe, '<', '>');
  }
}