public function FindReplaceRegexTest::testSingleValueWordBoundaries in Tamper 8
Test the plugin as respecting word boundaries.
File
- tests/
src/ Unit/ Plugin/ Tamper/ FindReplaceRegexTest.php, line 51
Class
- FindReplaceRegexTest
- Tests the find and replace regex plugin.
Namespace
Drupal\Tests\tamper\Unit\Plugin\TamperCode
public function testSingleValueWordBoundaries() {
$config = [
FindReplaceRegex::SETTING_FIND => '/cat\\b/i',
FindReplaceRegex::SETTING_REPLACE => 'dog',
FindReplaceRegex::SETTING_LIMIT => '',
];
$plugin = new FindReplaceRegex($config, 'find_replace_regex', [], $this
->getMockSourceDefinition());
$this
->assertEquals('The Catwent to the park.', $plugin
->tamper('The Catwent to the park.'));
}