public function FindReplaceTest::testSingleValueWordBoundaries in Tamper 8
Test the plugin as respecting word boundaries.
File
- tests/
src/ Unit/ Plugin/ Tamper/ FindReplaceTest.php, line 67
Class
- FindReplaceTest
- Tests the find and replace plugin.
Namespace
Drupal\Tests\tamper\Unit\Plugin\TamperCode
public function testSingleValueWordBoundaries() {
$config = [
FindReplace::SETTING_FIND => 'cat',
FindReplace::SETTING_REPLACE => 'dog',
FindReplace::SETTING_CASE_SENSITIVE => FALSE,
FindReplace::SETTING_WORD_BOUNDARIES => TRUE,
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 catwent to the park.', $plugin
->tamper('The catwent to the park.'));
}