public function FindReplaceRegexTest::testSingleValueLineBreak in Tamper 8
Test the plugin with line break.
File
- tests/
src/ Unit/ Plugin/ Tamper/ FindReplaceRegexTest.php, line 64
Class
- FindReplaceRegexTest
- Tests the find and replace regex plugin.
Namespace
Drupal\Tests\tamper\Unit\Plugin\TamperCode
public function testSingleValueLineBreak() {
$config = [
FindReplaceRegex::SETTING_FIND => '/cat\\n/',
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\n went to the park."));
$config = [
FindReplaceRegex::SETTING_FIND => '/cat\\r\\n/',
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\r\n went to the park."));
}