<commit_before>Feature: Step Arguments Transformations
  In order to follow DRY
  As a feature writer
  I need to be able to move common
  arguments transformations
  into transformation functions

  Background:
    Given a standard Behat project directory structure
    And a file named "features/support/env.php" with:
      """
      <?php
      require_once 'PHPUnit/Autoload.php';
      require_once 'PHPUnit/Framework/Assert/Functions.php';
      """
    And a file named "features/steps/user.php" with:
      """
      <?php
      class User
      {
          private $username;

          public function __construct($username) { $this->username = $username; }
          public function getUsername() { return $this->username; }
      }

      $steps->Transform('/"([^"]+)" user/', function($username) {
          return new User($username);
      });

      $steps->Given('/I am ("\w+" user)/', function($world, $user) {
          assertInstanceOf('User', $user);
          $world->user = $user;
      });

      $steps->Then('/Username must be "([^"]+)"/', function($world, $username) {
          assertEquals($username, $world->user->getUsername());
      });
      """
    And a file named "features/World.feature" with:
      """
      Feature: Step Arguments
        Scenario:
          Given I am "everzet" user
          Then Username must be "everzet"

        Scenario:
          Given I am "antono" user
          Then Username must be "antono"
      """

  Scenario:
    When I run "behat -f progress"
    Then it should pass with:
      """
      ....
      
      2 scenarios (2 passed)
      4 steps (4 passed)
      """<commit_msg>added table transformations failing scenario<commit_after>Feature: Step Arguments Transformations
  In order to follow DRY
  As a feature writer
  I need to be able to move common
  arguments transformations
  into transformation functions

  Background:
    Given a standard Behat project directory structure
    And a file named "features/support/env.php" with:
      """
      <?php
      require_once 'PHPUnit/Autoload.php';
      require_once 'PHPUnit/Framework/Assert/Functions.php';
      """
    And a file named "features/steps/user.php" with:
      """
      <?php
      class User
      {
          private $username;
          private $age;

          public function __construct($username, $age = 20) { $this->username = $username; $this->age = $age; }
          public function getUsername() { return $this->username; }
          public function getAge() { return $this->age; }
      }

      $steps->Transform('/"([^"]+)" user/', function($username) {
          return new User($username);
      });

      $steps->Transform('/^table:username,age$/', function($table) {
          $hash     = $table->getHash();
          $username = $hash[0]['username'];
          $age      = $hash[0]['age'];

          return new User($username, $age);
      });

      $steps->Given('/I am ("\w+" user)/', function($world, $user) {
          assertInstanceOf('User', $user);
          $world->user = $user;
      });

      $steps->Given('/I am user:/', function($world, $user) {
          $world->user = $user;
      });

      $steps->Then('/Username must be "([^"]+)"/', function($world, $username) {
          assertEquals($username, $world->user->getUsername());
      });

      $steps->Then('/Age must be (\d+)/', function($world, $age) {
          assertEquals($age, $world->user->getAge());
      });
      """

  Scenario: Simple Arguments Transformations
    Given a file named "features/step_arguments.feature" with:
      """
      Feature: Step Arguments
        Scenario:
          Given I am "everzet" user
          Then Username must be "everzet"
          And Age must be 20

        Scenario:
          Given I am "antono" user
          Then Username must be "antono"
          And Age must be 20
      """
    When I run "behat -f progress"
    Then it should pass with:
      """
      ......
      
      2 scenarios (2 passed)
      6 steps (6 passed)
      """

  Scenario: Table Arguments Transformations
    Given a file named "features/table_arguments.feature" with:
      """
      Feature: Step Arguments
        Scenario:
          Given I am user:
            | username | age |
            | ever.zet | 22  |
          Then Username must be "ever.zet"
          And Age must be 22

        Scenario:
          Given I am user:
            | username | age |
            | vasiljev | 30  |
          Then Username must be "vasiljev"
          And Age must be 30
      """
    When I run "behat -f progress"
    Then it should pass with:
      """
      ......
      
      2 scenarios (2 passed)
      6 steps (6 passed)
      """

{'fraction_non_alphanumeric': 0.1306926498623173, 'fraction_numerical': 0.00593094683329803, 'mean_word_length': 1.9829437776373973, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 28, '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': '5553966', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1293, 'n_words': 405}