<commit_before>Feature: Reset WordPress sidebars

  Scenario: Reset sidebar
    Given a WP install

    When I run `wp theme install twentysixteen --activate`
    Then STDOUT should not be empty

    When I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      6
      """

    When I run `wp widget reset sidebar-1`
    And I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      0
      """

    When I try `wp widget reset`
    Then STDERR should be:
      """
      Error: Please specify one or more sidebars, or use --all.
      """

    When I try `wp widget reset sidebar-1`
    Then STDERR should be:
      """
      Warning: Sidebar 'sidebar-1' is already empty.
      """

    When I try `wp widget reset non-existing-sidebar-id`
    Then STDERR should be:
      """
      Warning: Invalid sidebar: non-existing-sidebar-id
      """

    When I run `wp widget add calendar sidebar-1 --title="Calendar"`
    Then STDOUT should not be empty
    And I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      1
      """

    When I run `wp widget add search sidebar-2 --title="Quick Search"`
    Then STDOUT should not be empty
    And I run `wp widget list sidebar-2 --format=count`
    Then STDOUT should be:
      """
      1
      """

    When I run `wp widget reset sidebar-1 sidebar-2`
    And I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      0
      """
    And I run `wp widget list sidebar-2 --format=count`
    Then STDOUT should be:
      """
      0
      """

  Scenario: Reset all sidebars
    Given a WP install

    When I run `wp theme install twentysixteen --activate`
    Then STDOUT should not be empty

    When I run `wp widget add calendar sidebar-1 --title="Calendar"`
    Then STDOUT should not be empty
    When I run `wp widget add search sidebar-2 --title="Quick Search"`
    Then STDOUT should not be empty
    When I run `wp widget add text sidebar-3 --title="Text"`
    Then STDOUT should not be empty

    When I run `wp widget reset --all`
    And I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      0
      """
    And I run `wp widget list sidebar-2 --format=count`
    Then STDOUT should be:
      """
      0
      """
    And I run `wp widget list sidebar-3 --format=count`
    Then STDOUT should be:
      """
      0
      """
    When I run `wp widget list wp_inactive_widgets --format=ids`
    Then STDOUT should be:
      """
      text-1 search-3 meta-2 categories-2 archives-2 recent-comments-2 recent-posts-2 search-2 calendar-1
      """

  Scenario: Testing movement of widgets while reset
    Given a WP install

    When I run `wp theme install twentysixteen --activate`
    Then STDOUT should not be empty
<commit_msg>Use Twentytwelve theme in test of widget reset because 2016 wont run in WP 3.7<commit_after>Feature: Reset WordPress sidebars

  Scenario: Reset sidebar
    Given a WP install

    When I run `wp theme install twentytwelve --activate`
    Then STDOUT should not be empty

    When I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      6
      """

    When I run `wp widget reset sidebar-1`
    And I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      0
      """

    When I try `wp widget reset`
    Then STDERR should be:
      """
      Error: Please specify one or more sidebars, or use --all.
      """

    When I try `wp widget reset sidebar-1`
    Then STDERR should be:
      """
      Warning: Sidebar 'sidebar-1' is already empty.
      """

    When I try `wp widget reset non-existing-sidebar-id`
    Then STDERR should be:
      """
      Warning: Invalid sidebar: non-existing-sidebar-id
      """

    When I run `wp widget add calendar sidebar-1 --title="Calendar"`
    Then STDOUT should not be empty
    And I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      1
      """

    When I run `wp widget add search sidebar-2 --title="Quick Search"`
    Then STDOUT should not be empty
    And I run `wp widget list sidebar-2 --format=count`
    Then STDOUT should be:
      """
      1
      """

    When I run `wp widget reset sidebar-1 sidebar-2`
    And I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      0
      """
    And I run `wp widget list sidebar-2 --format=count`
    Then STDOUT should be:
      """
      0
      """

  Scenario: Reset all sidebars
    Given a WP install

    When I run `wp theme install twentytwelve --activate`
    Then STDOUT should not be empty

    When I run `wp widget add calendar sidebar-1 --title="Calendar"`
    Then STDOUT should not be empty
    When I run `wp widget add search sidebar-2 --title="Quick Search"`
    Then STDOUT should not be empty
    When I run `wp widget add text sidebar-3 --title="Text"`
    Then STDOUT should not be empty

    When I run `wp widget reset --all`
    And I run `wp widget list sidebar-1 --format=count`
    Then STDOUT should be:
      """
      0
      """
    And I run `wp widget list sidebar-2 --format=count`
    Then STDOUT should be:
      """
      0
      """
    And I run `wp widget list sidebar-3 --format=count`
    Then STDOUT should be:
      """
      0
      """
    When I run `wp widget list wp_inactive_widgets --format=ids`
    Then STDOUT should be:
      """
      text-1 search-3 meta-2 categories-2 archives-2 recent-comments-2 recent-posts-2 search-2 calendar-1
      """

  Scenario: Testing movement of widgets while reset
    Given a WP install

    When I run `wp theme install twentytwelve --activate`
    Then STDOUT should not be empty

{'fraction_non_alphanumeric': 0.08869294605809129, 'fraction_numerical': 0.013831258644536652, 'mean_word_length': 2.1406080347448424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4865935', 'n_tokens_mistral': 1779, 'n_tokens_neox': 1698, 'n_words': 736}