Get to know a subject and learn its fundamentals
Beginner level
No previous experience required.
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
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.
- Composer
- 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.
- Introduction to assertions
- Using multiple assertions
- Correcting bugs through testing
- 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.
- Dependencies between tests
- SetUp and TearDown
- Test fixtures
- 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.
- Creating mock objects to avoid external dependencies
- Dependency injection
- 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.
- Writing tests before code
- Targeted development test
- 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.
- Protected / private methods
- Protected / private attributes
- 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.
