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.