1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-10-27 20:32:28 +01:00

Update calls to missing function

This commit is contained in:
Dane Everitt 2018-01-05 16:33:50 -06:00
parent 60eb60013c
commit 5f9fe4a69b
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
45 changed files with 78 additions and 78 deletions

View File

@ -56,7 +56,7 @@ class DisableTwoFactorCommand extends Command
$email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_email')); $email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_email'));
$user = $this->repository->setColumns(['id', 'email'])->findFirstWhere([['email', '=', $email]]); $user = $this->repository->setColumns(['id', 'email'])->findFirstWhere([['email', '=', $email]]);
$this->repository->withoutFresh()->update($user->id, [ $this->repository->withoutFreshModel()->update($user->id, [
'use_totp' => false, 'use_totp' => false,
'totp_secret' => null, 'totp_secret' => null,
]); ]);

View File

@ -161,7 +161,7 @@ class RunTaskJob extends Job implements ShouldQueue
private function markScheduleComplete() private function markScheduleComplete()
{ {
$repository = app()->make(ScheduleRepositoryInterface::class); $repository = app()->make(ScheduleRepositoryInterface::class);
$repository->withoutFresh()->update($this->schedule, [ $repository->withoutFreshModel()->update($this->schedule, [
'is_processing' => false, 'is_processing' => false,
'last_run_at' => Carbon::now()->toDateTimeString(), 'last_run_at' => Carbon::now()->toDateTimeString(),
]); ]);

View File

@ -236,7 +236,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
$instance->whereNotIn('id', $this->getUserAccessServers($user->id)); $instance->whereNotIn('id', $this->getUserAccessServers($user->id));
} }
return $instance->setSearchTerm($this->getSearchTerm())->paginate(25); return $instance->search($this->getSearchTerm())->paginate(25);
} }
/** /**

View File

@ -83,7 +83,7 @@ class SetDefaultAllocationService
} }
$this->connection->beginTransaction(); $this->connection->beginTransaction();
$this->serverRepository->withoutFresh()->update($server->id, ['allocation_id' => $model->id]); $this->serverRepository->withoutFreshModel()->update($server->id, ['allocation_id' => $model->id]);
// Update on the daemon. // Update on the daemon.
try { try {

View File

@ -40,7 +40,7 @@ class PermissionService
public function create($key, $permission) public function create($key, $permission)
{ {
// @todo handle an array of permissions to do a mass assignment? // @todo handle an array of permissions to do a mass assignment?
return $this->repository->withoutFresh()->create([ return $this->repository->withoutFreshModel()->create([
'key_id' => $key, 'key_id' => $key,
'permission' => $permission, 'permission' => $permission,
]); ]);

View File

@ -75,7 +75,7 @@ class DaemonKeyCreationService
{ {
$secret = DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40); $secret = DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40);
$this->repository->withoutFresh()->create([ $this->repository->withoutFreshModel()->create([
'user_id' => $user, 'user_id' => $user,
'server_id' => $server, 'server_id' => $server,
'secret' => $secret, 'secret' => $secret,

View File

@ -78,7 +78,7 @@ class DaemonKeyUpdateService
Assert::integerish($key, 'First argument passed to handle must be an integer, received %s.'); Assert::integerish($key, 'First argument passed to handle must be an integer, received %s.');
$secret = DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40); $secret = DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40);
$this->repository->withoutFresh()->update($key, [ $this->repository->withoutFreshModel()->update($key, [
'secret' => $secret, 'secret' => $secret,
'expires_at' => $this->carbon->now()->addMinutes($this->config->get('pterodactyl.api.key_expire_time'))->toDateTimeString(), 'expires_at' => $this->carbon->now()->addMinutes($this->config->get('pterodactyl.api.key_expire_time'))->toDateTimeString(),
]); ]);

View File

@ -69,7 +69,7 @@ class DatabasePasswordService
$this->dynamic->set('dynamic', $database->database_host_id); $this->dynamic->set('dynamic', $database->database_host_id);
$this->connection->beginTransaction(); $this->connection->beginTransaction();
$updated = $this->repository->withoutFresh()->update($database->id, [ $updated = $this->repository->withoutFreshModel()->update($database->id, [
'password' => $this->encrypter->encrypt($password), 'password' => $this->encrypter->encrypt($password),
]); ]);

View File

@ -57,6 +57,6 @@ class EggUpdateService
} }
} }
$this->repository->withoutFresh()->update($egg->id, $data); $this->repository->withoutFreshModel()->update($egg->id, $data);
} }
} }

View File

@ -52,7 +52,7 @@ class InstallScriptService
} }
} }
$this->repository->withoutFresh()->update($egg->id, [ $this->repository->withoutFreshModel()->update($egg->id, [
'script_install' => array_get($data, 'script_install'), 'script_install' => array_get($data, 'script_install'),
'script_is_privileged' => array_get($data, 'script_is_privileged', 1), 'script_is_privileged' => array_get($data, 'script_is_privileged', 1),
'script_entry' => array_get($data, 'script_entry'), 'script_entry' => array_get($data, 'script_entry'),

View File

@ -89,7 +89,7 @@ class EggUpdateImporterService
// Update Existing Variables // Update Existing Variables
collect($parsed->variables)->each(function ($variable) use ($egg) { collect($parsed->variables)->each(function ($variable) use ($egg) {
$this->variableRepository->withoutFresh()->updateOrCreate([ $this->variableRepository->withoutFreshModel()->updateOrCreate([
'egg_id' => $egg, 'egg_id' => $egg,
'env_variable' => $variable->env_variable, 'env_variable' => $variable->env_variable,
], collect($variable)->except(['egg_id', 'env_variable'])->toArray()); ], collect($variable)->except(['egg_id', 'env_variable'])->toArray());

View File

@ -64,7 +64,7 @@ class VariableUpdateService
$options = array_get($data, 'options') ?? []; $options = array_get($data, 'options') ?? [];
return $this->repository->withoutFresh()->update($variable->id, array_merge($data, [ return $this->repository->withoutFreshModel()->update($variable->id, array_merge($data, [
'user_viewable' => in_array('user_viewable', $options), 'user_viewable' => in_array('user_viewable', $options),
'user_editable' => in_array('user_editable', $options), 'user_editable' => in_array('user_editable', $options),
])); ]));

View File

@ -42,6 +42,6 @@ class NestUpdateService
unset($data['author']); unset($data['author']);
} }
$this->repository->withoutFresh()->update($nest, $data); $this->repository->withoutFreshModel()->update($nest, $data);
} }
} }

View File

@ -72,7 +72,7 @@ class NodeUpdateService
unset($data['reset_secret']); unset($data['reset_secret']);
} }
$updateResponse = $this->repository->withoutFresh()->update($node->id, $data); $updateResponse = $this->repository->withoutFreshModel()->update($node->id, $data);
try { try {
$this->configRepository->setNode($node->id)->update(); $this->configRepository->setNode($node->id)->update();

View File

@ -70,6 +70,6 @@ class PackUpdateService
$data['visible'] = isset($data['visible']); $data['visible'] = isset($data['visible']);
$data['locked'] = isset($data['locked']); $data['locked'] = isset($data['locked']);
return $this->repository->withoutFresh()->update($pack->id, $data); return $this->repository->withoutFreshModel()->update($pack->id, $data);
} }
} }

View File

@ -56,7 +56,7 @@ class TaskCreationService
throw new TaskIntervalTooLongException(trans('exceptions.tasks.chain_interval_too_long')); throw new TaskIntervalTooLongException(trans('exceptions.tasks.chain_interval_too_long'));
} }
$repository = ($returnModel) ? $this->repository : $this->repository->withoutFresh(); $repository = ($returnModel) ? $this->repository : $this->repository->withoutFreshModel();
$task = $repository->create([ $task = $repository->create([
'schedule_id' => $schedule, 'schedule_id' => $schedule,
'sequence_id' => $data['sequence_id'], 'sequence_id' => $data['sequence_id'],

View File

@ -94,7 +94,7 @@ class DetailsModificationService
} }
$this->connection->beginTransaction(); $this->connection->beginTransaction();
$this->repository->withoutFresh()->update($server->id, [ $this->repository->withoutFreshModel()->update($server->id, [
'owner_id' => array_get($data, 'owner_id'), 'owner_id' => array_get($data, 'owner_id'),
'name' => array_get($data, 'name'), 'name' => array_get($data, 'name'),
'description' => array_get($data, 'description', ''), 'description' => array_get($data, 'description', ''),
@ -125,7 +125,7 @@ class DetailsModificationService
} }
$this->connection->beginTransaction(); $this->connection->beginTransaction();
$this->repository->withoutFresh()->update($server->id, ['image' => $image]); $this->repository->withoutFreshModel()->update($server->id, ['image' => $image]);
try { try {
$this->daemonServerRepository->setNode($server->node_id)->setAccessServer($server->uuid)->update([ $this->daemonServerRepository->setNode($server->node_id)->setAccessServer($server->uuid)->update([

View File

@ -72,7 +72,7 @@ class ReinstallServerService
} }
$this->database->beginTransaction(); $this->database->beginTransaction();
$this->repository->withoutFresh()->update($server->id, [ $this->repository->withoutFreshModel()->update($server->id, [
'installed' => 0, 'installed' => 0,
]); ]);

View File

@ -91,7 +91,7 @@ class StartupModificationService
$results = $this->validatorService->handle(array_get($data, 'egg_id', $server->egg_id), array_get($data, 'environment', [])); $results = $this->validatorService->handle(array_get($data, 'egg_id', $server->egg_id), array_get($data, 'environment', []));
$results->each(function ($result) use ($server) { $results->each(function ($result) use ($server) {
$this->serverVariableRepository->withoutFresh()->updateOrCreate([ $this->serverVariableRepository->withoutFreshModel()->updateOrCreate([
'server_id' => $server->id, 'server_id' => $server->id,
'variable_id' => $result->id, 'variable_id' => $result->id,
], [ ], [

View File

@ -91,7 +91,7 @@ class SuspensionService
} }
$this->database->beginTransaction(); $this->database->beginTransaction();
$this->repository->withoutFresh()->update($server->id, [ $this->repository->withoutFreshModel()->update($server->id, [
'suspended' => $action === 'suspend', 'suspended' => $action === 'suspend',
]); ]);

View File

@ -56,6 +56,6 @@ class PermissionCreationService
} }
} }
$this->repository->withoutFresh()->insert($insertPermissions); $this->repository->withoutFreshModel()->insert($insertPermissions);
} }
} }

View File

@ -75,7 +75,7 @@ class ToggleTwoFactorService
throw new TwoFactorAuthenticationTokenInvalid; throw new TwoFactorAuthenticationTokenInvalid;
} }
$this->repository->withoutFresh()->update($user->id, [ $this->repository->withoutFreshModel()->update($user->id, [
'totp_authenticated_at' => Carbon::now(), 'totp_authenticated_at' => Carbon::now(),
'use_totp' => (is_null($toggleState) ? ! $user->use_totp : $toggleState), 'use_totp' => (is_null($toggleState) ? ! $user->use_totp : $toggleState),
]); ]);

View File

@ -72,7 +72,7 @@ class TwoFactorSetupService
$secret = $this->google2FA->generateSecretKey($this->config->get('pterodactyl.auth.2fa.bytes')); $secret = $this->google2FA->generateSecretKey($this->config->get('pterodactyl.auth.2fa.bytes'));
$image = $this->google2FA->getQRCodeGoogleUrl($this->config->get('app.name'), $user->email, $secret); $image = $this->google2FA->getQRCodeGoogleUrl($this->config->get('app.name'), $user->email, $secret);
$this->repository->withoutFresh()->update($user->id, [ $this->repository->withoutFreshModel()->update($user->id, [
'totp_secret' => $this->encrypter->encrypt($secret), 'totp_secret' => $this->encrypter->encrypt($secret),
]); ]);

View File

@ -49,7 +49,7 @@ class DisableTwoFactorCommandTest extends CommandTestCase
$this->repository->shouldReceive('setColumns')->with(['id', 'email'])->once()->andReturnSelf() $this->repository->shouldReceive('setColumns')->with(['id', 'email'])->once()->andReturnSelf()
->shouldReceive('findFirstWhere')->with([['email', '=', $user->email]])->once()->andReturn($user); ->shouldReceive('findFirstWhere')->with([['email', '=', $user->email]])->once()->andReturn($user);
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($user->id, [ ->shouldReceive('update')->with($user->id, [
'use_totp' => false, 'use_totp' => false,
'totp_secret' => null, 'totp_secret' => null,
@ -70,7 +70,7 @@ class DisableTwoFactorCommandTest extends CommandTestCase
$this->repository->shouldReceive('setColumns')->with(['id', 'email'])->once()->andReturnSelf() $this->repository->shouldReceive('setColumns')->with(['id', 'email'])->once()->andReturnSelf()
->shouldReceive('findFirstWhere')->with([['email', '=', $user->email]])->once()->andReturn($user); ->shouldReceive('findFirstWhere')->with([['email', '=', $user->email]])->once()->andReturn($user);
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($user->id, [ ->shouldReceive('update')->with($user->id, [
'use_totp' => false, 'use_totp' => false,
'totp_secret' => null, 'totp_secret' => null,

View File

@ -98,7 +98,7 @@ class RunTaskJobTest extends TestCase
$this->taskRepository->shouldReceive('update')->with($task->id, ['is_queued' => false])->once()->andReturnNull(); $this->taskRepository->shouldReceive('update')->with($task->id, ['is_queued' => false])->once()->andReturnNull();
$this->taskRepository->shouldReceive('getNextTask')->with($schedule->id, $task->sequence_id)->once()->andReturnNull(); $this->taskRepository->shouldReceive('getNextTask')->with($schedule->id, $task->sequence_id)->once()->andReturnNull();
$this->scheduleRepository->shouldReceive('withoutFresh->update')->with($schedule->id, [ $this->scheduleRepository->shouldReceive('withoutFreshModel->update')->with($schedule->id, [
'is_processing' => false, 'is_processing' => false,
'last_run_at' => Carbon::now()->toDateTimeString(), 'last_run_at' => Carbon::now()->toDateTimeString(),
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -128,7 +128,7 @@ class RunTaskJobTest extends TestCase
$this->taskRepository->shouldReceive('update')->with($task->id, ['is_queued' => false])->once()->andReturnNull(); $this->taskRepository->shouldReceive('update')->with($task->id, ['is_queued' => false])->once()->andReturnNull();
$this->taskRepository->shouldReceive('getNextTask')->with($schedule->id, $task->sequence_id)->once()->andReturnNull(); $this->taskRepository->shouldReceive('getNextTask')->with($schedule->id, $task->sequence_id)->once()->andReturnNull();
$this->scheduleRepository->shouldReceive('withoutFresh->update')->with($schedule->id, [ $this->scheduleRepository->shouldReceive('withoutFreshModel->update')->with($schedule->id, [
'is_processing' => false, 'is_processing' => false,
'last_run_at' => Carbon::now()->toDateTimeString(), 'last_run_at' => Carbon::now()->toDateTimeString(),
])->once()->andReturnNull(); ])->once()->andReturnNull();

View File

@ -68,7 +68,7 @@ class SetDefaultAllocationServiceTest extends TestCase
$this->repository->shouldReceive('findWhere')->with([['server_id', '=', $model->id]])->once()->andReturn($allocations); $this->repository->shouldReceive('findWhere')->with([['server_id', '=', $model->id]])->once()->andReturn($allocations);
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->serverRepository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf(); $this->serverRepository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf();
$this->serverRepository->shouldReceive('update')->with($model->id, [ $this->serverRepository->shouldReceive('update')->with($model->id, [
'allocation_id' => $allocations->first()->id, 'allocation_id' => $allocations->first()->id,
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -118,7 +118,7 @@ class SetDefaultAllocationServiceTest extends TestCase
$this->repository->shouldReceive('findWhere')->with([['server_id', '=', $model->id]])->once()->andReturn(collect([$allocation])); $this->repository->shouldReceive('findWhere')->with([['server_id', '=', $model->id]])->once()->andReturn(collect([$allocation]));
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->serverRepository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf(); $this->serverRepository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf();
$this->serverRepository->shouldReceive('update')->with($model->id, [ $this->serverRepository->shouldReceive('update')->with($model->id, [
'allocation_id' => $allocation->id, 'allocation_id' => $allocation->id,
])->once()->andReturnNull(); ])->once()->andReturnNull();

View File

@ -43,7 +43,7 @@ class PermissionServiceTest extends TestCase
*/ */
public function test_create_function() public function test_create_function()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('create')->with(['key_id' => 1, 'permission' => 'test-permission']) ->shouldReceive('create')->with(['key_id' => 1, 'permission' => 'test-permission'])
->once()->andReturn(true); ->once()->andReturn(true);

