close #841
This commit is contained in:
parent
1eaf1e3571
commit
10e2e6e379
|
@ -3,6 +3,11 @@ This file is a running track of new features and fixes to each version of the pa
|
|||
|
||||
This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||
|
||||
## v0.7.0-beta.4 (Derelict Dermodactylus)
|
||||
### Fixed
|
||||
* `[beta.3]` — Fixes a bug with the default environment file that was causing an inability to perform a fresh install when running package discovery.
|
||||
* `[beta.3]` — Fixes an edge case caused by the Laravel 5.5 upgrade that would try to perform an in_array check aganist a null value.
|
||||
|
||||
## v0.7.0-beta.3 (Derelict Dermodactylus)
|
||||
### Fixed
|
||||
* `[beta.2]` — Fixes a bug that would cause an endless exception message stream in the console when attemping to setup environment settings in certain instances.
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Services\Eggs\Variables;
|
||||
|
||||
|
@ -49,7 +42,7 @@ class VariableCreationService
|
|||
));
|
||||
}
|
||||
|
||||
$options = array_get($data, 'options', []);
|
||||
$options = array_get($data, 'options') ?? [];
|
||||
|
||||
return $this->repository->create(array_merge($data, [
|
||||
'egg_id' => $egg,
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Services\Eggs\Variables;
|
||||
|
||||
|
@ -69,7 +62,7 @@ class VariableUpdateService
|
|||
}
|
||||
}
|
||||
|
||||
$options = array_get($data, 'options', []);
|
||||
$options = array_get($data, 'options') ?? [];
|
||||
|
||||
return $this->repository->withoutFresh()->update($variable->id, array_merge($data, [
|
||||
'user_viewable' => in_array('user_viewable', $options),
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Tests\Unit\Services\Eggs\Variables;
|
||||
|
||||
use Mockery as m;
|
||||
use Tests\TestCase;
|
||||
use Pterodactyl\Models\Egg;
|
||||
use Pterodactyl\Models\EggVariable;
|
||||
use Pterodactyl\Services\Eggs\Variables\VariableCreationService;
|
||||
use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface;
|
||||
|
@ -73,6 +65,26 @@ class VariableCreationServiceTest extends TestCase
|
|||
$this->assertInstanceOf(EggVariable::class, $this->service->handle(1, $data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that an empty (null) value passed in the option key is handled
|
||||
* properly as an array.
|
||||
*
|
||||
* @see https://github.com/Pterodactyl/Panel/issues/841
|
||||
*/
|
||||
public function testNullOptionValueIsPassedAsArray()
|
||||
{
|
||||
$data = ['env_variable' => 'TEST_VAR_123', 'options' => null];
|
||||
$this->repository->shouldReceive('create')->with([
|
||||
'egg_id' => 1,
|
||||
'user_viewable' => false,
|
||||
'user_editable' => false,
|
||||
'env_variable' => 'TEST_VAR_123',
|
||||
'options' => null,
|
||||
])->once()->andReturn(new EggVariable);
|
||||
|
||||
$this->assertInstanceOf(EggVariable::class, $this->service->handle(1, $data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that all of the reserved variables defined in the model trigger an exception.
|
||||
*
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Tests\Unit\Services\Eggs\Variables;
|
||||
|
||||
|
@ -100,6 +93,24 @@ class VariableUpdateServiceTest extends TestCase
|
|||
$this->assertTrue($this->service->handle($this->model, ['env_variable' => 'TEST_VAR_123']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that an empty (null) value passed in the option key is handled
|
||||
* properly as an array.
|
||||
*
|
||||
* @see https://github.com/Pterodactyl/Panel/issues/841
|
||||
*/
|
||||
public function testNullOptionValueIsPassedAsArray()
|
||||
{
|
||||
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf()
|
||||
->shouldReceive('update')->with($this->model->id, [
|
||||
'user_viewable' => false,
|
||||
'user_editable' => false,
|
||||
'options' => null,
|
||||
])->once()->andReturn(true);
|
||||
|
||||
$this->assertTrue($this->service->handle($this->model, ['options' => null]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that data passed into the handler is overwritten inside the handler.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue