O'Reilly logo

Mastering Laravel by Christopher John Pecoraro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Functional testing with Behat

While phpspec follows the BDD by specification and is useful for specification and design in isolation, its complimentary tool Behat is used for integration and functional tests. Since phpspec suggests to mock everything, database queries wouldn't actually be executed, as the database is outside the context of that method. Behat is a great tool to perform behavioral testing on a certain feature. While phpspec is already included among Laravel 5's dependencies, Behat will be installed as an external module.

The following command should be run to install and make Behat work with Laravel 5:

$ composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension --dev

After running the composer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required