Become a PHP Testing Pro: From Basics to Advanced Techniques

"I want to hit the like button for every test passed. Thanks, the best tutorial on this subject."


Samuel Ferreira

Transform Your Code with Advanced PHP Testing Techniques


Why Learn to Test?


Learning to test isn't just a skill—it's a fundamental part of coding. When you understand testing, you understand how to write better, more robust code. Testing and coding go hand in hand, enhancing your development skills and boosting your confidence in the code you write.


Beyond the Basics


Sure, anyone can follow simple tutorials on how to assert that string 'foo' does not equal 'bar'. But what about the real challenges? How do you determine what to test, the order of tests, or where to even start? How do you ensure your code is adequately covered by tests? What about code that seems impossible to test? These aren’t just theoretical questions—they're real challenges that developers face every day.


What Sets This Course Apart?


While basic tutorials have their place, real-world applications demand deeper understanding and more sophisticated strategies. This course goes beyond simple examples to teach you how to design tests for complex, real-life PHP applications. You'll learn not just how to test, but how to think about testing in a way that makes your code bulletproof.


Discover the Answers Inside


Frustrated by courses that only scratch the surface? This comprehensive curriculum covers everything from fundamental principles to advanced testing strategies. All the answers you need are right here, in a structured format that will guide you through mastering PHP testing.


Why Should You Enroll In This Course?


Advance Your Career with Essential Skills

💼 Economic Value: Mastering testing is not just a skill—it's a career accelerator. Companies value developers who can ensure software reliability through comprehensive testing.

Enhance Code Quality

🛠️ Reliability: Learn to write code that not only works but is also predictable and robust under various scenarios. This course makes your output stand out as reliable and high-quality.

Stay Current and Relevant 

📅 Market Relevance: The content of this course is continuously updated, ensuring that you’re learning the most current testing techniques that are directly applicable in today’s tech landscape.

Deepen Your Technical Expertise  

🧠 Advanced Understanding: Achieve a profound level of knowledge in PHP testing. This course takes you beyond basics to advanced strategies that are crucial for complex projects.

Learn at Your Own Pace

🌴 Flexibility: No deadlines or rush. You control your learning pace, making it easier to balance with your personal and professional life.

Unmatched Depth and Focus

🔍 Attention to Detail: Unlike other courses, I delve deeper into the nuances of PHP testing, providing you with a thorough understanding that is hard to find elsewhere.

Prepare for Senior Roles

📈 Career Progression: This course equips you with the testing strategies necessary to move into senior developer roles, an essential step for advancing in your career.















ENROLL IN THIS COURSE NOW

One payment of $69 + VAT added on checkout page


5★ rated course
✅ 100 video tutorials for $69
✅ Subtitles in your language
✅ Over 13 hours of content
✅ All code examples included
✅ Lifetime ownership
📜 Certificate of achievement
🤝 30 days money back guarantee


Here is the content from the course.

Getting Started With PHPUnit


8 videos

  • Installing PHPUnit
  • Write your first test
  • Testing functions
  • Testing class methods
  • Command line options
  • Filtering tests
  • Errors vs failures
  • Autoloading


PHPUnit Workflow and Configuration

8 videos

  • The setUp method
  • The tearDown method
  • Using tests to refactor
  • Some common assertions
  • Custom failure messages
  • Configure PHPUnit using phpunit.xml
  • Testing errors and exceptions
  • Data providers
Testing Strategies Part One (Unit Testing)

13 videos

  • Testing strategies introduction
  • The project files
  • Create the database table
  • The test plan
  • Risky tests and incomplete tests
  • Mocking
  • Refactoring for easier testing
  • Mocking static methods
  • Test new followers per week
  • Testing all logic paths
  • Should you replace static methods?
  • Tidy up unit testing loose ends


Testing Strategies Part Two (Integration Testing)

15 videos

  • Introduction to integration testing
  • When not to mock
  • Testing API integration
  • Grouping tests using @group
  • Authentication exception testing
  • Intro to testing against a database
  • Create a test database connection
  • Create a database refresh tool
  • Database dependant test case
  • Testing ordered database records
  • Testing null database returns
  • Test saving to the database
  • Create a database test assertion
  • Flatten an array
Testing Strategies Part Three (Feature / Functional Testing)

4 videos

  • Introduction to feature testing
  • Feature test setup
  • Feature test assertions
  • Running the feature tests
Test Doubles


