You are here

public function FeedsTamperFindReplaceREGEXTestCase::test in Feeds Tamper 7

Same name and namespace in other branches
  1. 6 tests/feeds_tamper_plugins.test \FeedsTamperFindReplaceREGEXTestCase::test()

File

tests/feeds_tamper_plugins.test, line 425
Unit tests for feeds tamper plugins.

Class

FeedsTamperFindReplaceREGEXTestCase
Tests for find_replace_regex.inc

Code

public function test() {
  $settings = array(
    'find' => '/cat/',
    'replace' => 'dog',
    'limit' => '',
  );
  $this
    ->execute('The cat went to the park.', 'The dog went to the park.', $settings);
  $settings['find'] = '/cat/i';
  $this
    ->execute('The Cat went to the park.', 'The dog went to the park.', $settings);
  $settings['find'] = '/cat\\b/i';
  $this
    ->execute('The Catwent to the park.', 'The Catwent to the park.', $settings);
  $settings['find'] = '/cat\\n/';
  $this
    ->execute("The cat\n went to the park.", 'The dog went to the park.', $settings);
  $settings['find'] = '/cat\\s/';
  $this
    ->execute("The cat\n went to the park.", 'The dog went to the park.', $settings);
  $settings['find'] = '/cat\\r\\n/';
  $this
    ->execute("The cat\r\n went to the park.", 'The dog went to the park.', $settings);
  $settings['find'] = '/cat\\t/';
  $this
    ->execute("The cat\t went to the park.", 'The dog went to the park.', $settings);
}