forked from shlinkio/shlink-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRealTimeUpdatesTopicsConfigOptionTest.php
More file actions
47 lines (39 loc) · 1.58 KB
/
RealTimeUpdatesTopicsConfigOptionTest.php
File metadata and controls
47 lines (39 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace ShlinkioTest\Shlink\Installer\Config\Option\RealTimeUpdates;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
use Shlinkio\Shlink\Installer\Config\Option\RealTimeUpdates\RealTimeUpdatesTopicsConfigOption;
use Symfony\Component\Console\Style\StyleInterface;
class RealTimeUpdatesTopicsConfigOptionTest extends TestCase
{
private RealTimeUpdatesTopicsConfigOption $configOption;
public function setUp(): void
{
$this->configOption = new RealTimeUpdatesTopicsConfigOption();
}
#[Test]
public function returnsExpectedEnvVar(): void
{
self::assertEquals('REAL_TIME_UPDATES_TOPICS', $this->configOption->getEnvVar());
}
/**
* @param list<bool> $topicAnswers
*/
#[Test]
#[TestWith([false, [], null])]
#[TestWith([true, [false, false, false, false], []])]
#[TestWith([true, [true, false, false, false], ['NEW_VISIT']])]
#[TestWith([true, [true, false, false, true], ['NEW_VISIT', 'NEW_SHORT_URL']])]
#[TestWith([true, [false, true, true, true], ['NEW_SHORT_URL_VISIT', 'NEW_ORPHAN_VISIT', 'NEW_SHORT_URL']])]
public function expectedQuestionIsAsked(
bool $individualTopicsAnswer,
array $topicAnswers,
array|null $expectedTopics,
): void {
$io = $this->createStub(StyleInterface::class);
$io->method('confirm')->willReturnOnConsecutiveCalls($individualTopicsAnswer, ...$topicAnswers);
$answer = $this->configOption->ask($io, []);
self::assertEquals($expectedTopics, $answer);
}
}