View File

@ -83,7 +83,7 @@ class DaemonKeyCreationServiceTest extends TestCase
->shouldReceive('addMinutes')->with(100)->once()->andReturnSelf() ->shouldReceive('addMinutes')->with(100)->once()->andReturnSelf()
->shouldReceive('toDateTimeString')->withNoArgs()->once()->andReturn('00:00:00'); ->shouldReceive('toDateTimeString')->withNoArgs()->once()->andReturn('00:00:00');
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('create')->with([ ->shouldReceive('create')->with([
'user_id' => 1, 'user_id' => 1,
'server_id' => 2, 'server_id' => 2,

View File

@ -70,7 +70,7 @@ class DaemonKeyUpdateServiceTest extends TestCase
->shouldReceive('addMinutes')->with(100)->once()->andReturnSelf() ->shouldReceive('addMinutes')->with(100)->once()->andReturnSelf()
->shouldReceive('toDateTimeString')->withNoArgs()->once()->andReturn('00:00:00'); ->shouldReceive('toDateTimeString')->withNoArgs()->once()->andReturn('00:00:00');
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf(); $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf();
$this->repository->shouldReceive('update')->with(123, [ $this->repository->shouldReceive('update')->with(123, [
'secret' => $secret, 'secret' => $secret,
'expires_at' => '00:00:00', 'expires_at' => '00:00:00',

View File

@ -63,7 +63,7 @@ class DatabasePasswordServiceTest extends TestCase
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->encrypter->shouldReceive('encrypt')->with('test123')->once()->andReturn('enc123'); $this->encrypter->shouldReceive('encrypt')->with('test123')->once()->andReturn('enc123');
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf(); $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf();
$this->repository->shouldReceive('update')->with($model->id, ['password' => 'enc123'])->once()->andReturn(true); $this->repository->shouldReceive('update')->with($model->id, ['password' => 'enc123'])->once()->andReturn(true);
$this->repository->shouldReceive('dropUser')->with($model->username, $model->remote)->once()->andReturn(true); $this->repository->shouldReceive('dropUser')->with($model->username, $model->remote)->once()->andReturn(true);

View File

@ -52,7 +52,7 @@ class EggUpdateServiceTest extends TestCase
*/ */
public function testEggIsUpdatedWhenNoConfigFromIsProvided() public function testEggIsUpdatedWhenNoConfigFromIsProvided()
{ {
$this->repository->shouldReceive('withoutFresh->update') $this->repository->shouldReceive('withoutFreshModel->update')
->with($this->model->id, ['test_field' => 'field_value'])->once()->andReturnNull(); ->with($this->model->id, ['test_field' => 'field_value'])->once()->andReturnNull();
$this->service->handle($this->model, ['test_field' => 'field_value']); $this->service->handle($this->model, ['test_field' => 'field_value']);
@ -70,7 +70,7 @@ class EggUpdateServiceTest extends TestCase
['id', '=', 1], ['id', '=', 1],
])->once()->andReturn(1); ])->once()->andReturn(1);
$this->repository->shouldReceive('withoutFresh->update') $this->repository->shouldReceive('withoutFreshModel->update')
->with($this->model->id, ['config_from' => 1])->once()->andReturnNull(); ->with($this->model->id, ['config_from' => 1])->once()->andReturnNull();
$this->service->handle($this->model, ['config_from' => 1]); $this->service->handle($this->model, ['config_from' => 1]);
@ -102,7 +102,7 @@ class EggUpdateServiceTest extends TestCase
public function testIntegerCanBePassedInPlaceOfModel() public function testIntegerCanBePassedInPlaceOfModel()
{ {
$this->repository->shouldReceive('find')->with($this->model->id)->once()->andReturn($this->model); $this->repository->shouldReceive('find')->with($this->model->id)->once()->andReturn($this->model);
$this->repository->shouldReceive('withoutFresh->update') $this->repository->shouldReceive('withoutFreshModel->update')
->with($this->model->id, ['test_field' => 'field_value'])->once()->andReturnNull(); ->with($this->model->id, ['test_field' => 'field_value'])->once()->andReturnNull();
$this->service->handle($this->model->id, ['test_field' => 'field_value']); $this->service->handle($this->model->id, ['test_field' => 'field_value']);

View File

@ -66,7 +66,7 @@ class InstallScriptServiceTest extends TestCase
$this->data['copy_script_from'] = 1; $this->data['copy_script_from'] = 1;
$this->repository->shouldReceive('isCopiableScript')->with(1, $this->model->nest_id)->once()->andReturn(true); $this->repository->shouldReceive('isCopiableScript')->with(1, $this->model->nest_id)->once()->andReturn(true);
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->model->id, $this->data)->andReturnNull(); ->shouldReceive('update')->with($this->model->id, $this->data)->andReturnNull();
$this->service->handle($this->model, $this->data); $this->service->handle($this->model, $this->data);
@ -93,7 +93,7 @@ class InstallScriptServiceTest extends TestCase
*/ */
public function testUpdateWithoutNewCopyScriptFromAttribute() public function testUpdateWithoutNewCopyScriptFromAttribute()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->model->id, $this->data)->andReturnNull(); ->shouldReceive('update')->with($this->model->id, $this->data)->andReturnNull();
$this->service->handle($this->model, $this->data); $this->service->handle($this->model, $this->data);
@ -105,7 +105,7 @@ class InstallScriptServiceTest extends TestCase
public function testFunctionAcceptsIntegerInPlaceOfModel() public function testFunctionAcceptsIntegerInPlaceOfModel()
{ {
$this->repository->shouldReceive('find')->with($this->model->id)->once()->andReturn($this->model); $this->repository->shouldReceive('find')->with($this->model->id)->once()->andReturn($this->model);
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->model->id, $this->data)->andReturnNull(); ->shouldReceive('update')->with($this->model->id, $this->data)->andReturnNull();
$this->service->handle($this->model->id, $this->data); $this->service->handle($this->model->id, $this->data);

View File

@ -81,7 +81,7 @@ class EggUpdateImporterServiceTest extends TestCase
'name' => $egg->name, 'name' => $egg->name,
]), true, true)->once()->andReturn($egg); ]), true, true)->once()->andReturn($egg);
$this->variableRepository->shouldReceive('withoutFresh->updateOrCreate')->with([ $this->variableRepository->shouldReceive('withoutFreshModel->updateOrCreate')->with([
'egg_id' => $egg->id, 'egg_id' => $egg->id,
'env_variable' => $variable->env_variable, 'env_variable' => $variable->env_variable,
], collect($variable)->except(['egg_id', 'env_variable'])->toArray())->once()->andReturnNull(); ], collect($variable)->except(['egg_id', 'env_variable'])->toArray())->once()->andReturnNull();
@ -121,7 +121,7 @@ class EggUpdateImporterServiceTest extends TestCase
'name' => $egg->name, 'name' => $egg->name,
]), true, true)->once()->andReturn($egg); ]), true, true)->once()->andReturn($egg);
$this->variableRepository->shouldReceive('withoutFresh->updateOrCreate')->with([ $this->variableRepository->shouldReceive('withoutFreshModel->updateOrCreate')->with([
'egg_id' => $egg->id, 'egg_id' => $egg->id,
'env_variable' => $variable1->env_variable, 'env_variable' => $variable1->env_variable,
], collect($variable1)->except(['egg_id', 'env_variable'])->toArray())->once()->andReturnNull(); ], collect($variable1)->except(['egg_id', 'env_variable'])->toArray())->once()->andReturnNull();

