You are here

public function FindReplaceRegexTest::testSingleValue in Tamper 8

Test the plugin with a single value.

File

tests/src/Unit/Plugin/Tamper/FindReplaceRegexTest.php, line 25

Class

FindReplaceRegexTest
Tests the find and replace regex plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testSingleValue() {
  $config = [
    FindReplaceRegex::SETTING_FIND => '/cat/',
    FindReplaceRegex::SETTING_REPLACE => 'dog',
    FindReplaceRegex::SETTING_LIMIT => '',
  ];
  $plugin = new FindReplaceRegex($config, 'find_replace_regex', [], $this
    ->getMockSourceDefinition());
  $this
    ->assertEquals('The dog went to the park.', $plugin
    ->tamper('The cat went to the park.'));
}