DEV Community

Dendi Handian
Dendi Handian

Posted on

Testing Laravel Breeze Authentication

Laravel Breeze is a new and surprising laravel package developed by Taylor Otwell himself and released just a few days ago.

Surprise package release. When? Now! Laravel Breeze. If Jetstream overwhelmed you and you need something simpler for now. Blade + Tailwind only. Every route and controller exported directly to your application. Same beautiful Jetstream style UI. https://t.co/V3QMrVzY0p ๐ŸŒด๐ŸŒŠ๐ŸŒด

โ€” Taylor Otwell ๐Ÿ›ธ (@taylorotwell) November 9, 2020

What this package provides is the more low-level auth scaffolding UI using Tailwind and AlpineJS, which the old laravel-ui auth scaffolding is using either Bootstrap, Vue or React.

Installing the package

The best way to try this package is by using a new and freshly created laravel app and installing the package using:

composer require laravel/breeze --dev 
Enter fullscreen mode Exit fullscreen mode

and then scaffold the auth feature using

php artisan breeze:install 
Enter fullscreen mode Exit fullscreen mode

and then also make sure to build the assets by:

npm install npm run dev ``` and then the login and register are ready to use. ![laravel breeze login page](https://dev-to-uploads.s3.amazonaws.com/i/xyz3xjmc8l3140lhvy5v.png) ![laravel breeze register page](https://dev-to-uploads.s3.amazonaws.com/i/an82apkiup1onvm9tpjb.png) ![laravel breeze dashboard page](https://dev-to-uploads.s3.amazonaws.com/i/zgwhmvws4niarey471y2.png) ## Testing the package My plan for this post is to make some `feature/unit tests` to test the login and register functionality as well as improving my `PHPUnit` testing skill. But `laravel/breeze` already provides all the test suites for us. <blockquote class="twitter-tweet"><p lang="en" dir="ltr">Breeze even exports a set of nice tests to your application... โœ… <a href="https://t.co/zxf9eVzLJu">pic.twitter.com/zxf9eVzLJu</a></p>&mdash; Taylor Otwell ๐Ÿ›ธ (@taylorotwell) <a href="https://twitter.com/taylorotwell/status/1325891538279428097?ref_src=twsrc%5Etfw">November 9, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> So, I will learn from it instead. To enable and try the `phpunit`, you can see in `phpunit.xml` file and uncomment these lines: ```xml ... <server name="DB_CONNECTION" value="sqlite"/> <server name="DB_DATABASE" value=":memory:"/> ... ``` and then you can run all tests using: ``` php artisan test ``` Laravel Breeze is a great starting point for your laravel project if you are already comfortable using Tailwind and the purge configuration is already set to use if you build your assets for production (`npm run prod`). Have fun exploring this package. 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)