-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAppendExtraPathConfigOptionTest.php
More file actions
48 lines (38 loc) · 1.53 KB
/
AppendExtraPathConfigOptionTest.php
File metadata and controls
48 lines (38 loc) · 1.53 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
48
<?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\Installer\Config\Option\UrlShortener;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Shlinkio\Shlink\Installer\Config\Option\UrlShortener\AppendExtraPathConfigOption;
use Symfony\Component\Console\Style\StyleInterface;
class AppendExtraPathConfigOptionTest extends TestCase
{
private AppendExtraPathConfigOption $configOption;
public function setUp(): void
{
$this->configOption = new AppendExtraPathConfigOption();
}
#[Test]
public function returnsExpectedEnvVar(): void
{
self::assertEquals('REDIRECT_APPEND_EXTRA_PATH', $this->configOption->getEnvVar());
}
#[Test]
public function expectedQuestionIsAsked(): void
{
$io = $this->createMock(StyleInterface::class);
$io->expects($this->once())->method('confirm')->with(
// phpcs:disable
<<<FOO
Do you want Shlink to redirect short URLs as soon as the first segment of the path matches a short code, appending the rest to the long URL?
* {shortDomain}/{shortCode}/[...extraPath] -> {longUrl}/[...extraPath]
* https://example.com/abc123 -> https://www.twitter.com
* https://example.com/abc123/shlinkio -> https://www.twitter.com/shlinkio
FOO,
// phpcs:disable
false,
)->willReturn(true);
$answer = $this->configOption->ask($io, []);
self::assertTrue($answer);
}
}