Skip to content

Commit

Permalink
Merge pull request #123 from damienflament/patch-2
Browse files Browse the repository at this point in the history
Improve documentation about PSR-4 custom autoloading
  • Loading branch information
acoulton authored Nov 8, 2024
2 parents 61ee693 + 8772228 commit c96315a
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions user_guide/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,31 @@ If you wish to namespace your features (for example: to be PSR-1 compliant) you
default:
contexts: [My\Application\Namespace\Bootstrap\FeatureContext]
.. note::
Using ``behat.yml`` to autoload will only allow for ``PSR-0``.
You can also use ``composer.json`` to autoload, which will also
allow for ``PSR-4``
Using ``behat.yml`` to autoload will only allow for ``PSR-0``.
You can also use ``composer.json`` to autoload, which will also allow for ``PSR-4``:

.. code-block:: json
// composer.json
"autoload-dev": {
"psr-4": {
"My\\Application\\Namespace\\Bootstrap\\": "app/features/bootstrap"
}
}
If you add this to your ``composer.json`` file, then you won't need to specify autoloading in
your ``behat.yml` file:
.. code-block:: yaml
# behat.yml
default:
suites:
default:
contexts: [My\Application\Namespace\Bootstrap\FeatureContext]
Formatters
----------
Expand Down

0 comments on commit c96315a

Please sign in to comment.