> Testing >

Course Overview

Login to bookmark this course

PHPUnit: Integration Testing with Live Services

Shake hands with the messier yet rewarding world of integration testing. Learn database seeding, email, and messenger message testing.

  • 670 students
  • EN/ES Captions
  • EN/ES Script
  • Certificate of Completion

Your Guides

About this course

This tutorial uses PHPUnit 9 but works just fine for PHPUnit 10.

What PHP libraries does this tutorial use?

// composer.json
{
    "require": {
        "php": ">=8.1.0",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/doctrine-bundle": "^2.8", // 2.10.2
        "doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.4
        "doctrine/orm": "^2.14", // 2.16.2
        "symfony/asset": "6.3.*", // v6.3.0
        "symfony/console": "6.3.*", // v6.3.4
        "symfony/dotenv": "6.3.*", // v6.3.0
        "symfony/flex": "^2", // v2.3.3
        "symfony/framework-bundle": "6.3.*", // v6.3.5
        "symfony/http-client": "6.3.*", // v6.3.5
        "symfony/mailer": "6.3.*", // v6.3.5
        "symfony/messenger": "6.3.*", // v6.3.5
        "symfony/monolog-bundle": "^3.0", // v3.8.0
        "symfony/runtime": "6.3.*", // v6.3.2
        "symfony/security-csrf": "6.3.*", // v6.3.2
        "symfony/twig-bundle": "6.3.*", // v6.3.0
        "symfony/yaml": "6.3.*" // v6.3.3
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.4
        "phpunit/phpunit": "^9.5", // 9.6.13
        "symfony/browser-kit": "6.3.*", // v6.3.2
        "symfony/css-selector": "6.3.*", // v6.3.2
        "symfony/debug-bundle": "6.3.*", // v6.3.2
        "symfony/maker-bundle": "^1.48", // v1.51.1
        "symfony/phpunit-bridge": "^6.2", // v6.3.2
        "symfony/stopwatch": "6.3.*", // v6.3.0
        "symfony/web-profiler-bundle": "6.3.*", // v6.3.2
        "zenstruck/foundry": "^1.35", // v1.35.0
        "zenstruck/mailer-test": "^1.3", // v1.3.0
        "zenstruck/messenger-test": "^1.7" // v1.7.3
    }
}

What PHP libraries does this tutorial use?

// composer.json
{
    "require": {
        "php": ">=8.1.0",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/doctrine-bundle": "^2.8", // 2.10.2
        "doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.4
        "doctrine/orm": "^2.14", // 2.16.2
        "symfony/asset": "6.3.*", // v6.3.0
        "symfony/console": "6.3.*", // v6.3.4
        "symfony/dotenv": "6.3.*", // v6.3.0
        "symfony/flex": "^2", // v2.3.3
        "symfony/framework-bundle": "6.3.*", // v6.3.5
        "symfony/http-client": "6.3.*", // v6.3.5
        "symfony/mailer": "6.3.*", // v6.3.5
        "symfony/messenger": "6.3.*", // v6.3.5
        "symfony/monolog-bundle": "^3.0", // v3.8.0
        "symfony/runtime": "6.3.*", // v6.3.2
        "symfony/security-csrf": "6.3.*", // v6.3.2
        "symfony/twig-bundle": "6.3.*", // v6.3.0
        "symfony/yaml": "6.3.*" // v6.3.3
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.4
        "phpunit/phpunit": "^9.5", // 9.6.13
        "symfony/browser-kit": "6.3.*", // v6.3.2
        "symfony/css-selector": "6.3.*", // v6.3.2
        "symfony/debug-bundle": "6.3.*", // v6.3.2
        "symfony/maker-bundle": "^1.48", // v1.51.1
        "symfony/phpunit-bridge": "^6.2", // v6.3.2
        "symfony/stopwatch": "6.3.*", // v6.3.0
        "symfony/web-profiler-bundle": "6.3.*", // v6.3.2
        "zenstruck/foundry": "^1.35", // v1.35.0
        "zenstruck/mailer-test": "^1.3", // v1.3.0
        "zenstruck/messenger-test": "^1.7" // v1.7.3
    }
}

We're back! In episode 1, we walked through the beauty & purity unit testing. But now, we're onto the messier, but super-useful world of integration testing:

  • Integration testing? What is that? When do I need that?
  • Accessing services from the container
  • Clearing the database between tests
  • Seeding the database
  • Foundry Factories & more!
  • Partial Mocking: mock just some dependencies
  • Testing emails
  • Testing messenger messages

Integration tests are fun and are a critical tool to a well-rounded test suite. Let's go!

Next courses in the Testing: Beginner Testing section of the Testing Track!

15 Comments

Sort By
Login or Register to join the conversation
Yuuki-K avatar Yuuki-K 1 year ago

Hello, is there any schedule on when this course is set to release?

4 | Reply |
Jesse-Rushlow avatar Jesse-Rushlow SFCASTS Yuuki-K 1 year ago

Howdy Yuuki-K,

We do not have a firm release date set quite yet. But, the plan is to have this episode roll out in Q1 2023. Now that the holiday's are behind us and the kids are back in school, I'll be full steam ahead on getting this out the door to every as quick as possible.

Be sure to keep an eye on the @SymfonyCasts & @JesseRushlow Twitter feeds in the coming week's - I'm sure we'll be posting some updates as we get closer to the release of our prehistoric friends...

Cheers!

5 | Reply |
Mohamed-M avatar Mohamed-M 1 year ago

Hello, is there any update about the schedule ?

2 | Reply |

Hey Mohamed,

You can find upcoming tutorials on this page: https://symfonycasts.com/courses?status=upcoming&sort=popular#all

Cheers!

| Reply |
Jesse-Rushlow avatar Jesse-Rushlow SFCASTS Mohamed-M 1 year ago

Howdy Mohamed-M,

Not yet, but other than we're working on the tutorial as we speak...

| Reply |

Ping... what is the status?

| Reply |

Soooooon.... we had some issues, internally. Sorry about the delay! But this will be the next tutorial

2 | Reply |

Thanks for the quick answer, I'm looking forward to it.

| Reply |

Thank you very much @Jesse-Rushlow for these tutorials on Unit tests, it's very clear, can't wait to find the rest on integration tests 🤞

1 | Reply |
Igor-P avatar Igor-P 11 months ago

So it's not actually about the full integration testing (with the frontend rendered heavily with js) but about backend application parts interaction?

| Reply |

Hey Igor,

I know naming may be confusing sometimes. Yeah, that's mostly "backend" integration part, i.e. the one that goes after unit testing. With integration testing you start using real objects and Symfony services as dependencies instead of mocking everything. The part you're talking about (when the frontend rendered heavily with js) is called functional testing, not integration testing.

I hope it's clearer for you now.

Cheers!

| Reply |
Fabien-G avatar Fabien-G 1 year ago

Hello to the Symfonycast team !

Is there any news about this course?
Has a release date been announced?

| Reply |

Next week! :)

2 | Reply |

Finally ! ;)

| Reply |

Sorry for the delay, the course is being released now :)

Cheers!

1 | Reply |

Delete comment?

Share this comment

astronaut with balloons in space

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