<commit_before>Feature:
    In order to avoid repeating myself
    As a Symfony developer
    I should be able to re-use a method, runnable before any of a Controller class Actions, with Annotations

    Background:
        Given I have a Symfony HttpKernel

    Scenario: Run a Controller class self-contained method before running any of its Actions
        Given I have a Controller class with a @Before("beforeAction") Class Annotation
        And a self-contained method in a Controller with the following content:
            """
            public function beforeAction()
            {
                $this->controllerState[] = 'beforeAnyAction';
            }
            """
        And I have a Symfony ControllerListener
        When I run the Controller Action through the Symfony Kernel
        Then I should have a "controllerResponse" Http Response content
        And I should have "beforeAnyAction/controllerAction" strings in the Controller state

    Scenario: Run a Controller class self-contained method before running any of its Actions, with a params transmission
        Given I have a Controller class with a @Before("beforeAction", args={"Good morning", "Mr. Phelps"}) Class Annotation
        And a self-contained method in a Controller with the following content:
            """
            public function beforeAction($goodMorning, $who)
            {
                $this->controllerState[] = $goodMorning.' '.$who;
            }
            """
        And I have a Symfony ControllerListener
        When I run the Controller Action through the Symfony Kernel
        Then I should have a "controllerResponse" Http Response content
        And I should have "Good morning Mr. Phelps/controllerAction" strings in the Controller state

    Scenario: Run a Controller class self-contained method which short-circuit any of its Actions
        Given I have a Controller class with a @Before("beforeAction") Class Annotation
        And a self-contained method in a Controller with the following content:
            """
            public function beforeAction()
            {
                return new Response('beforeResponse');<commit_msg>Still WIP on Behat tests: added a "Multiple Class Before hooks" Scenario<commit_after>Feature:
    In order to avoid repeating myself
    As a Symfony developer
    I should be able to re-use a method, runnable before any of a Controller class Actions, with Annotations

    Background:
        Given I have a Symfony HttpKernel

    Scenario: Run a Controller class self-contained method before running any of its Actions
        Given I have a Controller class with a @Before("beforeAction") Class Annotation
        And a self-contained method in a Controller with the following content:
            """
            public function beforeAction()
            {
                $this->controllerState[] = 'beforeAnyAction';
            }
            """
        And I have a Symfony ControllerListener
        When I run the Controller Action through the Symfony Kernel
        Then I should have a "controllerResponse" Http Response content
        And I should have "beforeAnyAction/controllerAction" strings in the Controller state

    Scenario: Run a Controller class self-contained method before running any of its Actions, with a params transmission
        Given I have a Controller class with a @Before("beforeAction", args={"Good morning", "Mr. Phelps"}) Class Annotation
        And a self-contained method in a Controller with the following content:
            """
            public function beforeAction($goodMorning, $who)
            {
                $this->controllerState[] = $goodMorning.' '.$who;
            }
            """
        And I have a Symfony ControllerListener
        When I run the Controller Action through the Symfony Kernel
        Then I should have a "controllerResponse" Http Response content
        And I should have "Good morning Mr. Phelps/controllerAction" strings in the Controller state

    Scenario: Run multiple Controller class self-contained methods before running any of its target Action, with a params transmission
        Given I have a Controller class with a @Before("beforeAction", args={"Good morning", "Mr. Phelps"}) Class Annotation
        And a @Before("beforeAction", args={"Well", "nobody’s perfect!"}) Class Annotation
        And a self-contained method in a Controller with the following content:
            """
            public function beforeAction($arg1, $arg2)
            {
                $this->controllerState[] = $arg1.' '.$arg2;
            }
            """
        And I have a Symfony ControllerListener
        When I run the Controller Action through the Symfony Kernel
        Then I should have a "controllerResponse" Http Response content
        And I should have "Good morning Mr. Phelps/Well nobody’s perfect!/controllerAction" strings in the Controller state

    Scenario: Run a Controller class self-contained method which short-circuit any of its Actions
        Given I have a Controller class with a @Before("beforeAction") Class Annotation
        And a self-contained method in a Controller with the following content:
            """
            public function beforeAction()
            {
                return new Response('beforeResponse');
{'fraction_non_alphanumeric': 0.05668168168168168, 'fraction_numerical': 0.0007507507507507507, 'mean_word_length': 2.533819628647215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '2490936', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1157, 'n_words': 589}