Training: Test Automation with PHPUnit

When making changes to your code, you want to test your application in order to validate that your (new and existing) code works as expected. Testing the same functionality manually over and over again every time you make a change will cost a lot of time. A more efficient way to test your code is to write some code to do this automatically for you, which is known as test automation. PHPUnit is the most popular test automation framework for PHP.

In this training you will be introduced to the PHPUnit testing framework and learn how to write automated tests for your PHP applications. You will learn about the different types of tests, how to write unit tests, and how to use test doubles to isolate your tests from other code. You will also learn about integration and system tests, code coverage, and how to write high-quality tests that are easy to read and maintain.

  • PHPUnit logo

Target audience

This training is aimed at developers who have experience with PHP and want to learn how to test their application code effectively using PHPUnit.

Prerequisites

Attendees should have at least 1-2 years of experience with PHP and object-oriented programming (OOP), and be confident in using an IDE and the command line.

Learning objectives

After completing this training, you:

  • Can use PHPUnit to write automated tests
  • Know about the Test Pyramid and different types of tests (unit, integration, and system tests)
  • Can write unit, integration and system tests following common design patterns and best practices
  • Can use test doubles (dummies, fakes, stubs, spies and mocks) to isolate unit tests from other code

Required software

Please bring a laptop with your preferred IDE and the following pre-installed software:

  • Duration: 1 day
  • Level: beginner
  • Price: € 540 excl. VAT
  • Amersfoort
  • 3 - 12 participants
  • Available in-company
  • Available in English or Dutch
The training Test Automation with PHPUnit is given by an experienced trainer

About the trainer

Besides a strong technical background in software engineering and experience with PHPUnit, I have over 8 years of experience in teaching, training and coaching. In my workshops I combine theory with practical exercises, to increase the hands-on experience of attendees.

  • Zend Certified PHP Engineer badge
  • Symfony Certified Developer badge

Modules

This training consists of the following modules:

Introduction to PHPUnit

  • What is test automation?
  • Benefits of test automation
  • What is PHPUnit?
  • Installing PHPUnit
  • Configuring PHPUnit

Test types

  • Functional vs. non-functional
  • Unit tests
  • Integration tests
  • System tests
  • Designing a balanced test suite
  • The Test Pyramid

Writing unit tests with PHPUnit

  • Creating a test class
  • Writing a test method
  • Making assertions
  • Running PHPUnit
  • Testing exceptions
  • Data providers

Test doubles

  • Dummy objects
  • Fake objects
  • Stubs
  • Spies
  • Mocks
  • Creating stubs and mocks with PHPUnit

Integration and system tests

  • Testing with a database
  • Testing with external services
  • Testing with the file system
  • Testing the full application stack

Code coverage

  • What is code coverage?
  • Code coverage metrics
  • Measuring code coverage
  • Interpreting code coverage results

Writing high-quality tests

  • The FIRST principles
  • Readable tests
  • Arrange, Act, Assert
  • Test smells

In-company training

Do you want to train your entire team in PHPUnit? This training can also be given in-company, in English or in Dutch. To adapt the training to match the tools and technologies used at your company, the training can be extended with optional modules:

Testing Symfony applications

  • The PHPUnit Bridge
  • KernelTestCase
  • WebTestCase

Mutation testing

  • What is mutation testing?
  • Installing Infection
  • Mutators
  • Running mutation tests
  • Interpreting mutation test results

Please get in touch to discuss the possibilities to further customize the training to your needs.

Why follow one of my trainings?

Pricing

Classroom training

€ 540 /person

  • 1-day training
  • Open for individual participation
  • In Amersfoort
  • Coffee and lunch included
  • Starting from 3 participants
Find a session

In-company

upon request

  • Online or in your office
  • In English or Dutch
  • Up to 12 participants
  • Can be customized to your needs
Request a quote

All prices are excluding 21% BTW (VAT).

Get in touch

Do you have any questions about the "Test Automation with PHPUnit" training?

Share this page: