Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

PHP Unit Testing with PHPUnit Tutorial

Gary Clarke via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Master PHP unit testing with PHPUnit in this comprehensive tutorial. Learn essential techniques including setting up tests, making assertions, handling failures, and using color-coded feedback. Explore object and class testing, '@test' annotations, and filtering options for individual test runs. Configure PHPUnit using phpunit.xml, implement autoloading for test classes, and understand test scopes. Dive into setUp() and tearDown() methods, error and exception testing, and advanced concepts like test doubles, mock objects, and method mocking. Discover how to inject mock test dependencies, verify method call frequency, and organize tests into groups. Access source code on GitHub and enhance your PHP testing skills with practical examples and expert guidance.

Syllabus

Introduction / overview
Install PHPUnit
Create a test file
Run a test from the command line
Making assertions
Tests which fail
Using colors in test feedback
Testing objects and classes
Using the '@test' annotation
Using filter option to run individual tests
Configuring phpunit usng phpunit.xml
Autoloading classes in tests
Test scope
The setUp method
The tearDown method
Testing errors and exceptions
Test doubles
Creating mock objects
Mocking methods
Injecting mock test dependencies
Test number of times a method is expected to be called
Grouping tests

Taught by

Gary Clarke

Reviews

Start your review of PHP Unit Testing with PHPUnit Tutorial

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.