L337xyz
Server: LiteSpeed
System: Linux in-mum-web831.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
User: u786315844 (786315844)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/.wp-cli/packages/vendor/wp-cli/extension-command/features/plugin-delete.feature
Feature: Delete WordPress plugins

  Background:
    Given a WP install

  Scenario: Delete an installed plugin
    When I run `wp plugin delete akismet`
    Then STDOUT should be:
      """
      Deleted 'akismet' plugin.
      Success: Deleted 1 of 1 plugins.
      """
    And the return code should be 0

  Scenario: Delete all installed plugins
    When I run `wp plugin delete --all`
    Then STDOUT should be:
      """
      Deleted 'akismet' plugin.
      Deleted 'hello' plugin.
      Success: Deleted 2 of 2 plugins.
      """
    And the return code should be 0

    When I run the previous command again
    Then STDOUT should be:
      """
      Success: No plugins deleted.
      """

  Scenario: Attempting to delete a plugin that doesn't exist
    When I try `wp plugin delete debug-bar`
    Then STDOUT should be:
      """
      Success: Plugin already deleted.
      """
    And STDERR should be:
      """
      Warning: The 'debug-bar' plugin could not be found.
      """
    And the return code should be 0

  Scenario: Excluding a plugin from deletion when using --all switch
    When I try `wp plugin delete --all --exclude=akismet,hello`
    Then STDOUT should be:
      """
      Success: No plugins deleted.
      """
    And the return code should be 0

  Scenario: Excluding a missing plugin should not throw an error
    Given a WP install
    And I run `wp plugin delete --all --exclude=missing-plugin`
    Then STDERR should be empty
    And STDOUT should contain:
      """
      Success:
      """
    And the return code should be 0

  Scenario: Reports a failure for a plugin that can't be deleted
    Given a WP install

    When I run `chmod -w wp-content/plugins/akismet`
    And I try `wp plugin delete akismet`
    Then STDERR should contain:
      """
      Warning: The 'akismet' plugin could not be deleted.
      """
    And STDERR should contain:
      """
      Error: No plugins deleted.
      """
    And STDOUT should not contain:
      """
      Success:
      """

    When I run `chmod +w wp-content/plugins/akismet`
    And I run `wp plugin delete akismet`
    Then STDERR should not contain:
      """
      Error:
      """
    And STDOUT should contain:
      """
      Success:
      """