-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from shlinkio/develop
Release 9.1.0
- Loading branch information
Showing
8 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shlinkio\Shlink\Installer\Config\Option\Server; | ||
|
||
use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption; | ||
use Shlinkio\Shlink\Installer\Config\Util\ConfigOptionsValidator; | ||
use Symfony\Component\Console\Style\StyleInterface; | ||
|
||
class MemoryLimitConfigOption extends BaseConfigOption | ||
{ | ||
public function getEnvVar(): string | ||
{ | ||
return 'MEMORY_LIMIT'; | ||
} | ||
|
||
public function ask(StyleInterface $io, array $currentOptions): string | ||
{ | ||
return $io->ask( | ||
'What is the maximum amount of RAM every process run by Shlink should be allowed to use? (Provide a ' | ||
. 'number for bytes, a number followed by K for kilobytes, M for Megabytes or G for Gigabytes)', | ||
'512M', | ||
ConfigOptionsValidator::validateMemoryValue(...), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ShlinkioTest\Shlink\Installer\Config\Option\Server; | ||
|
||
use PHPUnit\Framework\Attributes\Test; | ||
use PHPUnit\Framework\TestCase; | ||
use Shlinkio\Shlink\Installer\Config\Option\Server\MemoryLimitConfigOption; | ||
use Symfony\Component\Console\Style\StyleInterface; | ||
|
||
class MemoryLimitConfigOptionTest extends TestCase | ||
{ | ||
private MemoryLimitConfigOption $configOption; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->configOption = new MemoryLimitConfigOption(); | ||
} | ||
|
||
#[Test] | ||
public function returnsExpectedEnvVar(): void | ||
{ | ||
self::assertEquals('MEMORY_LIMIT', $this->configOption->getEnvVar()); | ||
} | ||
|
||
#[Test] | ||
public function expectedQuestionIsAsked(): void | ||
{ | ||
$io = $this->createMock(StyleInterface::class); | ||
$io->expects($this->once())->method('ask')->with( | ||
'What is the maximum amount of RAM every process run by Shlink should be allowed to use? (Provide a ' | ||
. 'number for bytes, a number followed by K for kilobytes, M for Megabytes or G for Gigabytes)', | ||
'512M', | ||
$this->anything(), | ||
)->willReturn('1G'); | ||
|
||
$answer = $this->configOption->ask($io, []); | ||
|
||
self::assertEquals('1G', $answer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters