YoVDO

Testing Legacy Code - Safe Refactoring

Offered By: PHP UK Conference via YouTube

Tags

PHP UK Conference Courses Unit Testing Courses Mocking Courses PHPUnit Courses

Course Description

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore safe refactoring techniques for legacy PHP code in this 40-minute conference talk from PHP UK 2020. Learn how to make untestable code testable without breaking existing functionality. Dive into unit testing concepts, PHPUnit installation, and test anatomy. Discover mocking strategies using Mockery, and tackle common challenges like hard-coded dependencies, redirections, and exiting. Master techniques for refactoring spaghetti code and private methods. Gain practical insights to confidently update and maintain legacy PHP projects while ensuring code integrity and reliability.

Syllabus

Intro
What is legacy code?
What is refactoring?
What is unit testing?
Why would I unit test?
A solution
A better solution
PHPUnit - installation
Anatomy of a unit test
Running the tests
Mocking - Caution!
Mockery - Installation
Mockery - Usage
A method that echoes
A static method call
Testing: hard-coded dependencies
Refactoring hard-coded dependencies
A hard-coded dependency
Refactoring Redirections
Refactoring Exiting
Refactoring: Updating a file
Fake filesystem
Testing: Spaghetti Code
Private methods
Time for a recap...


Taught by

PHP UK Conference

Related Courses

Introduction to Unit Testing in Jest - The Fundamentals
Coursera Project Network via Coursera
Unit Testing for Data Science in Python
DataCamp
WebServices/Rest API Testing with SoapUI +Real time Projects
Udemy
Testing Fundamentals in iOS
Pluralsight
F#: Automated Testing for Developers
LinkedIn Learning