From 443a808dfbc3ba92ffbcd532f387802c8dc08db1 Mon Sep 17 00:00:00 2001 From: Ante de Baas Date: Mon, 18 Nov 2024 21:01:01 +0100 Subject: [PATCH] update tests --- tests/Command/UpdateDatabaseCommandTest.php | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/Command/UpdateDatabaseCommandTest.php b/tests/Command/UpdateDatabaseCommandTest.php index 2c84694..e860b30 100644 --- a/tests/Command/UpdateDatabaseCommandTest.php +++ b/tests/Command/UpdateDatabaseCommandTest.php @@ -190,6 +190,28 @@ public function testInvalidDatabasePath(): void $command->run($this->input, $this->output); } + public function testDownloadWithoutLicense(): void + { + $this->input + ->expects($this->at(4)) + ->method('getArgument') + ->with('databases') + ->willReturn(['default']); + + $databases = ['default' => [ + 'url' => 'https://example.com/GeoIP2.tar.gz', + 'path' => '/tmp/GeoIP2.mmdb', + ]]; + + $this->downloader + ->expects($this->never()) + ->method('download') + ->with($databases['default']['url'], $databases['default']['path']); + + $command = new UpdateDatabaseCommand($this->downloader, $databases); + $command->run($this->input, $this->output); + } + public function testDownloadOneDatabases(): void { $this->input @@ -201,6 +223,7 @@ public function testDownloadOneDatabases(): void $databases = ['default' => [ 'url' => 'https://example.com/GeoIP2.tar.gz', 'path' => '/tmp/GeoIP2.mmdb', + 'license' => 'license', ]]; $this->downloader @@ -224,10 +247,12 @@ public function testDownloadSeveralDatabases(): void 'first' => [ 'url' => 'https://example.com/GeoIP2-First.tar.gz', 'path' => '/tmp/GeoIP2-First.mmdb', + 'license' => 'license', ], 'second' => [ 'url' => 'https://example.com/GeoIP2-Second.tar.gz', 'path' => '/tmp/GeoIP2-Second.mmdb', + 'license' => 'license', ], ];