Test-Driven Development with PHP 8: Build extensible, reliable, and maintainable enterprise-level applications using TDD and BDD with PHP

Test-Driven Development with PHP 8: Build extensible, reliable, and maintainable enterprise-level applications using TDD and BDD with PHP

Test-Driven Development with PHP 8: Build extensible, reliable, and maintainable enterprise-level applications using TDD and BDD with PHP
Автор: Sarabia Rainier
Дата выхода: 2023
Издательство: Packt Publishing Limited
Количество страниц: 362
Размер файла: 5.1 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы  Дополнительные материалы 

Cover Page....2

Table of Contents....3

Preface....4

Part 1 – Technical Background and Setup....12

Chapter 1: What Is Test-Driven Development and Why Use It in PHP?....13

What is TDD?....14

Common misconceptions about TDD....15

Why should we even consider TDD?....18

What are we planning to achieve in this book?....22

Summary....23

Chapter 2: Understanding and Organizing the Business Requirements of Our Project....24

Technical requirements....26

The example business project....26

Breaking down the business requirements into software features....29

Summary....54

Chapter 3: Setting Up Our Development Environment Using Docker Containers....55

Technical requirements....56

What is a container?....56

Setting up our PHP development container....57

Running Docker containers....60

Summary....65

Chapter 4: Using Object-Oriented Programming in PHP....66

Technical requirements....67

Understanding OOP in PHP....67

Classes versus objects....70

Abstraction in OOP....76

Encapsulation in OOP....78

Inheritance in OOP....84

Polymorphism in OOP....86

Polymorphism with a PHP interface....88

PHP Standards Recommendations (PSRs)....92

Summary....94

Part 2 – Implementing Test-Driven Development in a PHP Project....95

Chapter 5: Unit Testing....96

Technical requirements....97

Defining unit tests....98

Test coverage....103

Using shell scripts to run tests....115

Types of tests....122

Integration test example....126

Summary....145

Chapter 6: Applying Behavior-Driven Development....146

Technical requirements....147

What is BDD?....148

Applying BDD using Behat and Gherkin....149

Writing PHP code based on Gherkin....155

Browser emulators and Mink....161

Why bother with Gherkin, then?....167

Summary....169

Chapter 7: Building Solution Code with BDD and TDD....170

Technical requirements....171

Implementing the Red-Green-Refactor pattern....172

Writing tests and solution code for the example project....178

Creating a Behat feature based on a Jira ticket....181

Passing the Behat registration feature....188

Summary....202

Chapter 8: Using TDD with SOLID Principles....203

Technical requirements....204

Jira to BDD to TDD....205

TDD with the Single-Responsibility Principle....213

TDD with the Open-Closed Principle....227

TDD with the Liskov Substitution Principle....239

TDD with the Interface Segregation Principle....245

TDD with the Dependency Inversion Principle....251

Summary....259

Part 3 – Deployment Automation and Monitoring....260

Chapter 9: Continuous Integration....261

Technical requirements....261

Running and passing all the Symfony application tests....262

Using Bitbucket Pipelines for CI....274

Summary....281

Chapter 10: Continuous Delivery....283

Technical requirements....284

Setting up an AWS EC2 instance....286

Creating an AWS CodeDeploy application....299

Installing Docker and other dependencies inside the AWS EC2 instance....303

Continuous delivery with Bitbucket Pipelines and AWS CodeDeploy....312

Summary....326

Chapter 11: Monitoring....328

Technical requirements....328

Setting up New Relic APM for PHP....329

Going through the application performance data....332

Summary....339

Index....341

Why subscribe?....353

Other Books You May Enjoy....355

Packt is searching for authors like you....359

Share Your Thoughts....359

Download a free PDF copy of this book....361

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.

What You Will Learn:

  • Understand how to start a software project
  • Discover how to use Jira as a tool to organize your tasks
  • Explore when and how to write unit, integration, and functional tests using PHPUnit
  • Write behavior-driven tests using Behat
  • Apply SOLID principles to help you write more testable code
  • Get the most out of your automated tests by using continuous integration
  • Use continuous delivery to help you prepare your application for deployment

Who this book is for:

This book is for PHP software developers looking to implement TDD and BDD in their projects. An understanding of object-oriented programming is required to get the most out of this book. Professional software development experience will also be beneficial to understand real-life business cases.


Похожее:

Список отзывов:

Нет отзывов к книге.