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

spammerIpTracking running even if Honey::disable() is called #47

Open
jbajou opened this issue Nov 24, 2021 · 3 comments
Open

spammerIpTracking running even if Honey::disable() is called #47

jbajou opened this issue Nov 24, 2021 · 3 comments

Comments

@jbajou
Copy link

jbajou commented Nov 24, 2021

Hello,

I'm trying to deactivate any action from this package in my tests (as it doesn't make sense + I don't have to setup spammers table, etc).

My problem is that it still tries to access the spammers table even if I call Honey::disable();.

My honey.environments is as follow:

'environments' => [
        'production',
    ],

Any idea how I could disable all actions from the package to run my tests ?

Thank you!

@jbajou
Copy link
Author

jbajou commented Nov 29, 2021

hello!
I checked a bit the code and it doesn't look like this feature can be disabled by the environments key and that the only way to not run is to remove it from the features key.

Can anyone confirm ?

@lukeraymonddowning
Copy link
Owner

Hey @jbajou,

can you post your findings here?

@jbajou
Copy link
Author

jbajou commented Feb 5, 2022

hey @lukeraymonddowning. Sorry for not getting back here sooner.

Turned out I need to disable Honey as follow:

public function setupUp() : void 
{
        parent::setUp();
        config(['honey.features' => []]);
        Honey::disable();
        // More cool stuff here
}

If I don't explicitly reset honey.features, the spammers test is still done.
I can't remember much about it, but I think it's linked to the test being done in the constructor

if (Features::spammerIpTrackingIsEnabled()) {

Hope that helps

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

2 participants