HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/local/wp/vendor/wp-cli/cache-command/features/transient-pluck.feature
Feature: Pluck command available for the transient cache

  Scenario: Nested values from transient can be retrieved at any depth.
    Given a WP install
    And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
    And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`

    When I run `wp transient pluck my_key foo`
    Then STDOUT should be:
      """
      bar
      """

    When I run `wp transient pluck my_key_2 foo bar`
    Then STDOUT should be:
      """
      baz
      """

    When I try `wp transient pluck unknown_key foo`
    Then STDERR should be:
      """
      Warning: Transient with key "unknown_key" is not set.
      """

  Scenario: Nested values from site transient can be retrieved at any depth.
    Given a WP multisite install
    And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
    And I run `wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`

    When I run `wp transient pluck my_key foo --network`
    Then STDOUT should be:
      """
      bar
      """

    When I run `wp transient pluck my_key_2 foo bar --network`
    Then STDOUT should be:
      """
      baz
      """

    When I try `wp transient pluck unknown_key foo --network`
    Then STDERR should be:
      """
      Warning: Transient with key "unknown_key" is not set.
      """