<commit_before>@pll-term
Feature: Manage WordPress taxonomy terms and their translations.

  Background:
    Given a WP install
    And I run `wp plugin install polylang`
    And I run `wp plugin activate polylang`
    And I run `wp pll lang create Dutch nl nl_NL`
    And I run `wp pll doctor translate`

  Scenario: Delete a term and its translations

    When I try `wp pll term delete chewbacca 42`
    Then STDERR should contain:
    """
    Error: chewbacca is not a registered taxonomy.
    """
    And the return code should be 1

    When I try `wp pll term delete link_category 101`
    Then STDERR should be:
    """
    Error: Polylang does not manage languages and translations for this taxonomy.
    """

    When I run `wp pll lang create de de de_DE`
    Then STDOUT should not be empty

    When I run `wp pll term generate post_tag --count=3 --format=ids`
    Then STDOUT should not be empty

    When I run `wp pll term delete post_tag 9`
    Then STDOUT should contain:
    """
    Deleted post_tag 9.
    Deleted post_tag 10.
    Success: Deleted 2 of 2 terms.
    """
    And the return code should be 0

    When I run `wp pll term delete post_tag 12`
    Then STDOUT should contain:
    """
    Deleted post_tag 12.
    Deleted post_tag 11.
    Success: Deleted 2 of 2 terms.
    """
    And the return code should be 0

  @pll-term-list
  Scenario: List taxonomy terms for a language

    When I run `wp pll lang create de de de_DE && wp pll term generate post_tag --count=3 --format=ids`
    Then STDOUT should not be empty

    When I run `wp pll term list post_tag nl --format=ids`
    Then STDOUT should contain:
    """
    11 13 9
    """
    And the return code should be 0

    When I run `wp pll term list post_tag de --format=ids`
    Then STDOUT should contain:
    """
    12 14 10
    """
    And the return code should be 0<commit_msg>add tests for 'wp pll term duplicate'<commit_after>@pll-term
Feature: Manage WordPress taxonomy terms and their translations.

  Background:
    Given a WP install
    And I run `wp plugin install polylang`
    And I run `wp plugin activate polylang`
    And I run `wp pll lang create Dutch nl nl_NL`
    And I run `wp pll doctor translate`

  Scenario: Delete a term and its translations

    When I try `wp pll term delete chewbacca 42`
    Then STDERR should contain:
    """
    Error: chewbacca is not a registered taxonomy.
    """
    And the return code should be 1

    When I try `wp pll term delete link_category 101`
    Then STDERR should be:
    """
    Error: Polylang does not manage languages and translations for this taxonomy.
    """

    When I run `wp pll lang create de de de_DE`
    Then STDOUT should not be empty

    When I run `wp pll term generate post_tag --count=3 --format=ids`
    Then STDOUT should not be empty

    When I run `wp pll term delete post_tag 9`
    Then STDOUT should contain:
    """
    Deleted post_tag 9.
    Deleted post_tag 10.
    Success: Deleted 2 of 2 terms.
    """
    And the return code should be 0

    When I run `wp pll term delete post_tag 12`
    Then STDOUT should contain:
    """
    Deleted post_tag 12.
    Deleted post_tag 11.
    Success: Deleted 2 of 2 terms.
    """
    And the return code should be 0

  @pll-term-list
  Scenario: List taxonomy terms for a language

    When I run `wp pll lang create de de de_DE && wp pll term generate post_tag --count=3 --format=ids`
    Then STDOUT should not be empty

    When I run `wp pll term list post_tag nl --format=ids`
    Then STDOUT should contain:
    """
    11 13 9
    """
    And the return code should be 0

    When I run `wp pll term list post_tag de --format=ids`
    Then STDOUT should contain:
    """
    12 14 10
    """
    And the return code should be 0

  @pll-term-duplicate
  Scenario: Duplicate taxonomy term to one or more languages

    When I run `wp pll lang create de de de_DE`
    And I run `wp term create post_tag "Just a tag" --porcelain`
    And save STDOUT as {TERM_ID}
    And I run `wp pll doctor translate`
    Then STDOUT should not be empty

    When I run `wp pll term duplicate post_tag {TERM_ID}`
    Then STDOUT should contain:
    """
    Success: Created term 11 (de) < term {TERM_ID} (nl)
    """
    And the return code should be 0
{'fraction_non_alphanumeric': 0.06147732585320243, 'fraction_numerical': 0.017999064983637212, 'mean_word_length': 2.536363636363636, 'pattern_counts': {'":': 0, '<': 4, '<?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': '5964123', 'n_tokens_mistral': 1411, 'n_tokens_neox': 1312, 'n_words': 638}