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. 🌴🌊🌴

— 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](

![laravel breeze register page](

![laravel breeze dashboard page](

## 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=""></a></p>&mdash; Taylor Otwell 🛸 (@taylorotwell) <a href="">November 9, 2020</a></blockquote> <script async src="" 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:

        <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)