From e8bde74ea906422b2b1d893929e56ddd6492717d Mon Sep 17 00:00:00 2001 From: temenb Date: Tue, 29 Aug 2017 13:30:00 +0300 Subject: [PATCH 1/2] Update phpunit_bridge.rst $stopwatch->stop('event_name')->getDuration() returns time in milliseconds, so original test will fail in any way.. but not only because of "However, depending on the load of the server or the processes running on your local machine, the $duration could for example be 10.000023s instead of 10s." --- components/phpunit_bridge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 51edba1de66..e6c8a4a31e9 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -224,7 +224,7 @@ If you have this kind of time-related tests:: sleep(10); $duration = $stopwatch->stop('event_name')->getDuration(); - $this->assertEquals(10, $duration); + $this->assertEquals(10000, $duration); } } From 8f136c6fa0ab2921b947aa3d06b19e80764757dd Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 30 Aug 2017 09:08:15 +0200 Subject: [PATCH 2/2] Fixed a minor syntax issue --- components/phpunit_bridge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index e6c8a4a31e9..137062093ad 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -231,7 +231,7 @@ If you have this kind of time-related tests:: You used the :doc:`Symfony Stopwatch Component ` to calculate the duration time of your process, here 10 seconds. However, depending on the load of the server or the processes running on your local machine, the -``$duration`` could for example be `10.000023s` instead of `10s`. +``$duration`` could for example be ``10.000023s`` instead of ``10s``. This kind of tests are called transient tests: they are failing randomly depending on spurious and external circumstances. They are often cause trouble