Finalize tests
This commit is contained in:
parent
609bf32843
commit
fbd5c25ed0
6 changed files with 11 additions and 5 deletions
|
@ -12,6 +12,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
* New CLI command to disabled 2-Factor Authentication on an account if necessary.
|
* New CLI command to disabled 2-Factor Authentication on an account if necessary.
|
||||||
* Ability to delete users and locations via the CLI.
|
* Ability to delete users and locations via the CLI.
|
||||||
* You can now require 2FA for all users, admins only, or at will using a simple configuration in the Admin CP.
|
* You can now require 2FA for all users, admins only, or at will using a simple configuration in the Admin CP.
|
||||||
|
* Added ability to export and import service options and their associated settings and environment variables via the Admin CP.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Theme colors and login pages updated to give a more unique feel to the project.
|
* Theme colors and login pages updated to give a more unique feel to the project.
|
||||||
|
|
|
@ -40,7 +40,7 @@ class InstallScriptUpdateService
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
* @throws \Pterodactyl\Exceptions\Service\ServiceOption\InvalidCopyFromException
|
* @throws \Pterodactyl\Exceptions\Service\ServiceOption\InvalidCopyFromException
|
||||||
*/
|
*/
|
||||||
public function handle($option, array $data): void
|
public function handle($option, array $data)
|
||||||
{
|
{
|
||||||
if (! $option instanceof ServiceOption) {
|
if (! $option instanceof ServiceOption) {
|
||||||
$option = $this->repository->find($option);
|
$option = $this->repository->find($option);
|
||||||
|
|
|
@ -40,7 +40,7 @@ class OptionUpdateService
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
* @throws \Pterodactyl\Exceptions\Service\ServiceOption\NoParentConfigurationFoundException
|
* @throws \Pterodactyl\Exceptions\Service\ServiceOption\NoParentConfigurationFoundException
|
||||||
*/
|
*/
|
||||||
public function handle($option, array $data): void
|
public function handle($option, array $data)
|
||||||
{
|
{
|
||||||
if (! $option instanceof ServiceOption) {
|
if (! $option instanceof ServiceOption) {
|
||||||
$option = $this->repository->find($option);
|
$option = $this->repository->find($option);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ServiceUpdateService
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
public function handle(int $service, array $data): void
|
public function handle(int $service, array $data)
|
||||||
{
|
{
|
||||||
if (! is_null(array_get($data, 'author'))) {
|
if (! is_null(array_get($data, 'author'))) {
|
||||||
unset($data['author']);
|
unset($data['author']);
|
||||||
|
|
|
@ -60,14 +60,16 @@ class OptionCreationServiceTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function testCreateNewModelWithoutUsingConfigFrom()
|
public function testCreateNewModelWithoutUsingConfigFrom()
|
||||||
{
|
{
|
||||||
$model = factory(ServiceOption::class)->make();
|
$model = factory(ServiceOption::class)->make([
|
||||||
|
'tag' => str_random(10),
|
||||||
|
]);
|
||||||
|
|
||||||
$this->config->shouldReceive('get')->with('pterodactyl.service.author')->once()->andReturn('test@example.com');
|
$this->config->shouldReceive('get')->with('pterodactyl.service.author')->once()->andReturn('test@example.com');
|
||||||
$this->uuid->shouldReceive('uuid4->toString')->withNoArgs()->once()->andReturn('uuid-string');
|
$this->uuid->shouldReceive('uuid4->toString')->withNoArgs()->once()->andReturn('uuid-string');
|
||||||
$this->repository->shouldReceive('create')->with([
|
$this->repository->shouldReceive('create')->with([
|
||||||
'name' => $model->name,
|
'name' => $model->name,
|
||||||
'config_from' => null,
|
|
||||||
'tag' => 'test@example.com:' . $model->tag,
|
'tag' => 'test@example.com:' . $model->tag,
|
||||||
|
'config_from' => null,
|
||||||
'uuid' => 'uuid-string',
|
'uuid' => 'uuid-string',
|
||||||
], true, true)->once()->andReturn($model);
|
], true, true)->once()->andReturn($model);
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ class ServiceOptionExporterServiceTest extends TestCase
|
||||||
$this->service = new ServiceOptionExporterService($this->carbon, $this->repository);
|
$this->service = new ServiceOptionExporterService($this->carbon, $this->repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that a JSON structure is returned.
|
||||||
|
*/
|
||||||
public function testJsonStructureIsExported()
|
public function testJsonStructureIsExported()
|
||||||
{
|
{
|
||||||
$option = factory(ServiceOption::class)->make();
|
$option = factory(ServiceOption::class)->make();
|
||||||
|
|
Loading…
Reference in a new issue