File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,14 @@ final public function runAsyncTest(...$args)
7070 throw $ exception ;
7171 }
7272
73- $ actualRuntime = ( int ) ( \round ( \microtime ( true ) - $ start , self :: RUNTIME_PRECISION ) * 1000 );
74- if ( $ this -> minimumRuntime > $ actualRuntime) {
73+ if ( $ this -> minimumRuntime > 0 ) {
74+ $ actualRuntime = ( int ) ( \round ( \microtime ( true ) - $ start , self :: RUNTIME_PRECISION ) * 1000 );
7575 $ msg = 'Expected test to take at least %dms but instead took %dms ' ;
76- $ this ->fail (\sprintf ($ msg , $ this ->minimumRuntime , $ actualRuntime ));
76+ $ this ->assertGreaterThanOrEqual (
77+ $ this ->minimumRuntime ,
78+ $ actualRuntime ,
79+ \sprintf ($ msg , $ this ->minimumRuntime , $ actualRuntime )
80+ );
7781 }
7882
7983 return $ returnValue ;
@@ -86,6 +90,10 @@ final public function runAsyncTest(...$args)
8690 */
8791 final protected function setMinimumRuntime (int $ runtime )
8892 {
93+ if ($ runtime < 1 ) {
94+ throw new \Error ('Minimum runtime must be at least 1ms ' );
95+ }
96+
8997 $ this ->minimumRuntime = $ runtime ;
9098 }
9199
You can’t perform that action at this time.
0 commit comments