Print a warning when manually running visit:download-db with no license

This commit is contained in:
Alejandro Celaya
2023-11-23 09:31:02 +01:00
parent cb0bac55d2
commit a3554eaf74
6 changed files with 61 additions and 18 deletions

View File

@@ -72,6 +72,21 @@ class DownloadGeoLiteDbCommandTest extends TestCase
];
}
#[Test]
public function warningIsPrintedWhenLicenseIsMissing(): void
{
$this->dbUpdater->expects($this->once())->method('checkDbUpdate')->withAnyParameters()->willReturn(
GeolocationResult::LICENSE_MISSING,
);
$this->commandTester->execute([]);
$output = $this->commandTester->getDisplay();
$exitCode = $this->commandTester->getStatusCode();
self::assertStringContainsString('[WARNING] It was not possible to download GeoLite2 db', $output);
self::assertSame(ExitCode::EXIT_WARNING, $exitCode);
}
#[Test, DataProvider('provideSuccessParams')]
public function printsExpectedMessageWhenNoErrorOccurs(callable $checkUpdateBehavior, string $expectedMessage): void
{