<commit_before>Feature: Do global search/replace

  Scenario: Basic search/replace
    Given a WP install

    When I run `wp search-replace foo bar`
    Then STDOUT should contain:
      """
      guid
      """

    When I run `wp search-replace foo bar --skip-columns=guid`
    Then STDOUT should not contain:
      """
      guid
      """

  Scenario: Large guid search/replace where replacement contains search
    Given a WP install

    When I run `wp option get siteurl`
   
    And save STDOUT as {SITEURL}

    And I run `wp post generate --count=1000`

    And I run `wp search-replace {SITEURL} {SITEURL}/subdir`
    Then STDOUT should be a table containing rows:
      | Table    | Column | Replacements |
      | wp_posts | guid   | 1002         |

  Scenario: Large guid search/replace where replacement does not contain search
    Given a WP install

    When I run `wp option get siteurl`

    And save STDOUT as {SITEURL}

    And I run `wp post generate --count=1000`

    And I run `wp search-replace {SITEURL} http://newdomain.com`
    Then STDOUT should be a table containing rows:
      | Table    | Column | Replacements |
      | wp_posts | guid   | 1002         |

  Scenario: Large guid search/replace dry run where replacement does not contain search
    Given a WP install

    When I run `wp option get siteurl`

    And save STDOUT as {SITEURL}

    And I run `wp post generate --count=1000`

    And I run `wp search-replace --dry-run {SITEURL} http://newdomain.com`
    Then STDOUT should be a table containing rows:
      | Table    | Column | Replacements |
      | wp_posts | guid   | 1002         |<commit_msg>behat: refactor search-replace tests by using a scenario outline<commit_after>Feature: Do global search/replace

  Scenario: Basic search/replace
    Given a WP install

    When I run `wp search-replace foo bar`
    Then STDOUT should contain:
      """
      guid
      """

    When I run `wp search-replace foo bar --skip-columns=guid`
    Then STDOUT should not contain:
      """
      guid
      """

  Scenario Outline: Large guid search/replace where replacement contains search (or not)
    Given a WP install
    And I run `wp option get siteurl`
    And save STDOUT as {SITEURL}
    And I run `wp post generate --count=20`

    When I run `wp search-replace <flags> {SITEURL} <replacement>`
    Then STDOUT should be a table containing rows:
      | Table    | Column | Replacements |
      | wp_posts | guid   | 22           |

    Examples:
      | replacement          | flags     |
      | {SITEURL}/subdir     |           |
      | http://newdomain.com |           |
      | http://newdomain.com | --dry-run |
{'fraction_non_alphanumeric': 0.07890800299177263, 'fraction_numerical': 0.010471204188481676, 'mean_word_length': 2.246359223300971, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1055244', 'n_tokens_mistral': 811, 'n_tokens_neox': 762, 'n_words': 308}