Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine

PHPUnit: ¡Pruebas Unitarias con un Bocado!

1:17:50

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
    }
}

Espera, ¿¡alguien ha construido OTRO parque de dinosaurios con CERO pruebas!? Ya he visto esta película y depende de nosotros: añadir un rico conjunto de pruebas antes de que los dinos vengan por nosotros...

Pero en serio: las pruebas son geniales. No sólo es una herramienta para evitar errores, sino también una filosofía de desarrollo que puede ayudarte a escribir un código más centrado en lo que realmente quieres construir

En este tutorial, te llevaremos al nivel de superhéroe de las pruebas unitarias, incluyendo

  • Pruebas unitarias básicas
  • Test-Driven-Development: cómo hacerlo, cuándo hacerlo
  • Uso de proveedores de datos para ejecutar pruebas una y otra vez con diferentes entradas
  • Mocking y Test doubles! Creación de mocks en PHPUnit
  • El ejecutable de PHPUnit y su configuración
  • Pruebas de excepciones

¿Qué pasa con las pruebas de "integración" y "funcionales"? ¡Permanece atento a los próximos tutoriales de esta serie!


Your Guides

Jesse Rushlow Ryan Weaver

Buy Access

Join the Conversation?

8
Login or Register to join the conversation

Thanks for this awesome course! Will Behat be updated soon?

Reply

Hey Vincent-amstz,

No plans to update the Behat course soon, though we recently added a lot of notes to it to make it work on Symfony 5. The notes are places in the videos of the course and in the course scripts below the video as well. Also, we wrote the whole blog post explaining how to set it up correctly on Symfony 5, you can check it out here: https://symfonycasts.com/blog/behat-symfony - this should help to set it up on Symfony 5+, so in theory, it should also work for Symfony 6. We use Behat on the SymfonyCasts project, and we're on Symfony 6.1 now, so we upgraded without major problems and Behat still works for us.

So in short, the only problem with Behat on Symfony 5+ versions is setting it up and configuring properly to make it work. As soon as you were able to do this - it should work well and the concepts we're teaching in https://symfonycasts.com/screencast/behat are still valid for today.

But in case you get stuck following that course on the newest Symfony 6 version - let us know in the comments below the video or in that blog post and we will help you! I hope this helps :)

Cheers!

1 Reply

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

Reply

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

Reply
Evgeny Avatar

When is the course scheduled to continue?

Reply

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

Reply
Evgeny Avatar

Great job, guys!

Reply

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

1 Reply
Cat in space

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

userVoice