File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
tests/Unit/Internal/Support Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 3131 "psr/log" : " ^2.0 || ^3.0" ,
3232 "ramsey/uuid" : " ^4.7" ,
3333 "react/promise" : " ^2.9" ,
34- "roadrunner-php/roadrunner-api-dto" : " ^1.5.0" ,
34+ "roadrunner-php/roadrunner-api-dto" : " ^1.5.0 <1.7.0 " ,
3535 "roadrunner-php/version-checker" : " ^1.0" ,
3636 "spiral/attributes" : " ^3.1.4" ,
3737 "spiral/roadrunner" : " ^2023.3.12 || ^2024.1" ,
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ public static function toDuration(\DateInterval $i = null): ?Duration
162162 $ d = new Duration ();
163163 $ parsed = self ::parse ($ i );
164164 $ d ->setSeconds ((int )$ parsed ->totalSeconds );
165- $ d ->setNanos ($ parsed ->microseconds * 1000 );
165+ $ d ->setNanos (( $ parsed ->microseconds % 1_000_000 ) * 1000 );
166166
167167 return $ d ;
168168 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Temporal \Tests \Unit \Internal \Support ;
4+
5+ use PHPUnit \Framework \TestCase ;
6+ use Temporal \Internal \Support \DateInterval ;
7+
8+ class DateIntervalTestCase extends TestCase
9+ {
10+ public function testFloatyDateIntervalToDuration (): void
11+ {
12+ $ interval = DateInterval::toDuration (DateInterval::parse (5_000_356_000 , DateInterval::FORMAT_NANOSECONDS ));
13+
14+ $ this ->assertEquals (356_000 , $ interval ->getNanos ());
15+ $ this ->assertEquals (5 , $ interval ->getSeconds ());
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments