Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Always-current tests for Laravel's authentication system. Curated by the community.

License

NotificationsYou must be signed in to change notification settings

DCzajkowski/auth-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable VersionLicense MITPRs Welcome

⚠️ Deprecation notice⚠️

As of Laravel 8, thelaravel/ui package is discouraged to be used on new Laravel installations.This package should be used only with already-existing, created with Laravel 7 or lower, applications that use laravel/ui auth controllers.

All of the applications already usinglaravel/ui will get updates of this package to new Laravel versions, although the support may be dropped in the future. This doesn't mean you won't be able to use the package or upgrade to new Laravel versions, but that the upgrades to the major versions may require manual changes from the consumers of this package.

The new way of installing Laravel 8's and above auth scaffolding is using the--jet option in the Laravel installer. LaravelJetstream hides all of its controllers inside the package, meaning it doesn't make sense to test those controllers, as theyare already tested inside the package.

Versioning

The version of this package reflects current major version of the Laravel framework. For example:If Laravel framework has version 5.6, version of this package compatible will be5.6.*.

Due to changes in Laravel's versioning scheme, version 6.1.* will aim to be compatible with a version 6.1.* of Laravel. For example,auth-tests version 6.1.1 and 6.1.20 will be all compatible with Laravel 6.1.*

Installation

Before installation please make sure you have scaffoldedfrontend views with a--auth flag e.g.

composer require laravel/ui&& php artisan ui vue --auth
composer require dczajkowski/auth-tests --devphp artisan make:auth-tests --without-email-verification

Editphpunit.xml file by adding these two lines between<php> tags:

<servername="DB_CONNECTION"value="sqlite"/><servername="DB_DATABASE"value=":memory:"/>

Alternatively, use different database than sqlite, but also different from the one used for development.

Using the e-mail verification feature

If you want to use the e-mail verification feature, you will have to make following changes:

  • updateroutes/web.php:
- Auth::routes();+ Auth::routes(['verify' => true]);
  • updateapp/Models/User.php:
- class User extends Authenticatable+ class User extends Authenticatable implements MustVerifyEmail

Options

There are four flags for customizing your tests. You can use any combination of them. (All flags have their short version e.g.--zonda or-z)

# make:auth-testspublicfunctiontestUserCanLogout(){//}# make:auth-tests --snake-casepublicfunctiontest_user_can_logout(){//}# make:auth-tests --annotation/** @test */publicfunctionuserCanLogout(){//}# make:auth-tests --publicfunctiontestUserCanLogout(){//}# make:auth-tests --curlypublicfunctiontestUserCanLogout() {//}# make:auth-tests -caps # or --zonda/** @test */functionuser_can_logout() {//}

Since version 5.7 there has been a new test for email verification added. You can omit it by running--without-email-verification.

To review all flags runphp artisan make:auth-tests --help.

Updating

To update tests when a new version of this package arrives:

composer update dczajkowski/auth-testsphp artisan make:auth-tests

Warning! All changes to the files this package provides will be lost when running this command!

Automate your workflow

Instead of including this package manually every project you create, simply create a bash function that will do that for you. I have included my personal functionhere. Feel free to edit it and reuse however you like.

Contributing

Feel free to make PRs to this repo.

License

This package is open-source software licensed under the MIT license (same as Laravel itself).

About

Always-current tests for Laravel's authentication system. Curated by the community.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp