Chapters
29 Chapters
|
2:54:09
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: ^7.0, <7.4
Subscribe to download the code!Compatible PHP versions: ^7.0, <7.4
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
08.
Coding, Adding Features, Refactoring
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
While the fundamentals of PHPUnit haven't changed, this tutorial *is* built on an older version of Symfony and PHPUnit.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": "^7.0, <7.4",
"composer/package-versions-deprecated": "^1.11", // 1.11.99
"doctrine/doctrine-bundle": "^1.6", // 1.10.3
"doctrine/orm": "^2.5", // v2.7.2
"incenteev/composer-parameter-handler": "^2.0", // v2.1.2
"sensio/distribution-bundle": "^5.0.19", // v5.0.21
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.28
"symfony/monolog-bundle": "^3.1.0", // v3.1.2
"symfony/polyfill-apcu": "^1.0", // v1.6.0
"symfony/swiftmailer-bundle": "^2.3.10", // v2.6.7
"symfony/symfony": "3.3.*", // v3.3.13
"twig/twig": "^1.0||^2.0" // v2.4.4
},
"require-dev": {
"doctrine/data-fixtures": "^1.3", // 1.3.3
"doctrine/doctrine-fixtures-bundle": "^2.3", // v2.4.1
"liip/functional-test-bundle": "^1.8", // 1.8.0
"phpunit/phpunit": "^6.3", // 6.5.2
"sensio/generator-bundle": "^3.0", // v3.1.6
"symfony/phpunit-bridge": "^3.0" // v3.4.30
}
}
9 Comments
Declaring the dinosaur carnivorous if "carnivorous" is part of the string, doesn't really work. The dataProvider test would also succeed if the specification was "non-carnivorous".
Howdy,
Good Catch! Yes, I do believe you're correct... It probably would have been better if we did something like:
And then also added another specification to the
getSpecificationTests()data provider to ensure that anon-carnivorousspecification wasfalsewhen calling$dinosaur->isCarnivorous()The interesting thing about testing, is this scenario is actually called an "edge case" and it happens all the time... If I ran into this situation in a real project, I would ask myself:
1) How likely is it that we will run into this scenario?
2) If we do run into this scenario, will it cause any undesired side effects?
Depending on those answer's, I would either write a test and make sure it passes, or let sleeping dogs lie and move onto bigger problems...
By the way, did you know we're releasing a new version of this tutorial? Feel free to check it out https://symfonycasts.com/screencast/phpunit and let us know what you think.
Hi there,
I 😍 this tutorial about TDD.
Thanks for bring it us!
You're welcome!
Hi there,
This code looks like a bit outdated, maybe? If so, will you plan to update it with SF5?
Best regards.
Hey there,
could you tell me what part of the chapter looks outdated? I don't think we will redo this tutorial but like to keep it up to date by adding notes or updating only a relevant part of the code. Anyways, all the concepts taught here are still relevant
Cheers!
It's not related to this tutorial but the Symfony version which is being used at the tutorial.
I think Symfony4/5 brings us more utilities for testing.
Cheers!
The code block after "and... the scream Emoji!" is broken (maybe because of this Emoji).
Idem for the block after "the screaming Emoji for the second." and the one after "and paste at the bottom.".
Etc...
It seems it is the same issue for all blocks with the Emoji.
Hey Capucine,
Wooops, our bad! I just updated those code blocks - now them have emoji! :)
Thank you for reporting this! If you noticed any missing emoji further in the course - please, let us know and we will be happy to fix them as well.
Cheers!
"Houston: no signs of life"
Start the conversation!