Skip to content

mohdfaridhashim/laravel-unit-test-example

 
 

Repository files navigation

Laravel Unit testing example

Build Status

Usually I see tutorials to tests Laravel which are just functional tests, I think unit testing should be given priority too. Done for this blog post.

Clone and Run

To clone and run this locally do the following:

  • git clone git@github.com:geshan/laravel-unit-test-example.git
  • cd laravel-unit-test-example
  • run composer install --prefer-dist
  • cd public
  • php -S localhost:8000
  • try http://localhost:8000/place/Cash on your browser you should see Checkout for Cash with total 100
  • try http://localhost:8000/place/CreditCard on your browser you should see Checkout for CreditCard with total 95

Run tests

PHPUnit is used to write the unit tests, to run the tests run the following command after composer install is done.

>./vendor/bin/phpunit

About

An example of Laravel "Unit" testing for a blog post ->

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 98.6%
  • Other 1.4%