[DO NOT MERGE YET!] 2014.7 modules.file.replace test coverage

**HELP NEEDED: See below**

Based on the things reported in #18612, attempted to fix in #18615 and an additional case reported in #18841 I started to write some integration tests for `modules.file.replace()`.
All new tests except of `test_replace_issue_18841` work fine after applying the changes to `modules/file.py` also provided by this PR. I need some help with this specific one.
This test sets `search_only=True`:
```Python
ret = self.run_state('file.replace',
    name=path_test, pattern='^hello world$', repl='goodbye world', search_only=True)
```
This should result in no `*.bak` file being created.
Running the test shows, that there is a `*.bak` file created instead.
Running the command directly on CLI works just fine.
Inspecting `ret` shows, that the following warning is raised:
```
'search_only' is an invalid keyword argument for 'file.replace'.
If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs.
Your approach will work until Salt Lithium is out. Please update your state files."
```
Can anyone see why `search_only=True` isn't properly detected as keyword here?

Besides the tests which are provided with this PR, some more things should be tested regarding `replace()` such as:
  * are the `flags` honored in all cases?
  * can matching groups be used in `repl` in different scenarios?
  * is `count` respected in different scenarios?
  * handling of `bufsize`/`bufsize='file'`? Do multiline operations work properly?

Due to time limits someone else will have to take care of those things.
Hrm. I am not sure why that is happening, but glancing at your call to `file.replace` the `name` kwarg isn't one that normally gets passed into `file.replace`. It should be `path` I think. Maybe that's what is throwing something off.