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

Using TDD with SOLID Principles

When I first started programming, I instantly got addicted to it. I felt so excited about the thought of coming up with a solution to a problem using programs and my own imagination. Back in school, there was a time when the instructor gave us the task of solving some simple algebraic challenges using Turbo-C. I had goosebumps and felt very excited as I quickly realized I could just write programs to solve these types of challenges repeatedly. Write the program once, pass different arguments, and get different results. I loved it. I remember a challenge to compute the height of a bridge if someone is standing on it, drops a ball, and hears a sound after several seconds. Easy! Now, I can just use my program to compute the height of the bridge for me repeatedly. Now, I don’t have to keep remembering that the Earth’s gravitational acceleration is at around 9.8 m/s2 – I can just declare it in the program! I learned that in programming...