-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from lukeraymonddowning/disabling
Allows disabling of Honey and environment detection.
- Loading branch information
Showing
9 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":5728:{a:2:{s:7:"defects";a:22:{s:87:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_requires_a_present_but_unfilled_check";i:5;s:82:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_has_a_present_but_unfilled_check";i:4;s:66:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_has_a_time_check";i:4;s:76:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::the_handler_can_be_configured";i:4;s:103:"Lukeraymonddowning\Honey\Tests\FailHooksTest::hooks_can_be_fired_before_the_registered_fail_takes_place";i:4;s:123:"Lukeraymonddowning\Honey\Tests\SpammerBlockTest::if_an_ip_address_hits_the_maximum_spam_attempts_they_are_marked_as_blocked";i:4;s:131:"Lukeraymonddowning\Honey\Tests\Feature\SpammerBlockTest::if_an_ip_address_hits_the_maximum_spam_attempts_they_are_marked_as_blocked";i:4;s:91:"Lukeraymonddowning\Honey\Tests\BladeComponentTest::it_registers_a_blade_component_for_honey";i:4;s:92:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_blocks_known_spammers";i:3;s:103:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_skips_if_the_feature_is_disabled";i:5;s:92:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_blocks_known_spammers";i:4;s:104:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_allows_unblocked_spammers_through";i:5;s:94:"Lukeraymonddowning\Honey\Tests\AlpineInputFilledCheckTest::it_requires_the_exact_defined_input";i:3;s:97:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_can_return_a_score_based_on_the_given_token";i:4;s:136:"Lukeraymonddowning\Honey\Tests\EnsureRecaptchaPassesCheckTest::it_submits_the_token_to_recaptcha_and_ensures_the_score_meets_the_minimum";i:4;s:106:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_throws_an_exception_with_the_error_codes_if_it_fails";i:3;s:105:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::you_can_call_the_check_token_as_many_times_as_you_want";i:3;s:105:"Lukeraymonddowning\Honey\Tests\EnsureRecaptchaPassesCheckTest::it_fails_if_the_score_is_below_the_minimum";i:4;s:139:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_submits_the_token_to_recaptcha_and_ensures_the_score_meets_the_minimum";i:4;s:108:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_the_score_is_below_the_minimum";i:4;s:98:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_the_token_is_missing";i:5;s:100:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_an_exception_is_thrown";i:4;}s:5:"times";a:27:{s:87:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_requires_a_present_but_unfilled_check";d:0.042;s:82:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_has_a_present_but_unfilled_check";d:0.003;s:66:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_has_a_time_check";d:0.003;s:76:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::the_handler_can_be_configured";d:0.003;s:81:"Lukeraymonddowning\Honey\Tests\BladeComponentTest::it_registers_a_blade_component";d:0.041;s:91:"Lukeraymonddowning\Honey\Tests\BladeComponentTest::it_registers_a_blade_component_for_honey";d:0.003;s:103:"Lukeraymonddowning\Honey\Tests\FailHooksTest::hooks_can_be_fired_before_the_registered_fail_takes_place";d:0.003;s:123:"Lukeraymonddowning\Honey\Tests\SpammerBlockTest::if_an_ip_address_hits_the_maximum_spam_attempts_they_are_marked_as_blocked";d:0.058;s:131:"Lukeraymonddowning\Honey\Tests\Feature\SpammerBlockTest::if_an_ip_address_hits_the_maximum_spam_attempts_they_are_marked_as_blocked";d:0.007;s:92:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_blocks_known_spammers";d:0.007;s:104:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_allows_unblocked_spammers_through";d:0.006;s:96:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_allows_new_people_through";d:0.006;s:103:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_skips_if_the_feature_is_disabled";d:0.007;s:92:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_blocks_known_spammers";d:0.061;s:104:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_allows_unblocked_spammers_through";d:0.007;s:107:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_allows_anybody_not_a_spammer_through";d:0.007;s:94:"Lukeraymonddowning\Honey\Tests\AlpineInputFilledCheckTest::it_requires_the_exact_defined_input";d:0.049;s:97:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_can_return_a_score_based_on_the_given_token";d:0.003;s:136:"Lukeraymonddowning\Honey\Tests\EnsureRecaptchaPassesCheckTest::it_submits_the_token_to_recaptcha_and_ensures_the_score_meets_the_minimum";d:0.003;s:105:"Lukeraymonddowning\Honey\Tests\EnsureRecaptchaPassesCheckTest::it_fails_if_the_score_is_below_the_minimum";d:0.003;s:106:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_throws_an_exception_with_the_error_codes_if_it_fails";d:0.003;s:105:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::you_can_call_the_check_token_as_many_times_as_you_want";d:0.003;s:139:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_submits_the_token_to_recaptcha_and_ensures_the_score_meets_the_minimum";d:0.014;s:108:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_the_score_is_below_the_minimum";d:0.003;s:98:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_the_token_is_missing";d:0.003;s:100:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_an_exception_is_thrown";d:0.01;s:97:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_can_chain_recaptcha_methods_after_the_check";d:0.003;}}} | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":6522:{a:2:{s:7:"defects";a:26:{s:87:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_requires_a_present_but_unfilled_check";i:5;s:82:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_has_a_present_but_unfilled_check";i:3;s:66:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_has_a_time_check";i:3;s:76:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::the_handler_can_be_configured";i:3;s:103:"Lukeraymonddowning\Honey\Tests\FailHooksTest::hooks_can_be_fired_before_the_registered_fail_takes_place";i:5;s:123:"Lukeraymonddowning\Honey\Tests\SpammerBlockTest::if_an_ip_address_hits_the_maximum_spam_attempts_they_are_marked_as_blocked";i:4;s:131:"Lukeraymonddowning\Honey\Tests\Feature\SpammerBlockTest::if_an_ip_address_hits_the_maximum_spam_attempts_they_are_marked_as_blocked";i:4;s:91:"Lukeraymonddowning\Honey\Tests\BladeComponentTest::it_registers_a_blade_component_for_honey";i:4;s:92:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_blocks_known_spammers";i:3;s:103:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_skips_if_the_feature_is_disabled";i:5;s:92:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_blocks_known_spammers";i:3;s:104:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_allows_unblocked_spammers_through";i:5;s:94:"Lukeraymonddowning\Honey\Tests\AlpineInputFilledCheckTest::it_requires_the_exact_defined_input";i:3;s:97:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_can_return_a_score_based_on_the_given_token";i:4;s:136:"Lukeraymonddowning\Honey\Tests\EnsureRecaptchaPassesCheckTest::it_submits_the_token_to_recaptcha_and_ensures_the_score_meets_the_minimum";i:4;s:106:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_throws_an_exception_with_the_error_codes_if_it_fails";i:3;s:105:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::you_can_call_the_check_token_as_many_times_as_you_want";i:3;s:105:"Lukeraymonddowning\Honey\Tests\EnsureRecaptchaPassesCheckTest::it_fails_if_the_score_is_below_the_minimum";i:4;s:139:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_submits_the_token_to_recaptcha_and_ensures_the_score_meets_the_minimum";i:4;s:108:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_the_score_is_below_the_minimum";i:3;s:98:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_the_token_is_missing";i:3;s:100:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_an_exception_is_thrown";i:4;s:99:"Lukeraymonddowning\Honey\Tests\EnvironmentDisableTest::it_is_only_enabled_in_specified_environments";i:4;s:67:"Lukeraymonddowning\Honey\Tests\EnvironmentDisableTest::it_wont_work";i:5;s:98:"Lukeraymonddowning\Honey\Tests\EnvironmentDisableTest::check_will_always_return_true_when_disabled";i:3;s:77:"Lukeraymonddowning\Honey\Tests\ManualDisableTest::it_can_be_disabled_manually";i:4;}s:5:"times";a:31:{s:87:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_requires_a_present_but_unfilled_check";d:0.042;s:82:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_has_a_present_but_unfilled_check";d:0.003;s:66:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::it_has_a_time_check";d:0.003;s:76:"Lukeraymonddowning\Honey\Tests\MiddlewareTest::the_handler_can_be_configured";d:0.003;s:81:"Lukeraymonddowning\Honey\Tests\BladeComponentTest::it_registers_a_blade_component";d:0.041;s:91:"Lukeraymonddowning\Honey\Tests\BladeComponentTest::it_registers_a_blade_component_for_honey";d:0.003;s:103:"Lukeraymonddowning\Honey\Tests\FailHooksTest::hooks_can_be_fired_before_the_registered_fail_takes_place";d:0.003;s:123:"Lukeraymonddowning\Honey\Tests\SpammerBlockTest::if_an_ip_address_hits_the_maximum_spam_attempts_they_are_marked_as_blocked";d:0.058;s:131:"Lukeraymonddowning\Honey\Tests\Feature\SpammerBlockTest::if_an_ip_address_hits_the_maximum_spam_attempts_they_are_marked_as_blocked";d:0.007;s:92:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_blocks_known_spammers";d:0.007;s:104:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_allows_unblocked_spammers_through";d:0.007;s:96:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_allows_new_people_through";d:0.007;s:103:"Lukeraymonddowning\Honey\Tests\Feature\UserIsKnownSpammerCheckTest::it_skips_if_the_feature_is_disabled";d:0.007;s:92:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_blocks_known_spammers";d:0.051;s:104:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_allows_unblocked_spammers_through";d:0.007;s:107:"Lukeraymonddowning\Honey\Tests\Feature\BlockSpammersMiddlewareTest::it_allows_anybody_not_a_spammer_through";d:0.007;s:94:"Lukeraymonddowning\Honey\Tests\AlpineInputFilledCheckTest::it_requires_the_exact_defined_input";d:0.044;s:97:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_can_return_a_score_based_on_the_given_token";d:0.003;s:136:"Lukeraymonddowning\Honey\Tests\EnsureRecaptchaPassesCheckTest::it_submits_the_token_to_recaptcha_and_ensures_the_score_meets_the_minimum";d:0.003;s:105:"Lukeraymonddowning\Honey\Tests\EnsureRecaptchaPassesCheckTest::it_fails_if_the_score_is_below_the_minimum";d:0.003;s:106:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_throws_an_exception_with_the_error_codes_if_it_fails";d:0.003;s:105:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::you_can_call_the_check_token_as_many_times_as_you_want";d:0.003;s:139:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_submits_the_token_to_recaptcha_and_ensures_the_score_meets_the_minimum";d:0.01;s:108:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_the_score_is_below_the_minimum";d:0.003;s:98:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_the_token_is_missing";d:0.002;s:100:"Lukeraymonddowning\Honey\Tests\CheckRecaptchaTokenMiddlewareTest::it_fails_if_an_exception_is_thrown";d:0.009;s:97:"Lukeraymonddowning\Honey\Tests\RecaptchaTokenTest::it_can_chain_recaptcha_methods_after_the_check";d:0.003;s:99:"Lukeraymonddowning\Honey\Tests\EnvironmentDisableTest::it_is_only_enabled_in_specified_environments";d:0.002;s:67:"Lukeraymonddowning\Honey\Tests\EnvironmentDisableTest::it_wont_work";d:0.003;s:98:"Lukeraymonddowning\Honey\Tests\EnvironmentDisableTest::check_will_always_return_true_when_disabled";d:0.003;s:77:"Lukeraymonddowning\Honey\Tests\ManualDisableTest::it_can_be_disabled_manually";d:0.043;}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
|
||
namespace Lukeraymonddowning\Honey\Tests; | ||
|
||
|
||
use Lukeraymonddowning\Honey\Facades\Honey; | ||
|
||
class EnvironmentDisableTest extends TestCase | ||
{ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
parent::getEnvironmentSetUp($app); | ||
$app['config']->set('app.env', 'local'); | ||
} | ||
|
||
/** @test */ | ||
public function it_is_only_enabled_in_specified_environments() | ||
{ | ||
// If Honey is not disabled, it will throw an exception here | ||
Honey::fail(); | ||
$this->expectNotToPerformAssertions(); | ||
} | ||
|
||
/** @test */ | ||
public function check_will_always_return_true_when_disabled() | ||
{ | ||
$this->assertTrue(Honey::check([])); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
|
||
namespace Lukeraymonddowning\Honey\Tests; | ||
|
||
|
||
use Lukeraymonddowning\Honey\Facades\Honey; | ||
|
||
class ManualDisableTest extends TestCase | ||
{ | ||
|
||
/** @test */ | ||
public function it_can_be_disabled_manually() | ||
{ | ||
$this->assertTrue(Honey::isEnabled()); | ||
Honey::disable(); | ||
$this->assertFalse(Honey::isEnabled()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters