You are here

public function SmileyFilterWebTestCase::testRegexSmilePositions in Smiley 7

Tests for all possible positions of smileys.

File

./smiley.test, line 89
Tests for Smiley module.

Class

SmileyFilterWebTestCase
Web test for smiley module to test the main regex expression for all possible situations to make sure it always works properly.

Code

public function testRegexSmilePositions() {
  $smileys = array(
    (object) array(
      'sid' => '45',
      'uri' => 'kolobok/smile.gif',
      'status' => '1',
      'acronyms' => '*smile* :-) :) +) =) :smile:',
      'description' => 'Smile',
    ),
  );
  $tests = array(
    array(
      'simple text with :) in it' => 'simple text with SMILE in it',
    ),
    array(
      'some another test with a smile at the end :)' => 'some another test with a smile at the end SMILE',
    ),
    array(
      ':) :)) :)))' => 'SMILE :)) :)))',
    ),
    array(
      ":)\n:))\n:)))" => "SMILE\n:))\n:)))",
    ),
    array(
      ':) :) :) :)' => 'SMILE SMILE SMILE SMILE',
    ),
    // Make sure we can handle leading and trailing white space.
    array(
      '   :) :) :) :)   ' => 'SMILE SMILE SMILE SMILE',
    ),
    array(
      ':) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)' => 'SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE SMILE',
    ),
    array(
      "This is a sentence. :)\nThis is another sentence." => "This is a sentence. SMILE\nThis is another sentence.",
    ),
    array(
      '*smile* :-) :) +) =) :smile:' => 'SMILE SMILE SMILE SMILE SMILE SMILE',
    ),
    array(
      '8-O :-)' => '8-O SMILE',
    ),
    array(
      '8O :) additional text here :)' => '8O SMILE additional text here SMILE',
    ),
    array(
      "<p>This is a test :smile:<br>" => "<p>This is a test SMILE<br>",
    ),
  );
  $this
    ->runTests($tests, $smileys);
}