Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine

PHPUnit: Pruebas de Integración con Live Services

1:02:48

What you'll be learning

Este tutorial utiliza PHPUnit 9, pero funciona perfectamente con PHPUnit 10.
// 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
    }
}
// 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
    }
}

¡Ya estamos de vuelta! En el episodio 1, recorrimos la belleza y pureza de las pruebas unitarias. Pero ahora nos adentramos en el mundo más desordenado, pero superútil, de las pruebas de integración:

  • ¿Pruebas de integración? ¿Qué es eso? ¿Cuándo las necesito?
  • Acceder a los servicios desde el contenedor
  • Limpiar la base de datos entre pruebas
  • Alimentar la base de datos
  • Fábricas de Foundry y mucho más!
  • Mocking parcial: simula sólo algunas dependencias
  • Probar correos electrónicos
  • Probar mensajes de Messenger

Las pruebas de integración son divertidas y constituyen una herramienta fundamental para un conjunto de pruebas completo. ¡Hagámoslo!


Your Guides

Jesse Rushlow Ryan Weaver

Buy Access

Join the Conversation?

15
Login or Register to join the conversation
Yuuki-K Avatar

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

4 Reply
Jesse-Rushlow Avatar
Jesse-Rushlow Avatar Jesse-Rushlow | SFCASTS | Yuuki-K | posted hace 10 meses

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 Avatar Mohamed-M | posted hace 9 meses

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 Avatar Jesse-Rushlow | SFCASTS | Mohamed-M | posted hace 9 meses

Howdy Mohamed-M,

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

Reply
Maverick Avatar

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
Maverick Avatar

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

Reply
Sidi-LEKHAIFA Avatar
Sidi-LEKHAIFA Avatar Sidi-LEKHAIFA | posted hace 3 meses | edited

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

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

Hello to the Symfonycast team !

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

Reply
Fabien-G Avatar

Finally ! ;)

Reply

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

Cheers!

1 Reply
Cat in space

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

userVoice