PHPUnit Essentials – new book about PHPUnit but not only PHPUnit
After years of hard work I finally published my book, it's called PHPUnit Essentials. Hopefully readers will find it useful because it's not just a copy of the PHPUnit manual, it's a practical guide to automated software testing for PHP developers.
A lot described in the book is the result of skills I learned developing applications at Loft and a lot I learned writing this book is now used for the automated testing we do at Loft.
Software testing is a skill which every good developer should master, PHPUnit Essentials is an introduction for PHP developers into the world of automated software testing.
It covers all the basics like how to install PHPUnit, configure IDE and how to run tests. It is a practical guide, showing how to write tests using simple examples. After covering the basics come chapters which should be interesting even for more experienced developers, discussing topics like using test doubles, database and API integration testing and testing legacy code.
To manage the risks inherent in increasingly complex mission critical solutions we need a variety of techniques, such as continuous integration and automated testing to mitigate these risks. PHPUnit is a brilliant tool and framework but on it's own is not sufficient for the job, so the book describes how to integrate with others tools, like Selenium, Jenkins and Travis, to support these techniques.
The last chapter in the book is called PHPUnit alternatives and discusses some alternative testing approaches. Behaviour Driven Development (BDD) and tools like PHPSpec and Behat with Gherkin language are different ways to test in PHP.
The book is not trying to give any definitive answers, it's more about providing an overview of what is possible with automated software testing, how it can make a developers work life easier and more fun. Through the techniques described in the book, businesses can provide high standard solutions whilst minimizing costs, making projects more predictable and profitable.
The book is available in printed version or as e-book at www.amazon.co.uk/Phpunit-Essentials-Zdenek-Machek/dp/1783283432. All code can be executed, if dependency is required can be installed by Composer. Code is available at https://github.com/machek/PHPUnit_Essentials.
And first three readers who share this blog post will be given PHPUnit essentials e-book, so please share and win!
Feedback, questions, comments are welcome.