Skip to content

Commit fc2442e

Browse files
committed
Minor reword
1 parent e8c1b8f commit fc2442e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/phpunit_bridge.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,11 @@ allows you to mock the PHP's built-in time functions ``time()``, ``microtime()``
335335
``sleep()``, ``usleep()`` and ``gmdate()``. Additionally the function ``date()``
336336
is mocked so it uses the mocked time if no timestamp is specified.
337337

338-
This means that you don't need to make a single change in your original code, except when using ``new DateTime()``, which must be replaced by ``DateTime::createFromFormat('U', time())`` to use the mocked ``time()`` function.
339-
340338
Other functions with an optional timestamp parameter that defaults to ``time()``
341-
will still use the system time instead of the mocked time.
339+
will still use the system time instead of the mocked time. This means that you
340+
may need to change some code in your tests. For example, instead of ``new DateTime()``,
341+
you should use ``DateTime::createFromFormat('U', time())`` to use the mocked
342+
``time()`` function.
342343

343344
To use the ``ClockMock`` class in your test, add the ``@group time-sensitive``
344345
annotation to its class or methods. This annotation only works when executing

0 commit comments

Comments
 (0)