View File

@ -45,7 +45,7 @@ class VariableUpdateServiceTest extends TestCase
*/ */
public function testVariableIsUpdatedWhenNoEnvironmentVariableIsPassed() public function testVariableIsUpdatedWhenNoEnvironmentVariableIsPassed()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->model->id, [ ->shouldReceive('update')->with($this->model->id, [
'user_viewable' => false, 'user_viewable' => false,
'user_editable' => false, 'user_editable' => false,
@ -61,7 +61,7 @@ class VariableUpdateServiceTest extends TestCase
public function testVariableIdCanBePassedInPlaceOfModel() public function testVariableIdCanBePassedInPlaceOfModel()
{ {
$this->repository->shouldReceive('find')->with($this->model->id)->once()->andReturn($this->model); $this->repository->shouldReceive('find')->with($this->model->id)->once()->andReturn($this->model);
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->model->id, [ ->shouldReceive('update')->with($this->model->id, [
'user_viewable' => false, 'user_viewable' => false,
'user_editable' => false, 'user_editable' => false,
@ -83,7 +83,7 @@ class VariableUpdateServiceTest extends TestCase
['id', '!=', $this->model->id], ['id', '!=', $this->model->id],
])->once()->andReturn(0); ])->once()->andReturn(0);
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->model->id, [ ->shouldReceive('update')->with($this->model->id, [
'user_viewable' => false, 'user_viewable' => false,
'user_editable' => false, 'user_editable' => false,
@ -101,7 +101,7 @@ class VariableUpdateServiceTest extends TestCase
*/ */
public function testNullOptionValueIsPassedAsArray() public function testNullOptionValueIsPassedAsArray()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->model->id, [ ->shouldReceive('update')->with($this->model->id, [
'user_viewable' => false, 'user_viewable' => false,
'user_editable' => false, 'user_editable' => false,
@ -123,7 +123,7 @@ class VariableUpdateServiceTest extends TestCase
['id', '!=', $this->model->id], ['id', '!=', $this->model->id],
])->once()->andReturn(0); ])->once()->andReturn(0);
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->model->id, [ ->shouldReceive('update')->with($this->model->id, [
'user_viewable' => false, 'user_viewable' => false,
'user_editable' => false, 'user_editable' => false,

View File

@ -43,7 +43,7 @@ class NestUpdateServiceTest extends TestCase
*/ */
public function testAuthorArrayKeyIsRemovedIfPassed() public function testAuthorArrayKeyIsRemovedIfPassed()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with(1, ['otherfield' => 'value'])->once()->andReturnNull(); ->shouldReceive('update')->with(1, ['otherfield' => 'value'])->once()->andReturnNull();
$this->service->handle(1, ['author' => 'author1', 'otherfield' => 'value']); $this->service->handle(1, ['author' => 'author1', 'otherfield' => 'value']);
@ -54,7 +54,7 @@ class NestUpdateServiceTest extends TestCase
*/ */
public function testServiceIsUpdatedWhenNoAuthorKeyIsPassed() public function testServiceIsUpdatedWhenNoAuthorKeyIsPassed()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with(1, ['otherfield' => 'value'])->once()->andReturnNull(); ->shouldReceive('update')->with(1, ['otherfield' => 'value'])->once()->andReturnNull();
$this->service->handle(1, ['otherfield' => 'value']); $this->service->handle(1, ['otherfield' => 'value']);

View File

@ -84,7 +84,7 @@ class NodeUpdateServiceTest extends TestCase
$this->getFunctionMock('\\Pterodactyl\\Services\\Nodes', 'str_random') $this->getFunctionMock('\\Pterodactyl\\Services\\Nodes', 'str_random')
->expects($this->once())->willReturn('random_string'); ->expects($this->once())->willReturn('random_string');
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->node->id, [ ->shouldReceive('update')->with($this->node->id, [
'name' => 'NewName', 'name' => 'NewName',
'daemonSecret' => 'random_string', 'daemonSecret' => 'random_string',
@ -101,7 +101,7 @@ class NodeUpdateServiceTest extends TestCase
*/ */
public function testNodeIsUpdatedAndDaemonSecretIsNotChanged() public function testNodeIsUpdatedAndDaemonSecretIsNotChanged()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->node->id, [ ->shouldReceive('update')->with($this->node->id, [
'name' => 'NewName', 'name' => 'NewName',
])->andReturn(true); ])->andReturn(true);
@ -117,7 +117,7 @@ class NodeUpdateServiceTest extends TestCase
*/ */
public function testExceptionCausedByDaemonIsHandled() public function testExceptionCausedByDaemonIsHandled()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->node->id, [ ->shouldReceive('update')->with($this->node->id, [
'name' => 'NewName', 'name' => 'NewName',
])->andReturn(true); ])->andReturn(true);
@ -144,7 +144,7 @@ class NodeUpdateServiceTest extends TestCase
public function testFunctionCanAcceptANodeIdInPlaceOfModel() public function testFunctionCanAcceptANodeIdInPlaceOfModel()
{ {
$this->repository->shouldReceive('find')->with($this->node->id)->once()->andReturn($this->node); $this->repository->shouldReceive('find')->with($this->node->id)->once()->andReturn($this->node);
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->node->id, [ ->shouldReceive('update')->with($this->node->id, [
'name' => 'NewName', 'name' => 'NewName',
])->andReturn(true); ])->andReturn(true);

View File

@ -53,7 +53,7 @@ class PackUpdateServiceTest extends TestCase
public function testPackIsUpdated() public function testPackIsUpdated()
{ {
$model = factory(Pack::class)->make(); $model = factory(Pack::class)->make();
$this->repository->shouldReceive('withoutFresh->update')->with($model->id, [ $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [
'locked' => false, 'locked' => false,
'visible' => false, 'visible' => false,
'selectable' => false, 'selectable' => false,
@ -87,7 +87,7 @@ class PackUpdateServiceTest extends TestCase
$this->repository->shouldReceive('setColumns')->with(['id', 'egg_id'])->once()->andReturnSelf() $this->repository->shouldReceive('setColumns')->with(['id', 'egg_id'])->once()->andReturnSelf()
->shouldReceive('find')->with($model->id)->once()->andReturn($model); ->shouldReceive('find')->with($model->id)->once()->andReturn($model);
$this->repository->shouldReceive('withoutFresh->update')->with($model->id, [ $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [
'locked' => false, 'locked' => false,
'visible' => false, 'visible' => false,
'selectable' => false, 'selectable' => false,

View File

@ -81,7 +81,7 @@ class TaskCreationServiceTest extends TestCase
{ {
$schedule = factory(Schedule::class)->make(); $schedule = factory(Schedule::class)->make();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('create')->with([ ->shouldReceive('create')->with([
'schedule_id' => $schedule->id, 'schedule_id' => $schedule->id,
'sequence_id' => 1, 'sequence_id' => 1,
@ -108,7 +108,7 @@ class TaskCreationServiceTest extends TestCase
*/ */
public function testIdCanBePassedInPlaceOfScheduleModel() public function testIdCanBePassedInPlaceOfScheduleModel()
{ {
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('create')->with([ ->shouldReceive('create')->with([
'schedule_id' => 1234, 'schedule_id' => 1234,
'sequence_id' => 1, 'sequence_id' => 1,

View File

@ -103,7 +103,7 @@ class DetailsModificationServiceTest extends TestCase
$data = ['owner_id' => 1, 'name' => 'New Name', 'description' => 'New Description']; $data = ['owner_id' => 1, 'name' => 'New Name', 'description' => 'New Description'];
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($server->id, [ ->shouldReceive('update')->with($server->id, [
'owner_id' => $data['owner_id'], 'owner_id' => $data['owner_id'],
'name' => $data['name'], 'name' => $data['name'],
@ -129,7 +129,7 @@ class DetailsModificationServiceTest extends TestCase
$this->repository->shouldReceive('find')->with($server->id)->once()->andReturn($server); $this->repository->shouldReceive('find')->with($server->id)->once()->andReturn($server);
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($server->id, [ ->shouldReceive('update')->with($server->id, [
'owner_id' => $data['owner_id'], 'owner_id' => $data['owner_id'],
'name' => $data['name'], 'name' => $data['name'],
@ -155,7 +155,7 @@ class DetailsModificationServiceTest extends TestCase
$data = ['owner_id' => 2, 'name' => 'New Name', 'description' => 'New Description']; $data = ['owner_id' => 2, 'name' => 'New Name', 'description' => 'New Description'];
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($server->id, [ ->shouldReceive('update')->with($server->id, [
'owner_id' => $data['owner_id'], 'owner_id' => $data['owner_id'],
'name' => $data['name'], 'name' => $data['name'],
@ -178,7 +178,7 @@ class DetailsModificationServiceTest extends TestCase
$server = factory(Server::class)->make(['node_id' => 1]); $server = factory(Server::class)->make(['node_id' => 1]);
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($server->id, [ ->shouldReceive('update')->with($server->id, [
'image' => 'new/image', 'image' => 'new/image',
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -206,7 +206,7 @@ class DetailsModificationServiceTest extends TestCase
$this->repository->shouldReceive('find')->with($server->id)->once()->andReturn($server); $this->repository->shouldReceive('find')->with($server->id)->once()->andReturn($server);
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($server->id, [ ->shouldReceive('update')->with($server->id, [
'image' => 'new/image', 'image' => 'new/image',
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -233,7 +233,7 @@ class DetailsModificationServiceTest extends TestCase
$server = factory(Server::class)->make(['node_id' => 1]); $server = factory(Server::class)->make(['node_id' => 1]);
$this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($server->id, [ ->shouldReceive('update')->with($server->id, [
'image' => 'new/image', 'image' => 'new/image',
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -266,7 +266,7 @@ class DetailsModificationServiceTest extends TestCase
$server = factory(Server::class)->make(['node_id' => 1]); $server = factory(Server::class)->make(['node_id' => 1]);
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($server->id, [ ->shouldReceive('update')->with($server->id, [
'image' => 'new/image', 'image' => 'new/image',
])->once()->andReturnNull(); ])->once()->andReturnNull();

View File

@ -89,7 +89,7 @@ class ReinstallServerServiceTest extends TestCase
$this->repository->shouldNotReceive('find'); $this->repository->shouldNotReceive('find');
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, [ ->shouldReceive('update')->with($this->server->id, [
'installed' => 0, 'installed' => 0,
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -110,7 +110,7 @@ class ReinstallServerServiceTest extends TestCase
$this->repository->shouldReceive('find')->with($this->server->id)->once()->andReturn($this->server); $this->repository->shouldReceive('find')->with($this->server->id)->once()->andReturn($this->server);
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, [ ->shouldReceive('update')->with($this->server->id, [
'installed' => 0, 'installed' => 0,
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -129,7 +129,7 @@ class ReinstallServerServiceTest extends TestCase
public function testExceptionThrownByGuzzleShouldBeReRenderedAsDisplayable() public function testExceptionThrownByGuzzleShouldBeReRenderedAsDisplayable()
{ {
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, [ ->shouldReceive('update')->with($this->server->id, [
'installed' => 0, 'installed' => 0,
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -161,7 +161,7 @@ class ReinstallServerServiceTest extends TestCase
public function testExceptionNotThrownByGuzzleShouldNotBeTransformedToDisplayable() public function testExceptionNotThrownByGuzzleShouldNotBeTransformedToDisplayable()
{ {
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, [ ->shouldReceive('update')->with($this->server->id, [
'installed' => 0, 'installed' => 0,
])->once()->andReturnNull(); ])->once()->andReturnNull();

View File

@ -81,7 +81,7 @@ class StartupModificationServiceTest extends TestCase
collect([(object) ['id' => 1, 'value' => 'stored-value']]) collect([(object) ['id' => 1, 'value' => 'stored-value']])
); );
$this->serverVariableRepository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf(); $this->serverVariableRepository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf();
$this->serverVariableRepository->shouldReceive('updateOrCreate')->with([ $this->serverVariableRepository->shouldReceive('updateOrCreate')->with([
'server_id' => $model->id, 'server_id' => $model->id,
'variable_id' => 1, 'variable_id' => 1,
@ -116,7 +116,7 @@ class StartupModificationServiceTest extends TestCase
collect([(object) ['id' => 1, 'value' => 'stored-value']]) collect([(object) ['id' => 1, 'value' => 'stored-value']])
); );
$this->serverVariableRepository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf(); $this->serverVariableRepository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf();
$this->serverVariableRepository->shouldReceive('updateOrCreate')->with([ $this->serverVariableRepository->shouldReceive('updateOrCreate')->with([
'server_id' => $model->id, 'server_id' => $model->id,
'variable_id' => 1, 'variable_id' => 1,

View File

@ -101,7 +101,7 @@ class SuspensionServiceTest extends TestCase
$this->server->suspended = 0; $this->server->suspended = 0;
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, ['suspended' => true])->once()->andReturnNull(); ->shouldReceive('update')->with($this->server->id, ['suspended' => true])->once()->andReturnNull();
$this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id)->once()->andReturnSelf() $this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id)->once()->andReturnSelf()
@ -120,7 +120,7 @@ class SuspensionServiceTest extends TestCase
$this->server->suspended = 1; $this->server->suspended = 1;
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, ['suspended' => false])->once()->andReturnNull(); ->shouldReceive('update')->with($this->server->id, ['suspended' => false])->once()->andReturnNull();
$this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id)->once()->andReturnSelf() $this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id)->once()->andReturnSelf()
@ -159,7 +159,7 @@ class SuspensionServiceTest extends TestCase
$this->server->suspended = 0; $this->server->suspended = 0;
$this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('update')->with($this->server->id, ['suspended' => true])->once()->andReturnNull(); ->shouldReceive('update')->with($this->server->id, ['suspended' => true])->once()->andReturnNull();
$this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id) $this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id)

View File

@ -44,7 +44,7 @@ class PermissionCreationServiceTest extends TestCase
{ {
$permissions = ['reset-sftp', 'view-sftp']; $permissions = ['reset-sftp', 'view-sftp'];
$this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf()
->shouldReceive('insert')->with([ ->shouldReceive('insert')->with([
['subuser_id' => 1, 'permission' => 'reset-sftp'], ['subuser_id' => 1, 'permission' => 'reset-sftp'],
['subuser_id' => 1, 'permission' => 'view-sftp'], ['subuser_id' => 1, 'permission' => 'view-sftp'],

View File

@ -63,7 +63,7 @@ class ToggleTwoFactorServiceTest extends TestCase
$model = factory(User::class)->make(['totp_secret' => self::USER_TOTP_SECRET, 'use_totp' => false]); $model = factory(User::class)->make(['totp_secret' => self::USER_TOTP_SECRET, 'use_totp' => false]);
$this->google2FA->shouldReceive('verifyKey')->with(self::DECRYPTED_USER_SECRET, 'test-token', self::TEST_WINDOW_INT)->once()->andReturn(true); $this->google2FA->shouldReceive('verifyKey')->with(self::DECRYPTED_USER_SECRET, 'test-token', self::TEST_WINDOW_INT)->once()->andReturn(true);
$this->repository->shouldReceive('withoutFresh->update')->with($model->id, [ $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [
'totp_authenticated_at' => Carbon::now(), 'totp_authenticated_at' => Carbon::now(),
'use_totp' => true, 'use_totp' => true,
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -79,7 +79,7 @@ class ToggleTwoFactorServiceTest extends TestCase
$model = factory(User::class)->make(['totp_secret' => self::USER_TOTP_SECRET, 'use_totp' => true]); $model = factory(User::class)->make(['totp_secret' => self::USER_TOTP_SECRET, 'use_totp' => true]);
$this->google2FA->shouldReceive('verifyKey')->with(self::DECRYPTED_USER_SECRET, 'test-token', self::TEST_WINDOW_INT)->once()->andReturn(true); $this->google2FA->shouldReceive('verifyKey')->with(self::DECRYPTED_USER_SECRET, 'test-token', self::TEST_WINDOW_INT)->once()->andReturn(true);
$this->repository->shouldReceive('withoutFresh->update')->with($model->id, [ $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [
'totp_authenticated_at' => Carbon::now(), 'totp_authenticated_at' => Carbon::now(),
'use_totp' => false, 'use_totp' => false,
])->once()->andReturnNull(); ])->once()->andReturnNull();
@ -95,7 +95,7 @@ class ToggleTwoFactorServiceTest extends TestCase
$model = factory(User::class)->make(['totp_secret' => self::USER_TOTP_SECRET, 'use_totp' => false]); $model = factory(User::class)->make(['totp_secret' => self::USER_TOTP_SECRET, 'use_totp' => false]);
$this->google2FA->shouldReceive('verifyKey')->with(self::DECRYPTED_USER_SECRET, 'test-token', self::TEST_WINDOW_INT)->once()->andReturn(true); $this->google2FA->shouldReceive('verifyKey')->with(self::DECRYPTED_USER_SECRET, 'test-token', self::TEST_WINDOW_INT)->once()->andReturn(true);
$this->repository->shouldReceive('withoutFresh->update')->with($model->id, [ $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [
'totp_authenticated_at' => Carbon::now(), 'totp_authenticated_at' => Carbon::now(),
'use_totp' => false, 'use_totp' => false,
])->once()->andReturnNull(); ])->once()->andReturnNull();

View File

@ -58,7 +58,7 @@ class TwoFactorSetupServiceTest extends TestCase
$this->config->shouldReceive('get')->with('app.name')->once()->andReturn('CompanyName'); $this->config->shouldReceive('get')->with('app.name')->once()->andReturn('CompanyName');
$this->google2FA->shouldReceive('getQRCodeGoogleUrl')->with('CompanyName', $model->email, 'secretKey')->once()->andReturn('http://url.com'); $this->google2FA->shouldReceive('getQRCodeGoogleUrl')->with('CompanyName', $model->email, 'secretKey')->once()->andReturn('http://url.com');
$this->encrypter->shouldReceive('encrypt')->with('secretKey')->once()->andReturn('encryptedSecret'); $this->encrypter->shouldReceive('encrypt')->with('secretKey')->once()->andReturn('encryptedSecret');
$this->repository->shouldReceive('withoutFresh->update')->with($model->id, ['totp_secret' => 'encryptedSecret'])->once()->andReturnNull(); $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, ['totp_secret' => 'encryptedSecret'])->once()->andReturnNull();
$response = $this->getService()->handle($model); $response = $this->getService()->handle($model);
$this->assertNotEmpty($response); $this->assertNotEmpty($response);