<commit_before>Feature: Create shortcuts to specific WordPress installs

  Scenario: Alias for a path to a specific WP install
    Given a WP install in 'testdir'
    And a wp-cli.yml file:
      """
      @testdir:
        path: testdir
      """

    When I try `wp core is-installed`
    Then STDERR should contain:
      """
      Error: This does not seem to be a WordPress install.
      """
    And the return code should be 1

    When I run `wp @testdir core is-installed`
    Then the return code should be 0

  Scenario: Error when invalid alias provided
    Given an empty directory

    When I try `wp @test option get home`
    Then STDERR should be:
      """
      Error: Alias '@test' not found.
      """

  Scenario: Treat global params as local when alias is used
    Given a WP install in 'testdir'
    And a wp-cli.yml file:
      """
      @testdir:
        path: testdir
      """

    When I run `wp @testdir option get home`
    Then STDOUT should be:
      """
      http://example.com
      """

    When I try `wp @testdir option get home --path=testdir`
    Then STDERR should contain:
      """
      Parameter errors:
      """
    And STDERR should contain:
      """
      unknown --path parameter
      """

  Scenario: Support global params specific to the WordPress install, not WP-CLI generally
    Given a WP install in 'testdir'<commit_msg>Add explicit test case for expected behavior of `--user`<commit_after>Feature: Create shortcuts to specific WordPress installs

  Scenario: Alias for a path to a specific WP install
    Given a WP install in 'testdir'
    And a wp-cli.yml file:
      """
      @testdir:
        path: testdir
      """

    When I try `wp core is-installed`
    Then STDERR should contain:
      """
      Error: This does not seem to be a WordPress install.
      """
    And the return code should be 1

    When I run `wp @testdir core is-installed`
    Then the return code should be 0

  Scenario: Error when invalid alias provided
    Given an empty directory

    When I try `wp @test option get home`
    Then STDERR should be:
      """
      Error: Alias '@test' not found.
      """

  Scenario: Treat global params as local when included in alias
    Given a WP install in 'testdir'
    And a wp-cli.yml file:
      """
      @testdir:
        path: testdir
      """

    When I run `wp @testdir option get home`
    Then STDOUT should be:
      """
      http://example.com
      """

    When I try `wp @testdir option get home --path=testdir`
    Then STDERR should contain:
      """
      Parameter errors:
      """
    And STDERR should contain:
      """
      unknown --path parameter
      """

    When I run `wp @testdir eval 'echo get_current_user_id();' --user=admin`
    Then STDOUT should be:
      """
      1
      """

    Given a wp-cli.yml file:
      """
      @testdir:
        path: testdir
        user: admin
      """

    When I run `wp @testdir eval 'echo get_current_user_id();'`
    Then STDOUT should be:
      """
      1
      """

    When I try `wp @testdir eval 'echo get_current_user_id();' --user=admin`
    Then STDERR should contain:
      """
      Parameter errors:
      """
    And STDERR should contain:
      """
      unknown --user parameter
      """

  Scenario: Support global params specific to the WordPress install, not WP-CLI generally
    Given a WP install in 'testdir'
{'fraction_non_alphanumeric': 0.0863689776733255, 'fraction_numerical': 0.0017626321974148062, 'mean_word_length': 2.103919781221513, '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': '2098289', 'n_tokens_mistral': 1005, 'n_tokens_neox': 967, 'n_words': 413}