@@ -165,16 +165,27 @@ The :class:`Symfony\\Bridge\\PhpUnit\\ClockMock` class provided by this bridge
165
165
allows you to mock the PHP's built-in time functions ``time() ``,
166
166
``microtime() ``, ``sleep() `` and ``usleep() ``.
167
167
168
- To use the ``ClockMock `` class in your test, you can:
168
+ To use the ``ClockMock `` class in your test, add the ``@group time-sensitive ``
169
+ annotation to its class or methods. This annotation only works when executing
170
+ PHPUnit using the ``vendor/bin/simple-phpunit `` script or when registering the
171
+ following listener in your PHPUnit configuration:
169
172
170
- * (**Recommended **) Add the ``@group time-sensitive `` annotation to its class or
171
- method;
173
+ .. code-block :: xml
174
+
175
+ <!-- phpunit.xml.dist -->
176
+ <!-- ... -->
177
+ <listeners >
178
+ <listener class =" \Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
179
+ </listeners >
180
+
181
+ .. note ::
172
182
173
- * Register it manually by calling ``ClockMock::register(__CLASS__) `` and
174
- ``ClockMock::withClockMock(true) `` before the test and
175
- ``ClockMock::withClockMock(false) `` after the test.
183
+ If you don't want to use the ``@group time-sensitive `` annotation, you can
184
+ register the ``ClockMock `` class manually by calling
185
+ ``ClockMock::register(__CLASS__) `` and ``ClockMock::withClockMock(true) ``
186
+ before the test and ``ClockMock::withClockMock(false) `` after the test.
176
187
177
- As a result, the following is guarenteed to work and is no longer a transient
188
+ As a result, the following is guaranteed to work and is no longer a transient
178
189
test::
179
190
180
191
use Symfony\Component\Stopwatch\Stopwatch;
0 commit comments