February 26-28, 2025
Montreal, Canada

Crafting Automated Tests for Your PHP Applications

Automated tests are the guardians of your code. They guarantee that your application code works as it should be. They also enable to reveal bugs or edge cases that were not taken into account during the initial development phase. Writing efficient and clean automated tests is one of the keys to make software more robust, maintainable and long lasting!

In the first half of this workshop, you will lean how to craft different types of automated tests in order to test all layers of a PHP application. We’ll first focus on testing low level PHP classes of a PHP application thanks to unit and integration tests within PHPUnit. Attendees will learn how to validate their base domain layer in isolation, so that they can safely refactor and extending them later. As our knowledge of unit testing grows, we’ll learn some techniques to cover pieces of software that are time sensitive or third party system dependent (database, HTTP network calls, etc.).

The second half of the workshop will teach you how to setup more high level types of tests : acceptance & end-to-end tests. Using Behat & the Gerkin DSL, you’ll learn how to write expressive test scenario that can be writtend & understood by anyone in the team, including non developers. Finally, we’ll dig into end-to-end testing with Panther, a PHP library that enables scripting and a running a complete Web browsing scenario within a real Chrome/Firefox browser. This is the ultimate goal to ensure your Web application acts as expected from the HTTP request to the HTTP response and JavaScript interaction with the end user.

Be prepared to jump on an extensive testing PHP application journey!

Course Program:

  • Writing & executing efficient unit tests suites with PHPUnit
  • Adopting the Test Driven Development approach
  • Computing a code coverage analysis report
  • Refactoring & improving code testability
  • Optimizing long running tests suites with parallel testing
  • Generating and loading fake data fixtures for a test scenario
  • Running tests against a database (reset the database between test run)
  • Handling time sensitive tests with a Clock mock
  • Mocking external services to prevent network calls or I/O
  • Implementing human-readable acceptance tests with Behat & Gherkin
  • Implementing end-to-end tests with Panther as if you were web browsing the application
  • Running a complete automated tests suite locally thanks to Composer scripts

Prerequisites:

  • Good knowledge of PHP & OOP

Technical requirements:
Each attendee is required to bring their own laptop equipped with the at least the following software configuration:

  • PHP 8.2 or 8.3 with enabled extensions: PDO, openssl, mbstring, intl, iconv, zip, xml, dom
  • Composer for installing PHP dependencies
  • SQLite or MySQL / Mariadb server
  • The IDE of their choice they are more comfortable with (PHPStorm recommended)

Duration:

  • 1 day
  • 9:00 am to 5:00 pm
  • 1 hour lunch break included at the hotel's restaurant
  • 15 min coffee break every morning and afternoon

Audience:
The workshop is highly practical and mainly targeted to PHP backend developers. A good knowledge of the PHP language and object oriented programming is highly recommended to jump onto this course. Please be advised that the trainer will make his best effort to accommodate everyone’s technical requirements at the beginning of the workshop but without any guarantee according to the number of participants. In order for everyone to take the most of this training, we strongly recommend each attendee to check their software configuration before the workshop takes place.

Hugo Hamon

KODERO

Hugo Hamon is a PHP and Symfony certified developer. He worked nine years for SensioLabs, the creators of Symfony, as a Web developer, head of training and software architect. He joined Dayuse.com as a backend lead developer between 2018 and 2020. He's now a full time freelance PHP consultant at his own company KODERO.

Read More

Montreal 2025 sponsored by

Become a sponsor