Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mchev committed Feb 11, 2023
1 parent f866060 commit cdea5a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:>=2.62.1" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress
- name: Execute tests
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/IPBannedMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public function it_blocks_the_banned_ip()
{
$this->loadMigrationsFrom(__DIR__.'/../../database/migrations');

Banhammer::ban(['127.0.0.2']);
$ip = '127.0.0.1';

Banhammer::ban([$ip]);

$request = Request::create(config('app.url').'500', 'GET', [], [], [], ['REMOTE_ADDR' => $ip]);

$request = Request::create(config('app.url').'500', 'GET', [], [], [], ['REMOTE_ADDR' => '127.0.0.2']);
$middleware = new IPBanned();
$expectedStatusCode = 403;
try {
$middleware->handle($request, function () {
});
(new IPBanned())->handle($request, function () {});
} catch (HttpException $e) {
$this->assertEquals(403, $e->getStatusCode());
}
Expand Down

0 comments on commit cdea5a9

Please sign in to comment.