Fix node update tests
This commit is contained in:
parent
a5d9faf6b2
commit
83a59cdf4f
10 changed files with 227 additions and 363 deletions
|
@ -9,6 +9,8 @@ use Pterodactyl\Models\EggVariable;
|
|||
use Illuminate\Contracts\Validation\Factory;
|
||||
use Pterodactyl\Services\Eggs\Variables\VariableCreationService;
|
||||
use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface;
|
||||
use Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException;
|
||||
use Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException;
|
||||
|
||||
class VariableCreationServiceTest extends TestCase
|
||||
{
|
||||
|
@ -91,10 +93,11 @@ class VariableCreationServiceTest extends TestCase
|
|||
* @param string $variable
|
||||
*
|
||||
* @dataProvider reservedNamesProvider
|
||||
* @expectedException \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException
|
||||
*/
|
||||
public function testExceptionIsThrownIfEnvironmentVariableIsInListOfReservedNames(string $variable)
|
||||
{
|
||||
$this->expectException(ReservedVariableNameException::class);
|
||||
|
||||
$this->getService()->handle(1, ['env_variable' => $variable]);
|
||||
}
|
||||
|
||||
|
@ -114,12 +117,12 @@ class VariableCreationServiceTest extends TestCase
|
|||
|
||||
/**
|
||||
* Test that validation errors due to invalid rules are caught and handled properly.
|
||||
*
|
||||
* @expectedException \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException
|
||||
* @expectedExceptionMessage The validation rule "hodor_door" is not a valid rule for this application.
|
||||
*/
|
||||
public function testInvalidValidationRulesResultInException()
|
||||
{
|
||||
$this->expectException(BadValidationRuleException::class);
|
||||
$this->expectExceptionMessage('The validation rule "hodor_door" is not a valid rule for this application.');
|
||||
|
||||
$data = ['env_variable' => 'TEST_VAR_123', 'rules' => 'string|hodorDoor'];
|
||||
|
||||
$this->validator->shouldReceive('make')->once()
|
||||
|
@ -135,12 +138,12 @@ class VariableCreationServiceTest extends TestCase
|
|||
|
||||
/**
|
||||
* Test that an exception not stemming from a bad rule is not caught.
|
||||
*
|
||||
* @expectedException \BadMethodCallException
|
||||
* @expectedExceptionMessage Received something, but no expectations were specified.
|
||||
*/
|
||||
public function testExceptionNotCausedByBadRuleIsNotCaught()
|
||||
{
|
||||
$this->expectException(BadMethodCallException::class);
|
||||
$this->expectExceptionMessage('Received something, but no expectations were specified.');
|
||||
|
||||
$data = ['env_variable' => 'TEST_VAR_123', 'rules' => 'string'];
|
||||
|
||||
$this->validator->shouldReceive('make')->once()
|
||||
|
|
Reference in a new issue