-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: editor config for github actions workflow chore: update composer to support Laravel 11 chore: update workflow to test L11, L10 and L9 * WIP * Fix Tests * Fix missing class import * Fix Tests * WIP Change to pest functions * Fix typo * Fix tests to use Pest functions * Fix * Fix * Remove lint script
- Loading branch information
1 parent
9efadad
commit 64dde90
Showing
13 changed files
with
287 additions
and
281 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 |
---|---|---|
|
@@ -13,3 +13,6 @@ trim_trailing_whitespace = true | |
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
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,43 +1,48 @@ | ||
name: Run tests | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
php-tests: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- php: 8.2 | ||
illuminate: ^10.0 | ||
- php: 8.1 | ||
illuminate: ^9.0 | ||
- php: 8.1 | ||
illuminate: ^8.0 | ||
- php: 8.0 | ||
illuminate: ^8.0 | ||
- php: 8.0 | ||
illuminate: ^7.0 | ||
- php: 7.4 | ||
illuminate: ^7.0 | ||
|
||
name: PHP ${{ matrix.php }} - Illuminate ${{ matrix.illuminate }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
|
||
- name: Update composer | ||
run: composer self-update --2 | ||
|
||
- name: Install dependencies | ||
run: composer require "illuminate/support:${{ matrix.illuminate }}" --no-interaction --no-progress --no-suggest | ||
|
||
- name: Execute tests | ||
run: composer test | ||
php-tests: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php: [8.3, 8.2, 8.1, 8.0] | ||
laravel: [11.*, 10.*, 9.*] | ||
dependency-version: [prefer-lowest, prefer-stable] | ||
exclude: | ||
- laravel: 11.* | ||
php: 8.1 | ||
- laravel: 11.* | ||
php: 8.0 | ||
- laravel: 10.* | ||
php: 8.0 | ||
- laravel: 9.* | ||
php: 8.3 | ||
- laravel: 9.* | ||
php: 8.2 | ||
|
||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, curl, libxml, mbstring, zip | ||
tools: composer:v2 | ||
coverage: none | ||
|
||
- name: Install dependencies | ||
run: | | ||
composer require "illuminate/support:${{ matrix.laravel }}" --no-interaction --no-progress --no-suggest | ||
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress | ||
- name: Execute tests | ||
run: composer test |
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
composer.lock | ||
.DS_Store | ||
.phpunit.result.cache | ||
.phpunit.cache | ||
phpunit-output |
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,33 +1,35 @@ | ||
{ | ||
"name": "olssonm/l5-very-basic-auth", | ||
"description": "Laravel stateless HTTP basic auth without the need for a database", | ||
"license": "MIT", | ||
"keywords": [ | ||
"olssonm", | ||
"laravel", | ||
"authentication", | ||
"http basic auth" | ||
], | ||
"homepage": "https://github.com/olssonm/l5-very-basic-auth", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Marcus Olsson", | ||
"email": "[email protected]", | ||
"homepage": "https://marcusolsson.me" | ||
} | ||
], | ||
"homepage": "https://github.com/olssonm/l5-very-basic-auth", | ||
"require": { | ||
"illuminate/support": "^7.0|^8.0|^9.0|^10.0", | ||
"php": "~7.4|^8.0", | ||
"php": "^8.0 || ^8.1 || ^8.2", | ||
"illuminate/support": "^9.0 || ^10.0 || ^11.0", | ||
"squizlabs/php_codesniffer": "^3.5" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.0", | ||
"orchestra/testbench": ">=5.0", | ||
"laravel/helpers": "^1.1", | ||
"pestphp/pest": "^1.0", | ||
"pestphp/pest-plugin-laravel": "^1.2" | ||
"orchestra/testbench": "^7.0 || ^8.0 || ^9.0", | ||
"pestphp/pest": "^1.0 || ^2.0", | ||
"pestphp/pest-plugin-laravel": "^1.2 || ^2.0", | ||
"phpunit/phpunit": "^9.0 || ^10.5" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"autoload": { | ||
"psr-4": { | ||
"Olssonm\\VeryBasicAuth\\": "src" | ||
|
@@ -38,26 +40,25 @@ | |
"Olssonm\\VeryBasicAuth\\Tests\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"phpsniff": "vendor/bin/phpcs --standard=\"PSR12\" ./src --ignore=./src/resources/*", | ||
"phpfix": "vendor/bin/phpcbf --standard=\"PSR12\" ./src --ignore=./src/resources/*", | ||
"test": "vendor/bin/pest" | ||
"config": { | ||
"allow-plugins": { | ||
"pestphp/pest-plugin": true | ||
}, | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "6.x-dev" | ||
"dev-master": "11.x-dev" | ||
}, | ||
"laravel": { | ||
"providers": [ | ||
"Olssonm\\VeryBasicAuth\\VeryBasicAuthServiceProvider" | ||
] | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"config": { | ||
"allow-plugins": { | ||
"pestphp/pest-plugin": true | ||
} | ||
"scripts": { | ||
"phpfix": "vendor/bin/phpcbf --standard=\"PSR12\" ./src --ignore=./src/resources/*", | ||
"phpsniff": "vendor/bin/phpcs --standard=\"PSR12\" ./src --ignore=./src/resources/*", | ||
"test": "vendor/bin/pest" | ||
} | ||
} |
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,25 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="false" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
colors="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
cacheDirectory=".phpunit.cache" | ||
backupStaticProperties="false" | ||
> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<file>./tests/VeryBasicAuthTests.php</file> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<source> | ||
<include> | ||
<directory>src</directory> | ||
<exclude> | ||
<directory suffix=".blade.php">src</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
</include> | ||
<exclude> | ||
<directory suffix=".blade.php">src</directory> | ||
</exclude> | ||
</source> | ||
</phpunit> |
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 |
---|---|---|
@@ -1,31 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* Configuration for the "HTTP Very Basic Auth"-middleware | ||
*/ | ||
return [ | ||
// Username | ||
'user' => env('BASIC_AUTH_USERNAME', ''), | ||
|
||
// Password | ||
'password' => env('BASIC_AUTH_PASSWORD', ''), | ||
|
||
// Environments where the middleware is active. Use "*" to protect all envs | ||
'envs' => [ | ||
'*' | ||
], | ||
|
||
// Response handler for the error responses | ||
'response_handler' => \Olssonm\VeryBasicAuth\Handlers\DefaultResponseHandler::class, | ||
|
||
// Message to display if the user "opts out"/clicks "cancel" | ||
'error_message' => 'You have to supply your credentials to access this resource.', | ||
|
||
// Message to display in the auth dialiog in some browsers (mainly Internet Explorer). | ||
// Realm is also used to define a "space" that should share credentials. | ||
'realm' => 'Basic Auth', | ||
|
||
// If you prefer to use a view with your error message you can uncomment "error_view". | ||
// This will supersede your default response message | ||
// 'error_view' => 'very_basic_auth::default' | ||
]; | ||
/** | ||
* Configuration for the "HTTP Very Basic Auth"-middleware | ||
*/ | ||
|
||
return [ | ||
// Username | ||
'user' => env('BASIC_AUTH_USERNAME', ''), | ||
|
||
// Password | ||
'password' => env('BASIC_AUTH_PASSWORD', ''), | ||
|
||
// Environments where the middleware is active. Use "*" to protect all envs | ||
'envs' => [ | ||
'*', | ||
], | ||
|
||
// Response handler for the error responses | ||
'response_handler' => \Olssonm\VeryBasicAuth\Handlers\DefaultResponseHandler::class, | ||
|
||
// Message to display if the user "opts out"/clicks "cancel" | ||
'error_message' => 'You have to supply your credentials to access this resource.', | ||
|
||
// Message to display in the auth dialiog in some browsers (mainly Internet Explorer). | ||
// Realm is also used to define a "space" that should share credentials. | ||
'realm' => 'Basic Auth', | ||
|
||
// If you prefer to use a view with your error message you can uncomment "error_view". | ||
// This will supersede your default response message | ||
// 'error_view' => 'very_basic_auth::default' | ||
]; |
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,5 +1,19 @@ | ||
<?php | ||
|
||
namespace Olssonm\VeryBasicAuth\Tests; | ||
use Illuminate\Support\Facades\Route; | ||
use Olssonm\VeryBasicAuth\Http\Middleware\VeryBasicAuth; | ||
use Olssonm\VeryBasicAuth\Tests\TestCase; | ||
|
||
uses(TestCase::class)->in(__DIR__); | ||
uses(TestCase::class) | ||
->beforeEach(function () { | ||
// Set default config for testing | ||
config()->set('very_basic_auth.user', 'test'); | ||
config()->set('very_basic_auth.password', 'test'); | ||
|
||
Route::get('/', fn () => 'ok')->middleware(VeryBasicAuth::class)->name('default'); | ||
Route::get('/test', fn () => 'ok')->middleware(VeryBasicAuth::class); | ||
Route::get('/inline', fn () => 'ok')->middleware( | ||
sprintf('auth.very_basic:%s,%s', config('very_basic_auth.user'), config('very_basic_auth.password')) | ||
)->name('inline'); | ||
}) | ||
->in(__DIR__); |
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
Oops, something went wrong.