Automate testing for you Laravel application using Travis CI. As an example I will be using a repository containing test case for an API https://github.com/csinghdev/laravel-examples.
If you would like to watch me doing it then you can watch the tutorial here:
Let’s start.
First thing we need to do is create an account on Travis-CI.
If your application is open source then you can use
https://travis-ci.org which is completely free for Open Source Projects.
For private repositories you can use https://travis-ci.com
In this example I will be using https://travis-ci.org.
Create a new account on Travis-CI. It will ask you for access to your GitHub repository for first time.
We have to follow these two steps here:
- Activate the repository for which we want to automate testing.
- Create a new configuration file .travis.yml inside our repository for Travis-CI.
To activate repository, go to settings and then click on the toggle for that repository.
Create a new file .travis.yml Inside your project repository folder
That’s it, Add this file to git, commit your code and push it into the repository.
As soon as we do that, after few seconds, our test cases starts running here for both versions of php.
And after some time as we can see all test cases are done.
You can find the entire code here:
csinghdev / laravel-examples
Laravel Examples. Built on top of https://github.com/csinghdev/laravel-starter
About Laravel-Examples
This application contains examples with screencasts explaining them. It is built on top of Laravel Starter Application but you can follow them for any Laravel App.
Examples included:
- Create Custom Artisan Command
- Integration with Travis-CI
Want to do it yourself?
Here is the list of video tutorials you can follow to do it by yourself.
- Integration with Travis-CI
- Create Custom Artisan Command
Doing it on MacOS?
Here is a simple video to setup Laravel application environment on MacOS using Valet.
About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database…
Hope you find this useful!
Top comments (0)