Skip to content

Commit

Permalink
add sql int max value check p2
Browse files Browse the repository at this point in the history
  • Loading branch information
berkut1 committed Jun 11, 2024
1 parent 4b48108 commit b234cfe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public function edit(string $name, int $maxActiveNumber, int $maxReservedMemoryK
{
$this->name = $name;
$this->maxActiveNumber = $maxActiveNumber;
if($maxReservedMemoryKb > self::PSQL_INT_MAX){
throw new \DomainException("This value $maxReservedMemoryKb is too big than MAX ". self::PSQL_INT_MAX);
}
$this->maxReservedMemoryKb = $maxReservedMemoryKb;
$this->spaceQuotaGb = $spaceQuotaGb;
$this->recordEvent(new Event\SolidcpHostingSpaceEdited($this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ public function testSuccess(): void
self::assertSame($spaceQuotaGb, $hostingSpace->getSpaceQuotaGb());
}

public function testFault(): void
{
$hostingSpace = (new SolidcpHostingSpaceBuilder($this->solidcpServer, 123))
->build();

self::expectException(\DomainException::class);
$hostingSpace->edit(
'Test Hosting Space',
50,
37373737 * 1024,
360
);

}

public function testRecordEvent(): void
{
$hostingSpace = (new SolidcpHostingSpaceBuilder($this->solidcpServer, 123))
Expand Down

0 comments on commit b234cfe

Please sign in to comment.