You are here

public function FeedsTamperFindReplaceTestCase::test in Feeds Tamper 7

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

File

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

Class

FeedsTamperFindReplaceTestCase
Tests for find_replace.inc

Code

public function test() {
  $settings = array(
    'find' => 'cat',
    'replace' => 'dog',
    'case_sensitive' => FALSE,
    'word_boundaries' => FALSE,
    'whole' => FALSE,
  );
  $this
    ->execute('The cat went to the park.', 'The dog went to the park.', $settings);
  $this
    ->execute('The Cat went to the park.', 'The dog went to the park.', $settings);
  $this
    ->execute('The Catwent to the park.', 'The dogwent to the park.', $settings);
  $settings = array(
    'find' => 'cat',
    'replace' => 'dog',
    'case_sensitive' => TRUE,
    'word_boundaries' => FALSE,
    'whole' => FALSE,
  );
  $this
    ->execute('The cat went to the park.', 'The dog went to the park.', $settings);
  $this
    ->execute('The Cat went to the park.', 'The Cat went to the park.', $settings);
  $this
    ->execute('The catwent to the park.', 'The dogwent to the park.', $settings);
  $settings = array(
    'find' => 'c/at',
    'replace' => 'dog',
    'case_sensitive' => FALSE,
    'word_boundaries' => TRUE,
    'whole' => FALSE,
  );
  $this
    ->execute('The c/at went to the park.', 'The dog went to the park.', $settings);
  $this
    ->execute('The C/at went to the park.', 'The dog went to the park.', $settings);
  $this
    ->execute('The c/atwent to the park.', 'The c/atwent to the park.', $settings);
  $settings = array(
    'find' => '/cat',
    'replace' => 'dog',
    'case_sensitive' => FALSE,
    'word_boundaries' => FALSE,
    'whole' => TRUE,
  );
  $this
    ->execute('The /cat went to the park.', 'The /cat went to the park.', $settings);
  $this
    ->execute('/cat', 'dog', $settings);
  $this
    ->execute('/Cat', 'dog', $settings);
}