

GitHub - LaravelDaily/Test-Laravel-Auth-Basics
source link: https://github.com/LaravelDaily/Test-Laravel-Auth-Basics
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Test Your Laravel Auth Skills
This repository is a test for you: perform a set of tasks listed below, and fix the PHPUnit tests, which are currently intentionally failing.
To test if all the functions work correctly, there are PHPUnit tests in tests/Feature/AuthenticationTest.php
file.
In the very beginning, if you run php artisan test
, or vendor/bin/phpunit
, all tests fail.
Your task is to make those tests pass.
How to Submit Your Solution
If you want to submit your solution, you should make a Pull Request to the main
branch.
It will automatically run the tests via Github Actions and will show you/me if the test pass.
If you don't know how to make a Pull Request, here's my video with instructions.
This task is mostly self-served, so I'm not planning review or merge the Pull Requests. This test is for yourselves to assess your skills, the automated tests will be your answer if you passed the test :)
Questions / Problems?
If you're struggling with some of the tasks, or you have suggestions how to improve the task, create a Github Issue.
Good luck!
Task 1. Routes Protected by Auth.
File routes/web.php
: profile functionality URLs should be available only for logged-in users.
Test method test_profile_routes_are_protected_from_public()
.
Task 2. Link Visible to Logged-in Users.
File resources/views/layouts/navigation.blade.php
: the "Profile" link should be visible only to logged-in users.
Test method test_profile_link_is_invisible_in_public()
.
Task 3. Profile Fields.
File resources/views/auth/profile.blade.php
: replace "???" values for name/email with logged-in user's name/email.
Test method test_profile_fields_are_visible()
.
Task 4. Profile Update.
File app/Http/Controllers/ProfileController.php
: fill in the method update()
with the code to update the user's name and email.
If the password is filled in, also update that.
Test methods: test_profile_name_email_update_successful()
and test_profile_password_update_successful()
.
Task 5. Email Verification.
Make the URL /secretpage
available only to those who verified their email.
You need to make changes to two files.
In file routes/web.php
add a Middleware to /secretpage
URL.
And enable email verification in the app/Models/User.php
file.
Test method: test_email_can_be_verified()
.
Task 6. Password Confirmation.
Make the URL /verysecretpage
redirect to a page to re-enter their password once again.
In file routes/web.php
add a Middleware to that URL.
Test method: test_password_confirmation_page()
.
Task 7. Password with Letters.
By default, registration form requires password with at least 8 characters. Add a validation rule so that password must have at least one letter, no matter uppercase or lowercase.
So password 12345678
is invalid, but password a12345678
is valid.
Hint: you need to modify file app/Http/Controllers/Auth/RegisteredUserController.php
, which is almost default from Laravel Breeze.
Test method: test_password_at_least_one_uppercase_lowercase_letter()
.
Recommend
-
262
Files Permalink Latest commit message
-
67
readme.md Laravel Roles Permissions Admin - Spatie version Update October 2019: this project was created in 2017 as Laravel...
-
26
README.md Demo support ticketing project based on Laravel 6. Project is partly generated with QuickA...
-
23
README.md Laravel Invoices
-
17
Laravel Livewire Ui This package provides Laravel Livewire & Bootstrap UI, Auth, & CRUD scaffolding commands to make your development speeds blazing fast. With it, you can generate full, preconfigured Bootstrap UI, complete A...
-
20
Laravel Learning Path This repository contains the ordered list of Laravel topics to learn, step-by-step, with related links. If you want to add a topic, link, or any other suggestion, please open Issues or Pu...
-
9
Laravel Challenge: API Controller - Voices This is a Controller code that needs to be improved, in whatever way possible. Author's question: "how to make clean code to this code" Source:
-
12
Laravel Tips Awesome Laravel tips and tricks for all artisans. PR and ideas are welcome! An idea by PovilasKorop and MarceauKa. Hey...
-
7
Test Your Laravel Migrations Skills This repository is a test for you: perform a set of tasks listed below, and fix the PHPUnit tests, which are currently intentionally failing. To test if all the functions work correctly, the...
-
5
Test Your Laravel Routing Skills This repository is a test for you: fill in routes/web.php and routes/api.php which are left intentionally empty. In both of those files, you will find comments, descri...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK