Book Image

Test-Driven Development with PHP 8

By : Rainier Sarabia
Book Image

Test-Driven Development with PHP 8

By: Rainier Sarabia

Overview of this book

PHP web developers end up building complex enterprise projects without prior experience in test-driven and behavior-driven development which results in software that’s complex and difficult to maintain. This step-by-step guide helps you manage the complexities of large-scale web applications. It takes you through the processes of working on a project, starting from understanding business requirements and translating them into actual maintainable software, to automated deployments. You’ll learn how to break down business requirements into workable and actionable lists using Jira. Using those organized lists of business requirements, you’ll understand how to implement behavior-driven development (BDD) and test-driven development (TDD) to start writing maintainable PHP code. You’ll explore how to use the automated tests to help you stop introducing regressions to an application each time you release code by using continuous integration. By the end of this book, you’ll have learned how to start a PHP project, break down the requirements, build test scenarios and automated tests, and write more testable and maintainable PHP code. By learning these processes, you’ll be able to develop more maintainable, and reliable enterprise PHP applications.
Table of Contents (17 chapters)
1
Part 1 – Technical Background and Setup
6
Part 2 – Implementing Test-Driven Development in a PHP Project
11
Part 3 – Deployment Automation and Monitoring

Preface

For the past few years, I’ve been helping friends and colleagues learn more about PHP and Test-Driven Development (TDD). I realized that I found myself repeating some of the things I’m discussing with different people. I told myself, it would be great if I could just point my friends and colleagues to a collection of my notes so that I could help them with developing applications in PHP from the start of the project, up to deployment. Unfortunately, my notes only made sense to me.

In 2009, I was working as a C# developer and made friends with my colleagues who were fellow programming enthusiasts. Unfortunately, we haven’t been in touch for a long time. 11 years later, in 2020 while in COVID lockdown, I got in touch with my long-lost friends, and we started chatting about programming. They told me that they were very keen on learning about TDD with PHP. We then did a screen-sharing tutorial session on a weekend, and I realized that I seriously needed to start writing something a bit more organized to help other people who are interested in learning about this topic.

I do self-training most of the time. I buy books, read them, and watch tutorials about things I want to learn myself. I then decided to write a book about TDD with PHP. Since I have learned a lot from the books published by Packt, I thought I should reach out to them.

Reading this book will help you start organizing your thoughts and the things you need to build for a project as a software developer. You will learn how to write and use automated tests to help improve the quality of the software you produce, and you will also learn how to use tools to automate the execution of your tests, as well as the deployment of your code onto remote servers. I’m aiming for the reader to understand the value of TDD as a process, and not just learn about writing automated tests. That’s why I have covered topics from starting a project to deploying it on a public-facing server.