<commit_before>Feature: Manage WordPress themes and plugins

  Scenario Outline: Installing, upgrading and deleting a theme or plugin
    Given a WP install
    And download:
      | path                   | url       |
      | {CACHE_DIR}/<item>.zip | <zip_file> |
    And I run `wp <type> path`
    And save STDOUT as {CONTENT_DIR}

    # ﻿Install an out of date <item> from WordPress.org repository
    When I run `wp <type> install <item> --version=<version>`
    Then STDOUT should contain:
      """
      <type_name> installed successfully
      """

    When I run `wp <type> status`
    Then STDOUT should contain:
      """
      U = Update Available
      """

    When I run `wp <type> status <item>`
    Then STDOUT should contain:
      """
          Status: Inactive
          Version: <version> (Update available)
      """

    When I run `wp <type> update <item>`
    Then STDOUT should not be empty

    When I run `wp <type> status <item>`
    Then STDOUT should not contain:
      """
      (Update available)
      """

    When I run `wp <type> delete <item>`
    Then STDOUT should contain:
      """
      Success: Deleted '<item>' <type>.
      """

    When I try `wp <type> status <item>`
    Then the return code should be 1
    And STDERR should not be empty


    # Install <item> from local zip file
    When I run `wp <type> install {CACHE_DIR}/<item>.zip`
    Then STDOUT should contain:
    """
    <type_name> installed successfully.
    """
    And the <file_to_check> file should exist

    When I run `wp <type> delete <item>`
    Then STDOUT should contain:
    """
    Success: Deleted '<item>' <type>.
    """
    And the <file_to_check> file should not exist

    # Install plugin from remote ZIP file (standard URL with no GET parameters)
    When I run `wp <type> install <zip_file>`
    Then STDOUT should contain:
    """
    <type_name> installed successfully.
    """
    And the <file_to_check> file should exist

    When I run `wp <type> delete <item>`
    Then STDOUT should contain:
    """
    Success: Deleted '<item>' <type>.
    """
    And the <file_to_check> file should not exist

    # Install <item> from remote ZIP file (complex URL with GET parameters)
    When I run `wp <type> install '<zip_file>?AWSAccessKeyId=123&Expires=456&Signature=abcdef'`
    Then STDOUT should contain:
    """
    <type_name> installed successfully.
    """
    And the <file_to_check> file should exist

    When I run `wp <type> delete <item>`
    Then STDOUT should contain:
    """
    Success: Deleted '<item>' <type>.
    """
    And the <file_to_check> file should not exist


    Examples:
      | type   | type_name | item                    | version | zip_file                                                              | file_to_check                                                    |
      | theme  | Theme     | p2                      | 1.0.1   | http://wordpress.org/themes/download/p2.1.0.1.zip                     | {CONTENT_DIR}/p2/style.css                                        |
      | plugin | Plugin    | category-checklist-tree | 1.2     | http://downloads.wordpress.org/plugin/category-checklist-tree.1.2.zip | {CONTENT_DIR}/category-checklist-tree/category-checklist-tree.php |<commit_msg>behat: upgradables comment updates<commit_after>Feature: Manage WordPress themes and plugins

  Scenario Outline: Installing, upgrading and deleting a theme or plugin
    Given a WP install
    And download:
      | path                   | url       |
      | {CACHE_DIR}/<item>.zip | <zip_file> |
    And I run `wp <type> path`
    And save STDOUT as {CONTENT_DIR}

    # ﻿Install an out of date <item> from WordPress.org repository
    When I run `wp <type> install <item> --version=<version>`
    Then STDOUT should contain:
      """
      <type_name> installed successfully
      """

    When I run `wp <type> status`
    Then STDOUT should contain:
      """
      U = Update Available
      """

    When I run `wp <type> status <item>`
    Then STDOUT should contain:
      """
          Status: Inactive
          Version: <version> (Update available)
      """

    When I run `wp <type> update <item>`
    Then STDOUT should not be empty

    When I run `wp <type> status <item>`
    Then STDOUT should not contain:
      """
      (Update available)
      """

    When I run `wp <type> delete <item>`
    Then STDOUT should contain:
      """
      Success: Deleted '<item>' <type>.
      """

    When I try `wp <type> status <item>`
    Then the return code should be 1
    And STDERR should not be empty


    # Install <item> from a local zip file
    When I run `wp <type> install {CACHE_DIR}/<item>.zip`
    Then STDOUT should contain:
    """
    <type_name> installed successfully.
    """
    And the <file_to_check> file should exist

    When I run `wp <type> delete <item>`
    Then STDOUT should contain:
    """
    Success: Deleted '<item>' <type>.
    """
    And the <file_to_check> file should not exist

    # Install <item> from a remote zip file (standard URL with no GET parameters)
    When I run `wp <type> install <zip_file>`
    Then STDOUT should contain:
    """
    <type_name> installed successfully.
    """
    And the <file_to_check> file should exist

    When I run `wp <type> delete <item>`
    Then STDOUT should contain:
    """
    Success: Deleted '<item>' <type>.
    """
    And the <file_to_check> file should not exist

    # Install <item> from a remote zip file (complex URL with GET parameters)
    When I run `wp <type> install '<zip_file>?AWSAccessKeyId=123&Expires=456&Signature=abcdef'`
    Then STDOUT should contain:
    """
    <type_name> installed successfully.
    """
    And the <file_to_check> file should exist

    When I run `wp <type> delete <item>`
    Then STDOUT should contain:
    """
    Success: Deleted '<item>' <type>.
    """
    And the <file_to_check> file should not exist


    Examples:
      | type   | type_name | item                    | version | zip_file                                                              | file_to_check                                                    |
      | theme  | Theme     | p2                      | 1.0.1   | http://wordpress.org/themes/download/p2.1.0.1.zip                     | {CONTENT_DIR}/p2/style.css                                        |
      | plugin | Plugin    | category-checklist-tree | 1.2     | http://downloads.wordpress.org/plugin/category-checklist-tree.1.2.zip | {CONTENT_DIR}/category-checklist-tree/category-checklist-tree.php |
{'fraction_non_alphanumeric': 0.10440481633897272, 'fraction_numerical': 0.006096631611034903, 'mean_word_length': 2.045011600928074, 'pattern_counts': {'":': 0, '<': 106, '<?xml version=': 0, '>': 106, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 17, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6932030', 'n_tokens_mistral': 1957, 'n_tokens_neox': 1865, 'n_words': 660}