mirror of
https://gitee.com/ShopeX/ECShopX
synced 2026-06-28 19:15:36 +08:00
22 lines
575 B
PHP
22 lines
575 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\ShuyunOpenPlatform;
|
|
|
|
use ShuyunOpenPlatformBundle\Services\HistoricalSync\HistoricalSyncRateLimiter;
|
|
|
|
class HistoricalSyncRateLimiterTest extends \TestCase
|
|
{
|
|
public function testOneQpsSpansAtLeastTwoSecondsForThreeCalls(): void
|
|
{
|
|
$limiter = new HistoricalSyncRateLimiter(1.0);
|
|
$start = microtime(true);
|
|
$limiter->throttle();
|
|
$limiter->throttle();
|
|
$limiter->throttle();
|
|
$elapsed = microtime(true) - $start;
|
|
$this->assertGreaterThanOrEqual(1.9, $elapsed);
|
|
}
|
|
}
|