Skip to content

[1.x] Merges develop #515

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

Merged
merged 22 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,11 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.3, 7.4, '8.0', 8.1, 8.2, 8.3]
laravel: [8, 9, 10]
php: [8.1, 8.2, 8.3]
laravel: [10, 11]
exclude:
- php: 7.3
laravel: 9
- php: 7.3
laravel: 10
- php: 7.4
laravel: 9
- php: 7.4
laravel: 10
- php: '8.0'
laravel: 10
- php: 8.3
laravel: 8
- php: 8.3
laravel: 9
- php: 8.1
laravel: 11

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

Expand All @@ -53,4 +41,4 @@ jobs:
run: composer require "illuminate/contracts=^${{ matrix.laravel }}" --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit --verbose
run: vendor/bin/phpunit
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
}
],
"require": {
"php": "^7.3|^8.0",
"php": "^8.1",
"ext-json": "*",
"bacon/bacon-qr-code": "^2.0",
"illuminate/support": "^8.82|^9.0|^10.0",
"pragmarx/google2fa": "^7.0|^8.0"
"illuminate/support": "^10.0|^11.0",
"pragmarx/google2fa": "^8.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "^6.34|^7.31|^8.11",
"orchestra/testbench": "^8.16|^9.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^10.4"
},
"autoload": {
"psr-4": {
Expand Down
16 changes: 3 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<phpunit colors="true">
<testsuites>
<testsuite name="Fortify Test Suite">
<directory suffix=".php">./tests/</directory>
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<server name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="APP_KEY" value="base64:uz4B1RtFO57QGzbZX1kRYX9hIRB50+QzqFeg9zbFJlY="/>
</php>
</phpunit>
4 changes: 3 additions & 1 deletion src/FortifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ protected function configurePublishing()
__DIR__.'/../stubs/UpdateUserPassword.php' => app_path('Actions/Fortify/UpdateUserPassword.php'),
], 'fortify-support');

$this->publishes([
$method = method_exists($this, 'publishesMigrations') ? 'publishesMigrations' : 'publishes';

$this->{$method}([
__DIR__.'/../database/migrations' => database_path('migrations'),
], 'fortify-migrations');
}
Expand Down
3 changes: 1 addition & 2 deletions stubs/fortify.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use App\Providers\RouteServiceProvider;
use Laravel\Fortify\Features;

return [
Expand Down Expand Up @@ -74,7 +73,7 @@
|
*/

'home' => RouteServiceProvider::HOME,
'home' => '/home',

/*
|--------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions tests/AuthenticatedSessionControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
use Laravel\Fortify\LoginRateLimiter;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Mockery;
use Orchestra\Testbench\Attributes\WithMigration;
use PragmaRX\Google2FA\Google2FA;

#[WithMigration]
class AuthenticatedSessionControllerTest extends OrchestraTestCase
{
use RefreshDatabase;
Expand Down Expand Up @@ -210,12 +212,12 @@ static function ($mock) use ($username) {
self::assertSame($expectedResult.'|192.168.0.1', $method->invoke($loginRateLimiter, $request));
}

public function usernameProvider(): array
public static function usernameProvider(): array
{
return [
'lowercase special characters' => ['ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ', '[email protected]'],
'uppercase special characters' => ['ⓉⒺⓈⓉ@ⓁⒶⓇⒶⓋⒺⓁ.ⒸⓄⓂ', '[email protected]'],
'special character numbers' =>['test⑩⓸③@laravel.com', '[email protected]'],
'special character numbers' => ['test⑩⓸③@laravel.com', '[email protected]'],
'default email' => ['[email protected]', '[email protected]'],
];
}
Expand Down
18 changes: 8 additions & 10 deletions tests/ConfirmablePasswordControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Fortify\Contracts\ConfirmPasswordViewResponse;
use Laravel\Fortify\Fortify;
use Orchestra\Testbench\Attributes\WithMigration;

#[WithMigration]
class ConfirmablePasswordControllerTest extends OrchestraTestCase
{
use RefreshDatabase;

protected $user;

protected function setUp(): void
protected function afterRefreshingDatabase()
{
$this->afterApplicationCreated(function () {
$this->user = TestConfirmPasswordUser::forceCreate([
'name' => 'Taylor Otwell',
'email' => '[email protected]',
'password' => bcrypt('secret'),
]);
});

parent::setUp();
$this->user = TestConfirmPasswordUser::forceCreate([
'name' => 'Taylor Otwell',
'email' => '[email protected]',
'password' => bcrypt('secret'),
]);
}

public function test_the_confirm_password_view_is_returned()
Expand Down
13 changes: 11 additions & 2 deletions tests/OrchestraTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

namespace Laravel\Fortify\Tests;

use Illuminate\Foundation\Testing\RefreshDatabaseState;
use Laravel\Fortify\Features;
use Orchestra\Testbench\Concerns\WithLaravelMigrations;
use Orchestra\Testbench\Concerns\WithWorkbench;
use Orchestra\Testbench\TestCase;

abstract class OrchestraTestCase extends TestCase
{
use WithLaravelMigrations, WithWorkbench;
use WithWorkbench;

public function setUp(): void
{
if (class_exists(RefreshDatabaseState::class)) {
RefreshDatabaseState::$migrated = false;
}

parent::setUp();
}

protected function defineEnvironment($app)
{
Expand Down
14 changes: 8 additions & 6 deletions tests/TwoFactorAuthenticationControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
use Laravel\Fortify\Events\TwoFactorAuthenticationDisabled;
use Laravel\Fortify\Events\TwoFactorAuthenticationEnabled;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Orchestra\Testbench\Attributes\DefineEnvironment;
use Orchestra\Testbench\Attributes\ResetRefreshDatabaseState;
use Orchestra\Testbench\Attributes\WithMigration;
use PragmaRX\Google2FA\Google2FA;

#[WithMigration]
class TwoFactorAuthenticationControllerTest extends OrchestraTestCase
{
use RefreshDatabase;
Expand Down Expand Up @@ -62,9 +66,8 @@ public function test_two_factor_authentication_secret_key_can_be_retrieved()
$this->assertEquals('foo', $response->original['secretKey']);
}

/**
* @define-env withConfirmedTwoFactorAuthentication
*/
#[DefineEnvironment('withConfirmedTwoFactorAuthentication')]
#[ResetRefreshDatabaseState]
public function test_two_factor_authentication_can_be_confirmed()
{
Event::fake();
Expand Down Expand Up @@ -100,9 +103,8 @@ public function test_two_factor_authentication_can_be_confirmed()
$this->assertFalse($user->hasEnabledTwoFactorAuthentication());
}

/**
* @define-env withConfirmedTwoFactorAuthentication
*/
#[DefineEnvironment('withConfirmedTwoFactorAuthentication')]
#[ResetRefreshDatabaseState]
public function test_two_factor_authentication_can_not_be_confirmed_with_invalid_code()
{
Event::fake();
Expand Down