Skip to content

Commit

Permalink
Fix RST text formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Nov 16, 2024
1 parent f86d355 commit 30fdd7b
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 35 deletions.
3 changes: 2 additions & 1 deletion community.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Community

Behat has an amazing community around it.

The Behat community is friendly and welcoming. All questions and comments are valuable, so please come join the discussion!
The Behat community is friendly and welcoming. All questions and comments are
valuable, so please come join the discussion!

There are a number of places to connect with community members at all experience levels.

Expand Down
18 changes: 12 additions & 6 deletions cookbooks/creating_a_context_configuration_extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,17 @@ The ``configure`` method is used to define the configuration tree.
.. note::

The ``initialize`` and ``process`` methods are empty in our case but are useful when you need to interact with other extensions or process the container after it has been compiled.
The ``initialize`` and ``process`` methods are empty in our case but are
useful when you need to interact with other extensions or process the
container after it has been compiled.

Initializing the Context
------------------------

To pass configuration values to our ``HelloWorldContext``, we need to create an initializer.

.. code-block::
src/
Context/
Initializer/
Expand Down Expand Up @@ -180,7 +182,8 @@ The code for ``HelloWorldInitializer.php``:
}
}
We need to register the initializer definition within the Behat container through the ``HelloWorldExtension``, ensuring it gets loaded:
We need to register the initializer definition within the Behat container
through the ``HelloWorldExtension``, ensuring it gets loaded:

.. code-block:: php
Expand Down Expand Up @@ -211,9 +214,11 @@ We need to register the initializer definition within the Behat container throug
Using the extension
-------------------

Now that the extension is ready and will inject values into context, we just need to configure it into a project.
Now that the extension is ready and will inject values into context, we just
need to configure it into a project.

In the ``extensions`` key of a profile (``default`` in our case), we'll add the ``HelloWorldExtension`` key and configure our ``text`` and ``enable`` value.
In the ``extensions`` key of a profile (``default`` in our case), we'll add
the ``HelloWorldExtension`` key and configure our ``text`` and ``enable`` value.

Finally, we need to load the ``HelloWorld\Context\HelloWorldContext`` into our suite.

Expand Down Expand Up @@ -247,7 +252,8 @@ Conclusion
----------

Congratulations! You have just created a simple Behat extension.
This extension demonstrates three of the common steps to building a Behat extension: defining an extension, creating an initializer, and configuring contexts.
This extension demonstrates three of the common steps to building a Behat
extension: defining an extension, creating an initializer, and configuring contexts.

Feel free to experiment with this extension and expand its functionality.

Expand Down
2 changes: 1 addition & 1 deletion user_guide/command_line_tool/formatting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ respectively:

.. code-block:: bash
$ behat --no-colors
$ behat --no-colors
45 changes: 29 additions & 16 deletions user_guide/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ Or maybe we want to unset the tag filter for a profile:
Importing Config
----------------

The ``imports`` block can be used to merge multiple configuration files in to one loaded config in Behat, using the following syntax:
The ``imports`` block can be used to merge multiple configuration files in to
one loaded config in Behat, using the following syntax:

.. code-block:: yaml
Expand All @@ -107,9 +108,13 @@ The ``imports`` block can be used to merge multiple configuration files in to on
- config/base.behat.yml
- config/ci.behat.yml
All files from the ``imports`` block will be loaded by Behat and merged, in the listed order, into your ``behat.yml`` config. This is especially useful when you want to tweak configuration slightly between local development and on Continuous Integration environments by using partial configuration files.
All files from the ``imports`` block will be loaded by Behat and merged, in
the listed order, into your ``behat.yml`` config. This is especially useful
when you want to tweak configuration slightly between local development and
on Continuous Integration environments by using partial configuration files.

This allows configuration files listed in the ``imports`` key to override configuration values for previously listed files.
This allows configuration files listed in the ``imports`` key to override
configuration values for previously listed files.

Global profile configuration
----------------------------
Expand All @@ -121,7 +126,7 @@ You can set some global configuration in your profile configuration:
# behat.yml
default:
testers: # these are the default values
stop_on_failure: false
stop_on_failure: false
strict: false
Combining the fact that you can override the default profile, you can change the configuration per profile:
Expand All @@ -139,9 +144,11 @@ Combining the fact that you can override the default profile, you can change the
stop_on_failure: false
strict: true
This way, with the default profile behat will stop on failure and won't be strict, but will not stop and will be strict if the CI profile is selected.
This way, with the default profile behat will stop on failure and won't be
strict, but will not stop and will be strict if the CI profile is selected.

You can force `--stop-on-failure` and `--strict` via CLI options to override configuration values.
You can force ``--stop-on-failure`` and ``--strict`` via CLI options to override
configuration values.

Environment Variable - BEHAT_PARAMS
-----------------------------------
Expand All @@ -155,23 +162,27 @@ environment variable:
You can set any value for any option that is available in a ``behat.yml`` file.
Just provide options in *JSON* format. Behat will use those options as defaults.
You can always override them with the settings in the project ``behat.yml`` file (it has higher priority).
You can always override them with the settings in the project ``behat.yml``
file (it has higher priority).

.. tip::

In order to specify a parameter in an environment variable, the value *must not* exist in your ``behat.yml``
In order to specify a parameter in an environment variable, the value
*must not* exist in your ``behat.yml``

.. tip::

NOTE: In Behat 2.x this variable was in *URL* format. It has been changed to use *JSON* format.
NOTE: In Behat 2.x this variable was in *URL* format. It has been changed
to use *JSON* format.

Global Filters
--------------

While it is possible to specify filters as part of suite configuration, sometimes you will want to
exclude certain scenarios across the suite, with the option to override the filters at the command line.
While it is possible to specify filters as part of suite configuration,
sometimes you will want to exclude certain scenarios across the suite,
with the option to override the filters at the command line.

This is achieved by specifying the filter in the `gherkin` configuration:
This is achieved by specifying the filter in the ``gherkin`` configuration:

.. code-block:: yaml
Expand All @@ -182,7 +193,7 @@ This is achieved by specifying the filter in the `gherkin` configuration:
filters:
tags: ~@wip
In this instance, scenarios tagged as `@wip` will be ignored unless the CLI command is run with a custom filter, e.g.:
In this instance, scenarios tagged as ``@wip`` will be ignored unless the CLI command is run with a custom filter, e.g.:

.. code-block:: bash
Expand All @@ -203,7 +214,9 @@ you want to autoload via ``behat.yml``:
autoload:
'': '%paths.base%/app/features/bootstrap'
If you wish to namespace your features (for example: to be PSR-1 compliant) you will need to add the namespace to the classes and also tell behat where to load them. Here ``contexts`` is an array of classes:
If you wish to namespace your features (for example: to be PSR-1 compliant)
you will need to add the namespace to the classes and also tell behat where
to load them. Here ``contexts`` is an array of classes:

.. code-block:: yaml
Expand Down Expand Up @@ -266,7 +279,7 @@ Extensions can be configured like this:
# behat.yml
default:
extensions:
extensions:
Behat\MinkExtension:
base_url: http://www.example.com
selenium2: ~
selenium2: ~
4 changes: 2 additions & 2 deletions user_guide/configuration/suites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ This will cause Behat to:
.. note::

``%paths.base%`` is a special variable in ``behat.yml`` that refers
to the folder in which ``behat.yml`` is stored. When using it, or
to the folder in which ``behat.yml`` is stored. When using it, or
any other percent-encased variable, it has to be put in quotes.

Path-based suites are an easy way to test highly-modular applications
Expand Down Expand Up @@ -122,7 +122,7 @@ features with specific tag (or name) in specific contexts:
.. note::

The `@` character is a special and requires the tag to be
The ``@`` character is a special and requires the tag to be
put in quotes.

This configuration will tell Behat to run features and scenarios
Expand Down
2 changes: 1 addition & 1 deletion user_guide/context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,4 @@ both context classes.

In other words, if your Suite uses at least two different Contexts, and
those context classes ``use`` the same Trait, this will result in a duplicate
step definition and Behat will complain by throwing a ``Redundant`` exception.
step definition and Behat will complain by throwing a ``Redundant`` exception.
11 changes: 7 additions & 4 deletions user_guide/context/definitions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ always use good old regular expressions:
public function thereAreMonsters($count) {}
And if you want to be able to say things in different ways that are not so
easily written as a single regular expression, you can write multiple
easily written as a single regular expression, you can write multiple
annotations for the one method:

.. code-block:: php
Expand All @@ -152,9 +152,12 @@ Behat will call the corresponding method if any of the patterns matches.

.. note::

Behat uses the ``preg_match()`` function to match these regular expressions to arguments. Special care is needed to make sure
that there is only one capturing group for each argument. A expression like ``(?P<property>([\w\s]+))`` contains an inner capturing
group (``([\w\s]+)``) and this may make some arguments not match correctly. The right expression to use would be ``(?P<property>[\w\s]+)``
Behat uses the ``preg_match()`` function to match these regular expressions
to arguments. Special care is needed to make sure that there is only one
capturing group for each argument. A expression like ``(?P<property>([\w\s]+))``
contains an inner capturing group (``([\w\s]+)``) and this may make some
arguments not match correctly. The right expression to use would be
``(?P<property>[\w\s]+)``

Definition Snippets
-------------------
Expand Down
2 changes: 1 addition & 1 deletion user_guide/gherkin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ run:
type, which is very important for methodologies like BDD and also gives
Behat the ability to have multilanguage features in one suite.

.. _`Business Readable, Domain Specific Language`: http://martinfowler.com/bliki/BusinessReadableDSL.html
.. _`Business Readable, Domain Specific Language`: http://martinfowler.com/bliki/BusinessReadableDSL.html
2 changes: 1 addition & 1 deletion user_guide/initialize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Suite Initialisation
Suites are a core part of Behat. Any feature of Behat knows about
them and can give you a hand with them. For example, if you defined
your suites in ``behat.yml`` before running ``--init``, it will actually
create the folders and suites you configured, instead of the default ones.
create the folders and suites you configured, instead of the default ones.
2 changes: 1 addition & 1 deletion user_guide/integrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ Drupal. See the documentation of the extension for more info and usage.
.. _`Mink`: https://mink.behat.org/
.. _`Mink Extension`: https://github.com/FriendsOfBehat/MinkExtension
.. _`Symfony Extension`: https://github.com/FriendsOfBehat/SymfonyExtension
.. _`Drupal Extension`: https://github.com/jhedstrom/drupalextension
.. _`Drupal Extension`: https://github.com/jhedstrom/drupalextension
2 changes: 1 addition & 1 deletion user_guide/organizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ with spaces:
.. note::

If a tag exists on a ``Feature``, Behat will assign that tag to all
child ``Scenarios`` and ``Scenario Outlines`` too.
child ``Scenarios`` and ``Scenario Outlines`` too.

0 comments on commit 30fdd7b

Please sign in to comment.