Laravel 5.0 & TDD Environment with Laravel Elixir

Setting up Testing Environment for Laravel 5.0

The best part of working with Laravel is that most of the things are already setup like phpunit and laravel/elixir. These are the things we'll need to automate test in the environment. We still have to do some tweaks to make things running.

Setting up elixir

Make sure there is node install on your machine you can check by running node -v it should give you a version of the node that you have installed. The next step is installing gulp globally on your machine which is as simple as npm install --global gulp. Next step is running npm install inside your Laravel project folder to install the dependencies.

Now, inside your gulp.js and add

elixir(function(mix) {

Now, you can run the test cases by running gulp tdd


If you are using the virtual machine provided by Laravel, this will be a huge issue for showing notifications from within the Virtual machine on to your host machine.

For this, you'll have to install a vagrant plugin for transferring notifications from inside your virtual machine to your host machine, do that by running sudo vagrant plugin install vagrant-notify. This command will globally add the vagrant notify plugin for all your vagrant machines.

My vagrant was 1.6.3 so there were errors running the above vagrant command, which was solved by adding

s.add_dependency(%q<nokogiri>, ["="])



Then, make a file called notify-send and add

/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -title "$2" -message "$3"

Save this file at /usr/local/bin so that when it is called by the virtual machine the host will run this command and run your notifier.