9 videos

  • PHPUnit Test Doubles
  • Testing expectations
  • Faking method return values
  • Testing consecutive returns
  • Throwing exceptions from stubbed methods
  • Will return callback
  • Test faked methods receive correct arguments
  • Test faked methods receive correct arguments using callbacks
  • The mock builder
Test Coverage


4 videos

  • Test coverage introduction
  • Test coverage setup
  • HTML Format coverage report
  • Maximising test coverage
Test Driven Development


21 videos

  • Introduction
  • Setup
  • TDD baby steps
  • Red > Green > Clean
  • Value objects
  • Privacy
  • Dollar objects
  • Common equals
  • Apples and oranges
  • Eliminating duplicate classes
  • Simple currency
  • Ask the computer
  • A BIG clean up
  • Simple addition
  • A sum of moneys
  • Make it
  • Adding mixed currencies
  • The extra mile
  • Multiplying sums
  • Let's go crazy
  • Retrospective
Applying TDD to our Testing Strategies Project

2 videos

  • Using tests to switch libraries
  • Switching libraries
Testing HTTP Request -> Response

6 videos

  • Testing HTTP Request / Response introduction
  • Laravel test setup
  • Asserting against response content
  • Testing authenticated endpoints
  • Create a post model
  • Full Request -> Response test
Static Analysis with PHPStan

12 videos

  • Installing PHPStan
  • Command Options
  • PHPStan Rule Levels
  • Ignoring Errors
  • Introduction to PHPStan Config
  • Shared Configuration
  • Generating The Baseline
  • Add PHPStan to an Existing Codebase
  • PHPStan Extensions
  • Fixing Common Errors
  • Config Practice
  • Running Tests in CI




Click This 👆 To Check out the PHP Professional Toolkit



What You Will Learn in This Course


Mastering Your Testing Tools 

🛠 Foundation in PHPUnit: Start by getting comfortable with PHPUnit, the cornerstone testing framework for PHP. You'll understand its essential role and how other frameworks like PEST and Codeception build upon its foundation. We begin with mastering this critical tool to set a solid groundwork for advanced testing.


Developing Testing Strategies  

🎯 Practical Applications: Once you're set up with the necessary tools and have written your initial tests, we'll dive into more sophisticated testing strategies. Through a practical project that poses unique challenges, we'll employ a mix of unit tests, feature tests, and integration tests to enhance the code's robustness and coverage.


Expanding Your Testing Toolkit  

🧰 Advanced Techniques: Explore an extensive section dedicated to test doubles, enhancing your ability to create focused and effective tests. This part of the course is designed to refine your skills and broaden your testing capabilities.


Applying Test Driven Development (TDD)  

📚 In-Depth TDD Training: Engage with over 20 videos that take you through the practical application of TDD. You'll develop a complex functionality that involves handling different currencies and amounts— a challenging yet rewarding task. With TDD, we'll simplify complex scenarios and demonstrate how systematic testing can lead to cleaner, more reliable code.


Enhancing Code Quality with PHPStan  

🔍 Static Analysis: Dive into static analysis with PHPStan, a leading tool that identifies issues in PHP code before it runs. Learn how to integrate PHPStan into your workflow to improve code quality and maintain standards effortlessly. This section focuses on preemptively catching bugs and ensuring your codebase remains robust and error-free.

ENROLL IN THIS COURSE NOW

One payment of $69 + VAT added on checkout page



5★ rated course
✅ 100 video tutorials for $69
✅ Subtitles in your language
✅ Over 13 hours of content
✅ All code examples included
✅ Lifetime ownership
📜 Certificate of achievement
🤝 30 days money back guarantee


Check Out These Sample Videos From The Course

Testing Class Methods

The courses starts by installing the PHPUnit testing framework and then writing our first tests. In this sample we look at testing class methods.

Errors vs Failures

Do you know the difference between test errors (E) and test failures (F)? You will by the end of this video.

Refactoring For Easier Testing

Sometimes your code might feel like it is hard to test. Instead of reaching for a bunch of workarounds involving test doubles etc. you should first ask yourself whether the code could be refactored to make it easier to test.

PHPUnit Test Doubles

Test doubles allow you to test the parts of your application that you want to test without having to rely on a bunch of dependencies being set up correctly...that could be complicated and painful.

Test Coverage

Test coverage is a measure of how much of the code base is executed when the tests are run. It is NOT an indicator that your code is fully tested because there could be many parts of your code which are executed when the tests run but which could have multiple outcomes...these are not factored into the test coverage score.

Flatten an Array

Our data comes back from an API as a multidimensional array but we want it in the shape which our application understands.

An underlying test will help us to flatten this array. We also want to preserve the keys for the individual values.

Full Request -> Response Test

Most PHP frameworks come with great testing tools. Let's run a full request -> response test using the Laravel framework.

Red > Green > Clean

This course includes an in-depth on Test Driven Development which adapts an example by Kent Beck. TDD is an interative process where you: 1. Quickly create a failing test. 2. Make that test pass by whatever means. 3. Refactor for clean code. I call these steps Red, Green, Clean

BUY THIS COURSE NOW

One payment of $69 + VAT added on checkout page


5★ rated course
✅ 100 video tutorials for $69
✅ Subtitles in your language
✅ Over 13 hours of content
✅ All code examples included
✅ Lifetime ownership
📜 Certificate of achievement
🤝 30 days money back guarantee

Time For A Reality Check


Many testing tutorials and courses rely on oversimplified examples like asserting that `1 + 1 = 2` to demonstrate basic concepts. While these examples are great for beginners to grasp the fundamentals, they fall short of preparing you for the complexities of real-world software development.

In this course, you won't find simplistic scenarios. Instead, I bring you into the trenches of actual development challenges.

As a senior developer actively working in the industry, I leverage my firsthand experience to provide you with examples and challenges I've encountered in my career. This approach isn't just about learning to test—it's about preparing to succeed in real environments where the quality of your testing can make or break a project.

Here is what people have said about the course


Best tutorial on this topic. Ilian Karasimirov

This course is very practical - Vakhtang


Very, very interesting and helpful - Ruslan


Course is clear, direct and easy to follow, even if one didn't use testing in the past - Richard


This is very useful course - Muhammad Nadeem


I didn't ever use phpunit because it was so hard to understand and figure out. This sets it up to be a success from the start to do TDD - Mr J


This course is very helpful in my php career - Asadullah


In depth course with great real life examples. Delivery of content is engaging and enjoyable - Joshua Caine


Really excellent course! - Brandon Oakley

Detailed in-depth premium content. Worth every penny - Janroe

Unit testing has been a low point in my professional PHP career the last few years. Have not found decent training anywhere. So glad to have found this course. - Karl Zipser

The course delivers a lot of specific knowledge that is not found anywhere else and the focus on complicated tests is very nice. The fact that the course keeps getting updated is a bonus. Eduardo

This course has clear explanations and Gary has the patience to explain every detail, which I think is very important. Demian

I like all your videos, great work. Keep rocking! Thank you for everything. Gokul jadhav.g

I want to hit the like button for every test passed. Thanks for the best tutorial available on this subject. Samuel Ferreira

You explain the Mock in unittest with very easy understanding, you have reproduced different use cases that are very important to understand!! Thank you so much! 優散的傻勢

I have ADHD and have trouble with getting comfortable with tutorial styles and formats. Your video here is just bliss to me. Thank you thank you! Please don't stop making videos! Sofascialistadankula Megadonakeratosis

Clear and detailed. - Piero Recchia

The testing PHP course is long, but very good and amazingly informative. Testing is something that has always eluded me, so the course has definitely given me a grounding and something I can/will refer back to. Thanks for the course Gary and your other OOP course, they have been excellent. - Jonathon Wood

Everything is perfect with this course. I am watching it for my team and am pretty sure they will love it - Mathieu

I just appreciate all of Gary's work!!!!!! - Karyna

Good explanations, concrete and diverse cases - Mikaidou

This is what people have had to say about my other courses.

This is perfect! - Unjoined

You have a great way of explaining OOP - Locoplata

This is one of the best courses I have ever done. You have a gift for teaching. Your training has given me very valuable context for all things I knew, corrected some stuff I did incorrectly, and has taught me innumerable new things. - Mark Thijssen

Making me enjoy coding again. - Drew Hinde

Gary has deep knowledge and he is following the best practices. I have no suspicions about learning non-useful nor obsolete techniques. It is essential to have work / code discipline and he has it and kind of routing you to have the same. - Burak

Gary has a patient delivery style, and I can understand him. I also appreciate that code for the video is provided, with each video, because I like to spend time testing and changing that code to get further into it. - Karl Zipser

Well explained step by step approach - Takunda Chibanda

The way of teaching is so good with real time examples. There is also engaging activities - Lokith S

Information delivered clearly and in a well-structured way - Sim

