-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Config - Context #182
base: v3.0
Are you sure you want to change the base?
PHP Config - Context #182
Conversation
b3051d3
to
7224c2b
Compare
7224c2b
to
dfc0eb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @loic425, just got a few changes to suggest (mostly all the same thing).
Joyeux Noël!
@@ -263,62 +312,85 @@ As a matter of fact, Behat gives you ability to do just that. You can | |||
specify arguments required to instantiate your context classes through | |||
same ``contexts`` setting inside your ``behat.yml``: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same ``contexts`` setting inside your ``behat.yml``: | |
same ``contexts`` setting inside your ``behat.php``: |
use App\Tests\Behat\Context\FeatureContext; | ||
use App\Tests\Behat\Context\SecondContext; | ||
use App\Tests\Behat\Context\ThirdContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should keep the contexts in all these examples in the root namespace, because "out of the box" just following the instructions on this page, these won't be autoloadable by behat (unless you put them in features/bootstrap/App/Tests/Behat/Context/FeatureContext
).
Of course I realise that the vast majority of people these days are familiar with how to configure autoloading themselves e.g. through composer, but while we're providing / documenting Behat's custom autoloader I think the docs examples should be consistent with how that behaves.
use App\Tests\Behat\Context\FeatureContext; | |
use App\Tests\Behat\Context\SecondContext; | |
use App\Tests\Behat\Context\ThirdContext; | |
use FeatureContext; | |
use SecondContext; | |
use ThirdContext; |
<?php | ||
// behat.php | ||
|
||
use App\Tests\Behat\Context\MyAwesomeContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use App\Tests\Behat\Context\MyAwesomeContext; | |
use MyAwesomeContext; |
use App\Tests\Behat\Context\MyAwesomeContext; | ||
use App\Tests\Behat\Context\MyWickedContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use App\Tests\Behat\Context\MyAwesomeContext; | |
use App\Tests\Behat\Context\MyWickedContext; | |
use MyAwesomeContext; | |
use MyWickedContext; |
<?php | ||
// behat.php | ||
|
||
use App\Tests\Behat\Context\MyAwesomeContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Especially in this example, as the example context class itself is not namespaced and says it is in features/bootstrap/MyAwesomeContext.php
:
use App\Tests\Behat\Context\MyAwesomeContext; | |
use MyAwesomeContext; |
|
||
.. code-block:: yaml | ||
use App\Tests\Behat\Context\MyAwesomeContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use App\Tests\Behat\Context\MyAwesomeContext; | |
use MyAwesomeContext; |
<?php | ||
// behat.php | ||
|
||
use App\Tests\Behat\Context\MyAwesomeContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use App\Tests\Behat\Context\MyAwesomeContext; | |
use MyAwesomeContext; |
<?php | ||
// behat.php | ||
|
||
use App\Tests\Behat\Context\MyAwesomeContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use App\Tests\Behat\Context\MyAwesomeContext; | |
use MyAwesomeContext; |
Overview https://behat--182.org.readthedocs.build/en/182/user_guide/context.html