Skip to content

Commit 837b76f

Browse files
committed
fix
1 parent b950981 commit 837b76f

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

src/ClientOptions/PollingOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function setMaxRetries(int $maxRetries): self
8787
$this->maxRetries = 80;
8888
error_log("Notice: setting the amount of retries for auto-parsing to 80.");
8989
} else {
90-
$this->delaySec = $maxRetries;
90+
$this->maxRetries = $maxRetries;
9191
}
9292
return $this;
9393
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ClientOptions;
6+
7+
use Mindee\ClientOptions\PollingOptions;
8+
use PHPUnit\Framework\TestCase;
9+
10+
class PollingOptionsTest extends TestCase
11+
{
12+
public function testConstructorNoArguments(): void
13+
{
14+
$pollingOptions = new PollingOptions();
15+
self::assertEquals(80, $pollingOptions->maxRetries);
16+
self::assertEquals(1.5, $pollingOptions->delaySec);
17+
self::assertEquals(2, $pollingOptions->initialDelaySec);
18+
}
19+
20+
public function testConstructorSomeArguments(): void
21+
{
22+
$pollingOptions = new PollingOptions(maxRetries: 100);
23+
self::assertEquals(100, $pollingOptions->maxRetries);
24+
self::assertEquals(1.5, $pollingOptions->delaySec);
25+
self::assertEquals(2, $pollingOptions->initialDelaySec);
26+
}
27+
28+
public function testConstructorAllArguments(): void
29+
{
30+
// voluntarily passing arguments in a different order than the constructor
31+
$pollingOptions = new PollingOptions(delaySec: 3.0, maxRetries: 100, initialDelaySec: 10);
32+
self::assertEquals(100, $pollingOptions->maxRetries);
33+
self::assertEquals(3, $pollingOptions->delaySec);
34+
self::assertEquals(10.0, $pollingOptions->initialDelaySec);
35+
}
36+
}

0 commit comments

Comments
 (0)