changed test to use mock
combined two-time preg_replace into one call