diff --git a/src/Console/Commands/LockoutDisable.php b/src/Console/Commands/LockoutDisable.php index afeb2a7e4cebad1c8a1c5a13934a7699e3087637..9c1eb8f499323d89068487e57ab6223c5405ed62 100644 --- a/src/Console/Commands/LockoutDisable.php +++ b/src/Console/Commands/LockoutDisable.php @@ -62,4 +62,3 @@ class LockoutDisable extends Command return Command::SUCCESS; } } - diff --git a/src/Console/Commands/LockoutEnable.php b/src/Console/Commands/LockoutEnable.php index f2d33723a1bd2838729f07db11b222cdb63c5fa6..e677c7eecb5c61d045d063270c805411fe258e91 100644 --- a/src/Console/Commands/LockoutEnable.php +++ b/src/Console/Commands/LockoutEnable.php @@ -62,4 +62,3 @@ class LockoutEnable extends Command return Command::SUCCESS; } } - diff --git a/src/Console/Commands/LockoutStatus.php b/src/Console/Commands/LockoutStatus.php index 617ffcca58239db5da5df966fb68b34dd4147652..5db3881e5f1a8fcf98de5938dc849d94bf1ef862 100644 --- a/src/Console/Commands/LockoutStatus.php +++ b/src/Console/Commands/LockoutStatus.php @@ -47,4 +47,3 @@ class LockoutStatus extends Command return Command::SUCCESS; } } - diff --git a/src/Events/LockoutDisabled.php b/src/Events/LockoutDisabled.php index 3fd9d2c93d4e05241ae86a277ed4784b11ff62be..32cb68ae598218a2be87f0c78c8d4c74f367a405 100644 --- a/src/Events/LockoutDisabled.php +++ b/src/Events/LockoutDisabled.php @@ -17,4 +17,3 @@ class LockoutDisabled // } } - diff --git a/src/Events/LockoutEnabled.php b/src/Events/LockoutEnabled.php index a8c420b3b1efe3c78350b8dfb1a4d19ecde72ae9..b69020267a77469d7ebeb4442cbd498bb5f8505d 100644 --- a/src/Events/LockoutEnabled.php +++ b/src/Events/LockoutEnabled.php @@ -17,4 +17,3 @@ class LockoutEnabled // } } - diff --git a/src/Events/RequestBlocked.php b/src/Events/RequestBlocked.php index 64dc3982857708d6520348703a8a11ed93be2d1e..050cccb1b541cc5814de20bfbfd64b45cb853292 100644 --- a/src/Events/RequestBlocked.php +++ b/src/Events/RequestBlocked.php @@ -3,8 +3,8 @@ namespace Rappasoft\Lockout\Events; use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; use Illuminate\Http\Request; +use Illuminate\Queue\SerializesModels; class RequestBlocked { @@ -20,4 +20,3 @@ class RequestBlocked // } } - diff --git a/src/Helpers/IpHelper.php b/src/Helpers/IpHelper.php index b189d57b49ef91a9a17349544fd5c305e7c93436..9676bfc05bb2511ac39c6b414520d7d449a29cbb 100644 --- a/src/Helpers/IpHelper.php +++ b/src/Helpers/IpHelper.php @@ -89,4 +89,3 @@ class IpHelper return array_map('trim', explode(',', $ipList)); } } - diff --git a/tests/AdvancedFeaturesTest.php b/tests/AdvancedFeaturesTest.php index 90b15ea12875b18fa8fe25b0536eb294065aed1b..aeb1a69f6a9296dd52e0c7eead2078760a39266e 100644 --- a/tests/AdvancedFeaturesTest.php +++ b/tests/AdvancedFeaturesTest.php @@ -3,11 +3,9 @@ namespace Rappasoft\Lockout\Tests; use Illuminate\Http\Response; -use Rappasoft\Lockout\Events\LockoutDisabled; -use Rappasoft\Lockout\Events\LockoutEnabled; -use Rappasoft\Lockout\Events\RequestBlocked; -use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\Event; +use Rappasoft\Lockout\Events\RequestBlocked; class AdvancedFeaturesTest extends TestCase { @@ -118,7 +116,7 @@ class AdvancedFeaturesTest extends TestCase $response = $this->withHeaders(['Accept' => 'application/json']) ->call('POST', 'api/test'); - + $response->assertStatus(Response::HTTP_UNAUTHORIZED); // Check if response is JSON (might be HTML if API detection fails) if ($response->headers->get('Content-Type') === 'application/json') { @@ -136,7 +134,7 @@ class AdvancedFeaturesTest extends TestCase // View might not exist in test environment, so test with json instead config(['lockout.response_type' => 'json']); - + $response = $this->call('POST', 'post'); $response->assertStatus(Response::HTTP_UNAUTHORIZED); $response->assertJson(['message' => 'Application is currently in read-only mode.']); @@ -212,4 +210,3 @@ class AdvancedFeaturesTest extends TestCase Event::assertNotDispatched(RequestBlocked::class); } } - diff --git a/tests/EdgeCasesTest.php b/tests/EdgeCasesTest.php index ea6c5e3685b0dd097b7cede2465b9aea10c7d2ee..5913cce2908bd29324852b44950a5a7d82d89bc5 100644 --- a/tests/EdgeCasesTest.php +++ b/tests/EdgeCasesTest.php @@ -151,7 +151,7 @@ class EdgeCasesTest extends TestCase // Verify custom path config is set and health check is enabled $this->assertEquals('custom-health', config('lockout.health_check_path')); $this->assertTrue(config('lockout.health_check_enabled')); - + // The actual route registration happens at service provider boot // In real applications, changing the path would require clearing route cache // This test verifies the configuration is properly stored and retrieved @@ -275,4 +275,3 @@ class EdgeCasesTest extends TestCase ->assertStatus(Response::HTTP_UNAUTHORIZED); } } - diff --git a/tests/IpHelperTest.php b/tests/IpHelperTest.php index 195c802353ade5bad9df93dbfe9ebd1adfa5f160..d7690277982fc940e4549d70b00e1a01a15a1bd2 100644 --- a/tests/IpHelperTest.php +++ b/tests/IpHelperTest.php @@ -33,7 +33,7 @@ class IpHelperTest extends TestCase public function multiple_ips_in_whitelist_work() { $whitelist = ['127.0.0.1', '192.168.1.0/24', '10.0.0.1']; - + $this->assertTrue(IpHelper::isIpAllowed('127.0.0.1', $whitelist)); $this->assertTrue(IpHelper::isIpAllowed('192.168.1.50', $whitelist)); $this->assertTrue(IpHelper::isIpAllowed('10.0.0.1', $whitelist)); @@ -70,7 +70,7 @@ class IpHelperTest extends TestCase public function parse_ip_list_from_string() { $result = IpHelper::parseIpList('127.0.0.1,192.168.1.1,10.0.0.0/8'); - + $this->assertEquals(['127.0.0.1', '192.168.1.1', '10.0.0.0/8'], $result); } @@ -78,7 +78,7 @@ class IpHelperTest extends TestCase public function parse_ip_list_handles_spaces() { $result = IpHelper::parseIpList('127.0.0.1, 192.168.1.1 , 10.0.0.0/8'); - + $this->assertEquals(['127.0.0.1', '192.168.1.1', '10.0.0.0/8'], $result); } @@ -107,10 +107,9 @@ class IpHelperTest extends TestCase // /32 should match only exact IP $this->assertTrue(IpHelper::isIpAllowed('192.168.1.1', ['192.168.1.1/32'])); $this->assertFalse(IpHelper::isIpAllowed('192.168.1.2', ['192.168.1.1/32'])); - + // /0 should match everything (entire IPv4 range) $this->assertTrue(IpHelper::isIpAllowed('0.0.0.0', ['0.0.0.0/0'])); $this->assertTrue(IpHelper::isIpAllowed('255.255.255.255', ['0.0.0.0/0'])); } } - diff --git a/tests/RoleBasedTest.php b/tests/RoleBasedTest.php index c49ca8725ae59214f18470abceccf00b1f6071c8..b417dabf46c6f2aad2f9cf90c6a75a6718d50594 100644 --- a/tests/RoleBasedTest.php +++ b/tests/RoleBasedTest.php @@ -2,8 +2,8 @@ namespace Rappasoft\Lockout\Tests; -use Illuminate\Http\Response; use Illuminate\Foundation\Auth\User as Authenticatable; +use Illuminate\Http\Response; class RoleBasedTest extends TestCase { @@ -14,7 +14,8 @@ class RoleBasedTest extends TestCase config(['lockout.locked_types' => ['post']]); config(['lockout.allowed_roles' => ['admin']]); - $user = new class extends Authenticatable { + $user = new class extends Authenticatable + { public $role = 'admin'; }; @@ -30,7 +31,8 @@ class RoleBasedTest extends TestCase config(['lockout.locked_types' => ['post']]); config(['lockout.allowed_roles' => ['admin']]); - $user = new class extends Authenticatable { + $user = new class extends Authenticatable + { public $role = 'user'; }; @@ -46,7 +48,8 @@ class RoleBasedTest extends TestCase config(['lockout.locked_types' => ['post']]); config(['lockout.allowed_roles' => ['admin']]); - $user = new class extends Authenticatable { + $user = new class extends Authenticatable + { public function hasRole($role) { return $role === 'admin'; @@ -76,15 +79,18 @@ class RoleBasedTest extends TestCase config(['lockout.locked_types' => ['post']]); config(['lockout.allowed_roles' => ['admin', 'super-admin', 'maintenance']]); - $admin = new class extends Authenticatable { + $admin = new class extends Authenticatable + { public $role = 'admin'; }; - $superAdmin = new class extends Authenticatable { + $superAdmin = new class extends Authenticatable + { public $role = 'super-admin'; }; - $maintenance = new class extends Authenticatable { + $maintenance = new class extends Authenticatable + { public $role = 'maintenance'; }; @@ -108,7 +114,8 @@ class RoleBasedTest extends TestCase config(['lockout.locked_types' => ['post']]); config(['lockout.allowed_roles' => []]); - $user = new class extends Authenticatable { + $user = new class extends Authenticatable + { public $role = 'admin'; }; @@ -116,6 +123,4 @@ class RoleBasedTest extends TestCase ->call('POST', 'post') ->assertStatus(Response::HTTP_UNAUTHORIZED); } - } - diff --git a/tests/TestCase.php b/tests/TestCase.php index 928c1a4ba1e31816527a52f849545721c64e30b9..ef9d54df6ba3ff2a8008d07fc7a718fab188fb02 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -108,7 +108,7 @@ class TestCase extends \Orchestra\Testbench\TestCase } /** - * @param $view + * @param $view * @param array $parameters * @return string */