You are here

public function FindReplaceTest::testSingleValue in Tamper 8

Test the plugin with a single value.

File

tests/src/Unit/Plugin/Tamper/FindReplaceTest.php, line 33

Class

FindReplaceTest
Tests the find and replace plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testSingleValue() {
  $config = [
    FindReplace::SETTING_FIND => 'cat',
    FindReplace::SETTING_REPLACE => 'dog',
    FindReplace::SETTING_CASE_SENSITIVE => FALSE,
    FindReplace::SETTING_WORD_BOUNDARIES => FALSE,
    FindReplace::SETTING_WHOLE => FALSE,
  ];
  $plugin = new FindReplace($config, 'find_replace', [], $this
    ->getMockSourceDefinition());
  $this
    ->assertEquals('The dog went to the park.', $plugin
    ->tamper('The cat went to the park.'));
  $this
    ->assertEquals('The dog went to the park.', $plugin
    ->tamper('The Cat went to the park.'));
  $this
    ->assertEquals('The dogwent to the park.', $plugin
    ->tamper('The Catwent to the park.'));
}