2017 © Pedro Peláez
 

library auth-tests

Authentication tests for Laravel built-in authentication module.

image

dczajkowski/auth-tests

Authentication tests for Laravel built-in authentication module.

  • Sunday, April 29, 2018
  • by DCzajkowski
  • Repository
  • 3 Watchers
  • 65 Stars
  • 165 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 26 Versions
  • 57 % Grown

The README.md

Missing tests for Laravel's auth module

Latest Stable Version License MIT PRs Welcome, (*1)

, (*2)

⚠️ Deprecation notice ⚠️

As of Laravel 8, the laravel/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., (*3)

All of the applications already using laravel/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., (*4)

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

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 be 5.6.*.~, (*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.*, (*7)

Installation

Before installation please make sure you have scaffolded frontend views with a --auth flag e.g., (*8)

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

Edit phpunit.xml file by adding these two lines between <php> tags:, (*9)

<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>

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

Using the e-mail verification feature

If you want to use the e-mail verification feature, you will have to make following changes: - update routes/web.php:, (*11)

- Auth::routes();
+ Auth::routes(['verify' => true]);
  • update app/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), (*12)

# make:auth-tests
public function testUserCanLogout()
{
    //
}

# make:auth-tests --snake-case
public function test_user_can_logout()
{
    //
}

# make:auth-tests --annotation
/** @test */
public function userCanLogout()
{
    //
}

# make:auth-tests --public
function testUserCanLogout()
{
    //
}

# make:auth-tests --curly
public function testUserCanLogout() {
    //
}

# make:auth-tests -caps # or --zonda
/** @test */
function user_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., (*13)

To review all flags run php artisan make:auth-tests --help., (*14)

Updating

To update tests when a new version of this package arrives:, (*15)

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

Warning! All changes to the files this package provides will be lost when running this command!, (*16)

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 function here. Feel free to edit it and reuse however you like., (*17)

Contributing

Feel free to make PRs to this repo., (*18)

License

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

The Versions

29/04 2018

dev-master

9999999-dev

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

The Requires

 

24/04 2018

5.6.2

5.6.2.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

The Requires

 

24/04 2018

5.6.1

5.6.1.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

The Requires

 

16/04 2018

5.6.0

5.6.0.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

The Requires

 

01/01 2018

5.5.6

5.5.6.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

The Requires

 

22/12 2017

5.5.5

5.5.5.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

The Requires

 

16/11 2017

5.5.4

5.5.4.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

16/11 2017

5.5.3

5.5.3.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

16/11 2017

dev-analysis-86gpV4

dev-analysis-86gpV4

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

5.5.2

5.5.2.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

dev-analysis-XZr1VN

dev-analysis-XZr1VN

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

5.5.1

5.5.1.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

5.5.0

5.5.0.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.1.0

0.1.0.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

dev-analysis-qyMoLN

dev-analysis-qyMoLN

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

dev-php-not-stub

dev-php-not-stub

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.10

0.0.10.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.9

0.0.9.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.8

0.0.8.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.7

0.0.7.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.6

0.0.6.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.5

0.0.5.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.4

0.0.4.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.3

0.0.3.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

MIT

28/09 2017

0.0.2

0.0.2.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download

28/09 2017

0.0.1

0.0.1.0

Authentication tests for Laravel built-in authentication module.

  Sources   Download