Chapters
23 Chapters
|
1:59:49
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: >=5.4.0, <7.3.0
Subscribe to download the code!Compatible PHP versions: >=5.4.0, <7.3.0
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
04.
Behat
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.
This tutorial uses a very old version of Symfony. The fundamentals of Behat are still valid, but integration with Symfony will be different.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=5.4.0, <7.3.0",
"symfony/symfony": "^2.7", // v2.7.4
"twig/twig": "^1.22", // v1.22.1
"sensio/framework-extra-bundle": "^3.0", // v3.0.16
"doctrine/doctrine-bundle": "^1.5", // v1.5.1
"doctrine/orm": "^2.5", // v2.5.1
"doctrine/doctrine-fixtures-bundle": "^2.2", // v2.2.1
"behat/symfony2-extension": "^2.0" // v2.0.0
},
"require-dev": {
"behat/mink-extension": "^2.0", // v2.0.1
"behat/mink-goutte-driver": "^1.1", // v1.1.0
"behat/mink-selenium2-driver": "^1.2", // v1.2.0
"phpunit/phpunit": "^4.8" // 4.8.18
}
}
8 Comments
I think it's much better to implement a
lscommand by using theDirectoryIteratorclass than to use theshell_exec()to run the unixls.Hey ahmadmayahi!
Yea, I'd agree actually :). This is just an example, and the point is to actually test the ls command itself. But if I really wanted directory info in PHP, I'd totally not do it this way. Actually, I usually use Symfony's Finder component - it's got a few extra nice features.
Cheers!
You show that we can see how many steps are passed and failed. Is there any quick way to know which step is failed and detail reason for that?
Hey Muhammad!
Yes! Well, probably :). The Behat executable has a number of different output options, so that the final output can be more or less descriptive. By default, it summarizes (at the bottom) how many steps passed/failed, and you can scroll up to see which steps fails with the detailed reason (well, semi-detailed: Behat only knows which *step* failed, and the error message that was thrown that caused the failure). By using the the --format (or just -f) flag, you can change the output: http://docs.behat.org/en/v2...
Alternatively, you could use a hook to do some custom logging on each failure - see https://knpuniversity.com/s...
Let me know if that helps!
Cheers!
Im pretty sure that the ls command would have been developed by the fathers of Unix at Bell laboratories back in the 70s :) FWIW
Ah damn, that is almost definitely true :).
This comment is for the previous "Challenge 2 of 2" (https://knpuniversity.com/s... there is a quote (") missing after "Given there is a" in the Scenario box.
Thanks AJ! I got that quote added now!
"Houston: no signs of life"
Start the conversation!