From 1b8334499598d20383abb0f523b6ea081ad7bdaa Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 23 Apr 2023 11:20:54 +0200 Subject: [PATCH] Create CLI test checking default domain is ignored even if explicitly provided --- .../test-cli/Command/CreateShortUrlTest.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 module/CLI/test-cli/Command/CreateShortUrlTest.php diff --git a/module/CLI/test-cli/Command/CreateShortUrlTest.php b/module/CLI/test-cli/Command/CreateShortUrlTest.php new file mode 100644 index 00000000..d4d8a583 --- /dev/null +++ b/module/CLI/test-cli/Command/CreateShortUrlTest.php @@ -0,0 +1,31 @@ +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); + } +}