Set of Unit Tests for the previous SOLID Examples post. Single Responsibility Principle (SRP) Open/Closed Principle (OCP) Liskov Substitution Principle (LSP) Interface Segregation Principle (ISP) Dependency Inversion Principle (DIP) Single Responsibility Principle (SRP) Unit tests for the Authenticator class from the Single Responsibility Principle example from the previous post. use PHPUnit\Framework\TestCase; class AuthenticatorTest extends TestCase { public function testAuthenticateWithValidCredentials() { ...
Read MoreSingle Responsibility Principle (SRP) Open/Closed Principle (OCP) Liskov Substitution Principle (LSP) Interface Segregation Principle (ISP) Dependency Inversion Principle (DIP) Single Responsibility Principle (SRP) Suppose you are building a web application that allows users to sign up and log in to their accounts. To handle user authentication, you might create a class called Authenticator that has the following responsibilities: Validate the user's login ...
Read MoreAs a PHP developer, you can benefit from using SOLID principles to write better, more maintainable code. SOLID stands for: Single Responsibility Principle (SRP) Open/Closed Principle (OCP) Liskov Substitution Principle (LSP)Interface Segregation Principle (ISP) Dependency Inversion Principle (DIP) Here's a brief explanation of each principle and how they can be applied in PHP development: Single Responsibility Principle ...
Read MoreRecently, I was faced with a busy production server with a space problem where the root partition was near capacity. After some research, I determined that it was possible to add space to the RHEL root partition but felt that this would be risky as I did not have experience making this sort of change. Fortunately, I ...
Read More