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!
21.
Finding inside HTML Tables
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
}
}
11 Comments
Hello and thank you for this screencast. It's really superb and helpful.
So i'm having difficulties with this feature... finding the fa check in the row. I'm just getting Fatal error: Call to undefined function assertNotNull() in /Users/...
Any idea why? I have PHPUnit installed, so i've obviously missed something stupid?
Thanks in advance.
Jon
Hey Jon!
I think you forgot to require PHPUnit assert functions library, just add this line to the top of your Context class (Adjust the path to your needs)
require_once __DIR__.'/../../../vendor/phpunit/phpunit/src/Framework/Assert/Functions.php';Have a nice day!
Thanks very much... it was a stupid one!
Keep up the good work
Hahaha, don't worry! It happens to all of us, I preffer to don't talk about the dummy things I've done :p
Hi Diego,
probably I had another stupid question but I can't find the answer so maybe you can help me. What about when I'm using PHPUnit Bridge (v5.0) and I want use asserts in behat.I found that the path to asserts functions is in other directory (not in vendor dir but in bin), but when I try to require it with new path
<br />require_once __DIR__.'/../../bin/.phpunit/phpunit-7.5-0/src/Framework/Assert/Functions.php';<br />or by using namespaces
<br />use PHPUnit\Framework\Assert;<br />I still get an error
<blockquote>
Fatal error: Class 'PHPUnit\Framework\Assert' not found (Behat\Testwork\Call\Exception\FatalThrowableError)
</blockquote>
Thanks a lot for any help.
Hey Cristóbal Rejdych
It's not a stupid question at all, actually, you hit a pesky bug! Check at this thread https://github.com/symfony/...
TL-DR If you need to work with PHPUnit directly, you will have to install that depedency ignoring the warnings coming from Symfony PHPUnitBridge
Cheers!
Hey Diego ;)
First of all thanks for quick reply. Yeah I saw this page before when I looked for solution, but that guy was talking about component called codeception which looks for me like another library to making tests. I was thinking about install PHPUnit and leave PHPUnitBridge too but it looks like duplication of code and I was affraid to break PHPUnitBridge. So that what I supposed to do? Just install PHPUnit without remove anything and ignore warnings?
Cheers!
Ah, yes, he got this same problem but when working with Codeception, the work around it's the same, just install PHPUnit and ignore the warning :)
On a separate note... can Behat / PHPUnit assert some text in a cell in a row containing some text, but also based of the what column the cell is in
e.g.
Adapting Then I should see (the text ):text in the :rowText row
.... with Then I should see (the text ):text in the :rowText row in the Column called "column4"
Hey Jon!
That's totally possible with the find method, using CSS selector, brings you all you can do with normal CSS, so you could do something like this:
I didn't test it (it should work), but it should give you an idea of what can you do :)
Have a nice day!
Thanks Diego.
I wasn't able to get it working today, but i'll keep trying
"Houston: no signs of life"
Start the conversation!