diff --git a/src/Model/ControlPanel/Entity/Panel/SolidCP/HostingSpace/SolidcpHostingSpace.php b/src/Model/ControlPanel/Entity/Panel/SolidCP/HostingSpace/SolidcpHostingSpace.php index 846682a..0f6aa3f 100644 --- a/src/Model/ControlPanel/Entity/Panel/SolidCP/HostingSpace/SolidcpHostingSpace.php +++ b/src/Model/ControlPanel/Entity/Panel/SolidCP/HostingSpace/SolidcpHostingSpace.php @@ -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)); diff --git a/tests/Unit/Model/ControlPanel/Entity/Panel/SolidCP/Node/HostingSpace/EditTest.php b/tests/Unit/Model/ControlPanel/Entity/Panel/SolidCP/Node/HostingSpace/EditTest.php index b05f6c0..dccff33 100644 --- a/tests/Unit/Model/ControlPanel/Entity/Panel/SolidCP/Node/HostingSpace/EditTest.php +++ b/tests/Unit/Model/ControlPanel/Entity/Panel/SolidCP/Node/HostingSpace/EditTest.php @@ -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))