Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine

PHPUnit: Unit Testing with a Bite!


What you'll be learning

// composer.json
    "require": {
        "php": ">=8.1.0",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "symfony/asset": "6.1.*", // v6.1.0
        "symfony/console": "6.1.*", // v6.1.4
        "symfony/dotenv": "6.1.*", // v6.1.0
        "symfony/flex": "^2", // v2.2.3
        "symfony/framework-bundle": "6.1.*", // v6.1.4
        "symfony/http-client": "6.1.*", // v6.1.4
        "symfony/runtime": "6.1.*", // v6.1.3
        "symfony/twig-bundle": "6.1.*", // v6.1.1
        "symfony/yaml": "6.1.*" // v6.1.4
    "require-dev": {
        "phpunit/phpunit": "^9.5", // 9.5.23
        "symfony/browser-kit": "6.1.*", // v6.1.3
        "symfony/css-selector": "6.1.*", // v6.1.3
        "symfony/phpunit-bridge": "^6.1" // v6.1.3

Wait, someone built ANOTHER dinosaur park with ZERO tests!?!? I've seen this movie before and it's up to us: to add a rich set of tests before the dinos come for us...

But seriously: testing is great. It's not only a tool for preventing bugs, it's also a development philosophy that can help you write code that's more focused on what you actually want to build.

In this tutorial, we'll get you to super-hero status of unit testing, including:

  • Basic unit testing
  • Test-Driven-Development: how to do it, when to do it!
  • Using data providers to run tests over and over again with different input
  • Mocking and test doubles! Creating mocks in PHPUnit
  • The PHPUnit executable and configuration
  • Testing for exceptions

What about "integration" and "functional" testing? Stay tuned for the next tutorials in this series!

Your Guides

Jesse Rushlow Ryan Weaver

Buy Access

Join the Conversation?

Login or Register to join the conversation

Thank you for this awesome course! I thought testing was scary, but as I follow the tutorials and finish it, I guess now the dinosaurs are scarier than writing tests


Haha, thanks for the great feedback, we are happy that you learned to not touch hungry Dino ;)

Evgeny Avatar

When is the course scheduled to continue?


Sorry but can't share any details yet. Keep watching updates!

Evgeny Avatar

Great job, guys!


Thanks for your feedback, stay tuned more interesting courses are coming!

1 Reply
Cat in space

"Houston: no signs of life"
Start the conversation!