mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-23 13:23:33 +03:00
Create CLI test checking default domain is ignored even if explicitly provided
This commit is contained in:
parent
cf49393ef2
commit
1b83344995
1 changed files with 31 additions and 0 deletions
31
module/CLI/test-cli/Command/CreateShortUrlTest.php
Normal file
31
module/CLI/test-cli/Command/CreateShortUrlTest.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioCliTest\Shlink\CLI\Command;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Shlinkio\Shlink\CLI\Command\ShortUrl\CreateShortUrlCommand;
|
||||
use Shlinkio\Shlink\CLI\Command\ShortUrl\ListShortUrlsCommand;
|
||||
use Shlinkio\Shlink\CLI\Util\ExitCodes;
|
||||
use Shlinkio\Shlink\TestUtils\CliTest\CliTestCase;
|
||||
|
||||
class CreateShortUrlTest extends CliTestCase
|
||||
{
|
||||
#[Test]
|
||||
public function defaultDomainIsIgnoredWhenExplicitlyProvided(): void
|
||||
{
|
||||
$slug = 'testing-default-domain';
|
||||
$defaultDomain = 's.test';
|
||||
|
||||
[$output, $exitCode] = $this->exec(
|
||||
[CreateShortUrlCommand::NAME, 'https://example.com', '--domain', $defaultDomain, '--custom-slug', $slug],
|
||||
);
|
||||
|
||||
self::assertEquals(ExitCodes::EXIT_SUCCESS, $exitCode);
|
||||
self::assertStringContainsString('Generated short URL: http://' . $defaultDomain . '/' . $slug, $output);
|
||||
|
||||
[$listOutput] = $this->exec([ListShortUrlsCommand::NAME, '--show-domain', '--search-term', $slug]);
|
||||
self::assertStringContainsString('DEFAULT', $listOutput);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue