Automated pipeline tests, version bumping and deployments with Gitlab

This is one of my favorite topics! Setting up a fully automated deployment. I want to share with you how to set up a fully automated deployment including tests and version bumping. I am using PHP and Laravel as the sample project but please keep in mind that this post is not limited to Laravel and PHP only! If you don’t want to read the post and jump to the Repo:...

August 19, 2022 · Saeed Vaziry

Run PHPUnit tests, multiple times with different data sets

So most of you might know this, Specially you old-school PHP developers 🙂 but it’s not gonna fill the internet’s capacity so let me be happy by writing this post. You might have seen some PHPUnit tests with arguments! Have you asked yourself how it’s possible and who sends those arguments to these tests? The answer is simple! Data Providers With PHPUnit, you can define arguments for your test function, and in the DocBlock you mention that there is a data provider for this function, and inside that function just provide the data 🙂...

July 12, 2022 · Saeed Vaziry

Run Laravel tests on GitHub Actions

Imagine yourself in a big team coding on a single project. In our scenario the project is Laravel. There would be tens of Pull Requests waiting to merge but you need to make sure that nothing goes wrong after the merge. Obviously, you’ll have tests in your project but it would be very tricky to go through the all PRs and run the tests on your local. GitHub Actions Thanks to GitHub there is a feature called Actions that comes in handy in this case....

April 12, 2022 · Saeed Vaziry

Laravel Custom Helpers, Facades, and Testing Fakes

Let’s consider that we want to create a custom helper named SSH. This helper is going to connect to a remote server via ssh and execute some commands. Commands Since we might have many commands, I would create an interface first. // app/Commands/Command.php namespace App\SSHCommands; use App\Contracts\SSHCommand; interface Command { public function content(); } And then an example command. // app/Commands/DirectoryListCommand.php namespace App\SSHCommands; use App\Contracts\SSHCommand; class DirectoryListCommand implements Command { public function content() { return "ls -la"; } } Helper Alright....

February 18, 2022 · Saeed Vaziry