This in2it workshop teaches the basics behind test-driven development (TDD) for PHP projects.
Test-driven Development (TDD) is still a subject all developers agree is a great thing, but never get around to actually doing it for many reasons. In this workshop, I use real-world business requirements on legacy code for which we need to fix bugs and add features, but we’re doing it in a TDD way.
We start off with a simple project that we're going to write from scratch using TDD, just to get a feeling what TDD is all about and to flex our fingers writing unit tests. Once we're done, we're looking at a legacy application that contains bugs and requires some features to be added. That will be the main project during this workshop.
When fixing bugs, you need to analyse the bug carefully and write a test first to determine the bug is genuine. Once you have confirmed the bug is real, you can start fixing the bug and re-run your test(s) to confirm the bug no longer exists.
When adding features, you need to write tests in accordance to the requirements. Once you've written your tests, you can start converting your tests into code and re-run your tests to confirm you have completed the process.
The projects used in this workshop are written in PHP and we're using PHPUnit to test these projects. In order to follow along and participate in the exercises, please make sure you have a device that can run PHP natively or in a VM. It should have the following software versions as a minimum:
- PHP 7.1.x (latest version preferably)
- PHPUnit 6.1
- GIT 2
Additionally it would be advisable that you have a free USB slot on your device. The project source code will be made available from a USB thumb drive.
If you have questions, want to provide us feedback or want to have a follow-up conversation about this workshop, please contact us at training@in2it.be. We are happy to assist you any further.
The slides will be made available on SlideShare
In2it is the leading PHP consulting firm in the Benelux offering services to international enterprises, small to mid-sized businesses, governmental institutes, educational and non-profit organisations. We’re market leader in regards consulting for PHP and Zend Framework application architectures, quality assurance on PHP projects and we provide training courses on-site and online.
Find out more about our services at www.in2it.be.