• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tempestphp / tempest-framework / 9045933531

11 May 2024 07:25PM UTC coverage: 86.566% (+0.3%) from 86.24%
9045933531

Pull #240

github

web-flow
Merge ef4f1596e into d6a8ae2f5
Pull Request #240: feat: Adds Timebox utility class and extends Clock

30 of 33 new or added lines in 4 files covered. (90.91%)

21 existing lines in 4 files now uncovered.

1321 of 1526 relevant lines covered (86.57%)

10.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/Clock/GenericClock.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Clock;
6

7
use DateTimeImmutable;
8

9
final class GenericClock implements Clock
10
{
11
    public function now(): DateTimeImmutable
12
    {
13
        return new DateTimeImmutable('now');
7✔
14
    }
15

16
    /**
17
     * Returns the unix timestamp of the current time in the given unit.
18
     *
19
     * @param TimeUnit $unit
20
     *
21
     * @return int
22
     */
23
    public function time(TimeUnit $unit = TimeUnit::SECOND): int
24
    {
25
        return (int) floor((microtime(true) * 1_000_000) / $unit->toMicroseconds());
7✔
26
    }
27

28
    public function sleep(int $time, TimeUnit $unit = TimeUnit::SECOND): void
29
    {
NEW
30
        usleep($time * $unit->toMicroseconds());
×
31
    }
32
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc