Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suite hooks defined with Attributes not working #1435

Open
rrajkomar opened this issue Jun 6, 2023 · 3 comments
Open

Suite hooks defined with Attributes not working #1435

rrajkomar opened this issue Jun 6, 2023 · 3 comments

Comments

@rrajkomar
Copy link

When I define a BeforeSuite hook using the attribute syntax, the method is never run.

use Behat\Testwork\Hook\Call\BeforeSuite;
[...]
#[BeforeSuite]
public static function beforeSuite(): void
{
    echo 'Not run';
}

but when using the annotation syntax it works

/** @BeforeSuite */
public static function beforeSuite(): void
{
    echo 'Not run';
}

Maybe this is the expected behaviour but it is counter intuitive as the documentation refers to the Behat\Testwork\Hook\Call\BeforeSuite as the correct class to use to hook before the suite is ran

@stof
Copy link
Member

stof commented Jul 6, 2023

Attribute classes for hooks are in the Behat\Hook namespace. But it looks like the attribute reader has not been implemented with the full list of hooks but a partial list.

@stof
Copy link
Member

stof commented Jul 6, 2023

@rpkamp was there a specific reason to implement only a subset of hooks in #1372 ?

@rpkamp
Copy link
Contributor

rpkamp commented Aug 10, 2023

No, no specific reason. I guess it was just an oversight :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants