---
url: 'https://metadrop.net/en/training/drupal-unit-testing-tdd-course-with-phpunit'
title: 'Drupal Unit Testing / TDD course with PHPUnit'
author:
  name: 'Antonio Núñez'
  url: 'https://metadrop.net/es/user/23600'
date: '2026-08-06T12:36:49+00:00'
updated: '2026-09-14T11:09:42+00:00'
type: website
summary: "Metadrop's Drupal PHPUnit course covers unit testing, test-driven development (TDD), and automated testing for PHP developers building on Drupal."
tags:
  - Beginner
image: 'https://metadrop.net/sites/default/files/styles/full/public/2026-08/drupal-unit-testing-tdd-course-with-phpunit.webp?itok=3fJLqVX5'
published: true
og:
  determiner: Automatic
  site_name: Metadrop
  'image:url': 'https://metadrop.net/sites/default/files/styles/full/public/2026-08/drupal-unit-testing-tdd-course-with-phpunit.webp?itok=3fJLqVX5'
  'image:type': image/webp
  'image:width': '1316'
  'image:height': '740'
  'image:alt': 'Drupal Unit Testing / TDD course with PHPUnit'
  street_address: 'Calle Manuel Luna, 12, 3 Dcha'
  locality: Madrid
  region: Madrid
  postal_code: '28020'
  country_name: España
  email: hola@metadrop.net
  phone_number: '910053180'
schema:
  '@context': 'https://schema.org'
  '@graph':
    -
      '@type': Course
      name: 'Drupal Unit Testing / TDD course with PHPUnit'
      description: "Metadrop's Drupal PHPUnit course covers unit testing, test-driven development (TDD), and automated testing for PHP developers building on Drupal."
      educationalCredentialAwarded: 'Certificate of completion'
      '@id': 'https://metadrop.net/en/training/drupal-unit-testing-tdd-course-with-phpunit#course'
    -
      '@type': Organization
      '@id': 'https://metadrop.net/#organization'
      url: 'https://metadrop.net/'
      name: Metadrop
      sameAs:
        - 'https://www.drupal.org/metadrop'
        - 'https://twitter.com/metadrop'
        - 'https://asociaciondrupal.es/partner/metadrop'
        - 'https://www.linkedin.com/company/metadrop'
      logo:
        '@type': ImageObject
        url: 'https://metadrop.net/themes/custom/mdrop_radix/logo-metadrop-500-500.jpg'
        width: '500'
        height: '500'
    -
      '@type': ItemPage
      '@id': 'https://metadrop.net/en/training/drupal-unit-testing-tdd-course-with-phpunit'
      breadcrumb:
        '@type': BreadcrumbList
        itemListElement:
          -
            '@type': ListItem
            position: 1
            name: Home
            item: 'https://metadrop.net/en'
          -
            '@type': ListItem
            position: 2
            name: 'Technical training courses for teams and agencies'
            item: 'https://metadrop.net/en/training'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
---
 

 



 

 1. [Technical training courses for teams and agencies](https://metadrop.net/en/training)
 
  

# Drupal Unit Testing / TDD course with PHPUnit

 Metadrop's Drupal PHPUnit course covers unit testing, test-driven development (TDD), and automated testing for PHP developers building on Drupal. 

 [Get in touch](https://metadrop.net/en/contact)[See the modules](#course-modules) 

 



[9 modules](#course-modules)

Get to know a subject and learn its fundamentals



Beginner level

No previous experience required.





5 hours



 

We will give a review of the different tests that can be integrated into PHP using the PHPUnit Framework. Discovering what needs to be covered at the lower levels of development and how to execute them.

This course can be complemented with practical cases in workshop mode in subsequent days on projects indicated by the applicant.

## Requirements

- Knowledge of PHP (medium)
- Knowledge of Object Orientation (medium)
- Terminal handling (basic)
- Have PHP / Composer installed
- Have an IDE installed (PHPStorm, Netbeans, Visual Studio Code)



 

 

 ## What you will learn

By the end of the course you will be able to write and run PHPUnit tests for PHP code and apply test-driven development on your own project.

Set up a local PHPUnit environment with Composer and your IDE

Write tests with assertions following naming conventions and standards

Configure PHPUnit through its XML configuration file

Manage dependencies between tests, fixtures and exception testing

Isolate external dependencies using mocks and stubs

Apply TDD: write the test before the code and refactor with tests

Test protected and private methods and attributes, and static methods

 

  

 ## Course modules

    Module 1 - Introduction  Module details We review the different tests that can be integrated into PHP using the PHPUnit framework, and what needs to be covered at the lower levels of development.



 

     Module 2 - Local work environment setup  Module details Preparing the machine to run tests: installing PHPUnit with Composer and configuring the IDE to launch them and read the results.



1. Composer
2. IDE configuration



 

     Module 3 - Fundamentals  Module details The building blocks of a test: assertions, how to combine several of them, and the conventions that keep a test suite readable.



1. Introduction to *assertions*
2. Using multiple assertions
3. Correcting bugs through testing
4. Naming conventions and standards



 

     Module 4 - PHPUnit XML configuration  Module details Where PHPUnit reads its settings from and how to adapt the XML configuration file to the project.



 

     Module 5 - Test dependencies, fixtures and exceptions  Module details Controlling the state a test needs: dependencies between tests, set-up and tear-down, fixtures, and checking that exceptions are thrown.



1. Dependencies between tests
2. SetUp and TearDown
3. Test fixtures
4. Exceptions test



 

     Module 6 - Mocks and stubs  Module details Isolating the code under test from its external dependencies using mock objects, dependency injection and the Mockery framework.



1. Creating mock objects to avoid external dependencies
2. Dependency injection
3. Mockery - Framework



 

     Module 7 - TDD - Test Driven Development  Module details Turning testing into a development method: writing the test before the code and using it to drive and refactor the implementation.



1. Writing tests before code
2. Targeted development test
3. Code refactor with tests



 

     Module 8 - Advanced test  Module details Reaching the parts of a class that are not directly accessible: protected and private methods and attributes, and static methods.



1. Protected / private methods
2. Protected / private attributes
3. Static methods



 

     Module 9 - Conclusions  Module details Recap of what has been covered and how to carry on applying it to the project's own code.



 

         ### Earn a professional certificate

 Add this credential to your LinkedIn profile or your CV, and share it wherever you want to show your training.