---
title: 'Testing PHP Introduction | Course Explainer Video'
source: 'https://youtube.com/watch?v=skgHCnEIoY4'
video_id: 'skgHCnEIoY4'
date: 2026-07-28
duration_sec: 369
---

# Testing PHP Introduction | Course Explainer Video

> Source: [Testing PHP Introduction | Course Explainer Video](https://youtube.com/watch?v=skgHCnEIoY4)

## Summary

This course by Gary Clarke aims to teach clean code with maximum test coverage, going beyond tool usage to cover testable code, refactoring, and testing strategies. It includes unit, integration, and feature tests, plus test-driven development.

### Key Points

- **Course Goal** [0:00] — Achieve clean code with maximum test coverage, differing from other resources by focusing on testable code and refactoring.
- **Approach to Testing** [1:02] — Start with tool usage, then apply to a small application with challenges, using unit, integration, and feature tests.
- **Key Practices** [1:40] — Refactoring, fakes, mocks vs stubs, static methods, testing external APIs and databases.
- **Test-Driven Development** [3:43] — Build a mini app from scratch using TDD, writing tests first, inspired by Kent Beck's book.
- **Outcome** [5:08] — Clean app with minimal code and complete test coverage; TDD makes you a better developer.

### Conclusion

This course provides a comprehensive approach to testing PHP, emphasizing testable code and TDD to produce clean, reliable software.

## Transcript

welcome to testing php from gary clark
tech let me tell you what this course is
all about the goal of this course is to
show you how to achieve clean code with
maximum test coverage so it may differ
somewhat from other testing resources
you've seen whether that be on testing
php or testing software in general
because
the strategy tends to be to show people
how to use the tools and using fairly
simplistic examples
and there's nothing wrong with that
approach because i've myself i've
recorded videos where i'm showing people
how to use the tools using fairly
simplistic examples and it is probably
the best way to show someone how to use
the tools
but learning how to use the tools is not
learning how to test because you're not
learning how to write code which is
testable you're not learning how to
refactor code to make it more testable
and you're not learning how to approach
different problems from a testing
perspective and so there's a much bigger
problem to solve and that's what this
course aims to address
we're going to approach testing from
different angles we will start out in
the traditional manner i'll show you how
to use the tools and how to configure
them for your specific needs and then
what we'll do is we'll take a small
application which will just be a handful
of small files that i'll provide and
it'll contain no tests but it will
contain some problems which need solving
that provide a challenge to testing and
so we're going to try and gain maximum
test coverage using a combination of
unit tests integration tests and feature
tests which are sometimes also called
functional tests
throughout this we're going to practice
a lot of stuff which will make you a
good developer and a good tester and so
we're talking about things such as
refactoring code to make it more
testable using fake objects testables
can be a confusing subject so i'm going
to make it really clear for you i'll
show you what you should fake why you
should fake it when and how to do it and
also
we'll talk about some of the terminology
such as mocks and stubs is there a
difference between the two what is that
difference we'll also look at things
like static methods are they really an
evil thing that is impossible to test
all of this will be explained in our
integration tests we'll consider how we
can test parts of our application which
communicates with external services that
are outside of our control so we're
talking about things such as third-party
apis which is all part of modern
software development modern web
development we'll also examine database
integration and test that the correct
records can be stored in and retrieved
from a database and while we're on that
subject we'll also consider the
structure of our application and see how
writing good tests can sort of point us
in the direction of actually
creating a more logical structure and a
better separation of concerns and so
we'll also add some new code to our
application which will be backed up by
tests and we'll finish off that part of
the course by adding
feature tests which will cover the whole
process from end to end and that will
give us maximum test coverage that will
lead us nicely into an examination of
code coverage where i'll show you how
you can use tools in order to generate
cold coverage reports and then i'll show
you how you can read these reports in
order to see where you have good test
coverage and which parts of your code
don't have sufficient test coverage and
i'll also explain
some of the limitations of cold coverage
reports called coverage tools and why
cold coverage does not mean the same
thing as functionality coverage or logic
path coverage
up to that point we'll mainly have
tested code which was already written
and we'll have written and refactored
code in order to make it more testable
and these are important skills to have
definitely ones that you'll need however
at this point in the course we're then
going to flip things on the head and
we're going to build a mini application
from scratch using test driven
development the big difference here will
be that we're going to write the tests
first and then we write code to make
those tests pass and then the code which
we have written will guide us and inform
us on what tests we need to write next
this part of the course was a lot of fun
to research and record the application
that we'll build will be able to take
different amounts of money in different
currencies you'll be able to add them
together multiply them do all kinds of
things and then reduce them back down to
a single currency and a single monetary
amount and so if that sounds familiar to
you it's because i borrowed that example
from a book called test driven
development by example by a developer
called kent beck it was originally
written in java and i've converted it to
modern php and it's a really good
example for demonstrating this stuff
because the problem is complex enough to
make it very interesting but at the same
time the other small problems which it
throws up are nice ones for being able
to explain tdd concepts and also the
thinking behind tdd quite clearly and
we'll finish up with a nice clean
application with a minimal code base and
complete test coverage i'm 100 confident
that you'll be able to take what you've
learned in that section walk away and
apply and solve any problem which is
thrown at you testing development can
and probably will make you a better
developer in fact just learning to test
well learning how to combine different
approaches such as the ability to test
already existing code with the ability
to drive out functionality with tests
all of these things will make you a
better developer and i'll be totally
frank with you
learning to test well you will work a
lot less hard than the developers that
don't you'll spend limited amount of
time revisiting code or revisiting work
which is already done and that you
believe to be complete limited time and
bug fixing it'll just be clean code
peace of mind respect from your
colleagues your work won't feel like
work it's all good let's dive in