This course is fantastic! I'm really looking forward to watching the rest of the course. Thanks a million Gary! - Michael Gibbs

Well structured and taught - Suleyman Solak

Great tutorial! - Fh Ndiritu

It's much more pleasant to follow than most other courses I have tried. - Mick Amato

Thanks for this video, been watching it for the 2nd time and I can't even feel the time goes by - Lexer Quine

I won't lie, I've watched a lot of php oop course and this is the best!! Thank you king - Yasser Latrach

PHP is making sense and I can apply what I am learning at my job - Dee

Very engaging and easy to understand the concepts - Luciano

I'm very happy with the course and the instructor. - Paulo

Gary explains OOP with PHP very clearly and is easy to understand. I think it's simply great - thanks for creating it!! - Nicolas Alexander Rau

This course is a true gem! It's the first time I watched a 3h course and felt I really understood the concepts. Thank you so much Gary! Looking forward to the full course:) - Giulia Pizzignacco

I saw all the videos of oriented object programming and they were awesome! Great content - Arius

Great stuff for OOP in PHP for beginners and great reminders for other Devs. - TomTom Shaylash

Excellent course delivered by a knowledgeable and engaging content creator. Highly recommended - Drew Hinde

I have learnt so much new information which helps me to write efficient php (oop) code. I am very thankful to Gary for providing such quality content - Ridwanullah Raufi

I'm very pleased with the way Gary explains everything. - Rob Spruyt

I'm enjoying the clear English of Gary, well spoken and succinct explanation of his code. - James

Exactly what I needed for my level of coding, I can create crud applications in PHP, but OOP is completely new to me. - Tom

Sufficiently long sections to be able to take in the information, it makes it easier to understand. Very good explanations. - Mats Akebrand

I have had an extremely positive experience with this course, so Mr Clarke had definitely earned a perfect 5 stars from me! This course has helped me to understand how OOP works SO MUCH better than I previously did. I 100% understand all of his examples. - Jeffrey Carter

Excellent course, interesting and engaging - Clive

Thank you so much! Appreciate your hard work - Paul Toma

Great work. Waiting for next videos - Alwin Augustin

Beautiful work! - Mohammed B

Great work. Thank you Sir! - Yusuf Aliya

Great video! Thanks so much - Ck

Interesting tutorial, thanks for all! - Mdazhardware

Thanks, awesome work!- Hamad Adel

Great work!- Houssem Rahrah

Thanks for your time we appreciate it!- Mamadou Aly Sy

Great!- Sergey Vasko

Nice course- Kennedy Muthui

Check Out My Other PHP Full Length Courses

PHP Professional Toolkit

💰 Massive Saving!

All of my best PHP courses bundled into one product.
Save over $100 today!


Object Oriented PHP

A complete guide to Object Oriented Programming in PHP


PHP Framework Pro

Essential learning for every PHP developer


Git and Github logos

Git and Github

A practical guide to Git and Github



Docker + PHP

A practical guide to Docker with PHP. Includes bonus material



Test Driven PHP Logo

Test Driven PHP

A really cool way of writing clean PHP code that works.



Who am I?



Hello and thank you so much for checking out my work. My name is Gary Clarke and I'm a software developer with many years experience, primarily in PHP. I started creating video tutorials during lockdown in 2020 because I wanted the challenge of being able to explain complex / technical subjects to others in a way which is easy to understand and remember.

At this moment in time, my videos have been watched over a million times and I intend to keep creating new and improved content and teaching more and more new people. It would be my pleasure to see you on the inside of one of my courses.


Adrien ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Sahraoui ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Maxime Hu ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Gabor ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Karl Zipser ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Piero Recchia ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Jonathon Wood ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Mikaidou⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Karyna⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Mathieu⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Pawal⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Knowledgeable instructor


Edin⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Magid Soudeni⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


V.Berg ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Eduardo ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Demian⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Marek⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Andy⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Vakhtang ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Richard ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Muhammad Nadeem ⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Mr J ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Jakub ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Ruslan ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Stanislau Pamaleika ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Tony ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Asadullah ⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


German⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Lorenzo⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Joshua Caine⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Brandon Oakley⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Cesar Schefer⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


David Carr⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Janroe⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Paolo Maggio⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor


Bhupendra sinh Jadeja⭐️⭐️⭐️⭐️⭐️


✅ Valuable information ✅ Helpful practice activities ✅ Clear instructions

✅ Accurate course description ✅ Engaging delivery style ✅ Knowledgeable instructor