diff --git a/app/Console/Commands/User/DisableTwoFactorCommand.php b/app/Console/Commands/User/DisableTwoFactorCommand.php index 7df23b41e..f2cab910d 100644 --- a/app/Console/Commands/User/DisableTwoFactorCommand.php +++ b/app/Console/Commands/User/DisableTwoFactorCommand.php @@ -56,7 +56,7 @@ class DisableTwoFactorCommand extends Command $email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_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, 'totp_secret' => null, ]); diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index 88590883a..15ee850e9 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -161,7 +161,7 @@ class RunTaskJob extends Job implements ShouldQueue private function markScheduleComplete() { $repository = app()->make(ScheduleRepositoryInterface::class); - $repository->withoutFresh()->update($this->schedule, [ + $repository->withoutFreshModel()->update($this->schedule, [ 'is_processing' => false, 'last_run_at' => Carbon::now()->toDateTimeString(), ]); diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index 49fa53c41..02ecef2f1 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -236,7 +236,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt $instance->whereNotIn('id', $this->getUserAccessServers($user->id)); } - return $instance->setSearchTerm($this->getSearchTerm())->paginate(25); + return $instance->search($this->getSearchTerm())->paginate(25); } /** diff --git a/app/Services/Allocations/SetDefaultAllocationService.php b/app/Services/Allocations/SetDefaultAllocationService.php index 66a858be3..552914097 100644 --- a/app/Services/Allocations/SetDefaultAllocationService.php +++ b/app/Services/Allocations/SetDefaultAllocationService.php @@ -83,7 +83,7 @@ class SetDefaultAllocationService } $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. try { diff --git a/app/Services/Api/PermissionService.php b/app/Services/Api/PermissionService.php index 14bdc235d..24dbf381f 100644 --- a/app/Services/Api/PermissionService.php +++ b/app/Services/Api/PermissionService.php @@ -40,7 +40,7 @@ class PermissionService public function create($key, $permission) { // @todo handle an array of permissions to do a mass assignment? - return $this->repository->withoutFresh()->create([ + return $this->repository->withoutFreshModel()->create([ 'key_id' => $key, 'permission' => $permission, ]); diff --git a/app/Services/DaemonKeys/DaemonKeyCreationService.php b/app/Services/DaemonKeys/DaemonKeyCreationService.php index b9431d28f..23aa1c0aa 100644 --- a/app/Services/DaemonKeys/DaemonKeyCreationService.php +++ b/app/Services/DaemonKeys/DaemonKeyCreationService.php @@ -75,7 +75,7 @@ class DaemonKeyCreationService { $secret = DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40); - $this->repository->withoutFresh()->create([ + $this->repository->withoutFreshModel()->create([ 'user_id' => $user, 'server_id' => $server, 'secret' => $secret, diff --git a/app/Services/DaemonKeys/DaemonKeyUpdateService.php b/app/Services/DaemonKeys/DaemonKeyUpdateService.php index 337b3d173..750d833d9 100644 --- a/app/Services/DaemonKeys/DaemonKeyUpdateService.php +++ b/app/Services/DaemonKeys/DaemonKeyUpdateService.php @@ -78,7 +78,7 @@ class DaemonKeyUpdateService Assert::integerish($key, 'First argument passed to handle must be an integer, received %s.'); $secret = DaemonKeyRepositoryInterface::INTERNAL_KEY_IDENTIFIER . str_random(40); - $this->repository->withoutFresh()->update($key, [ + $this->repository->withoutFreshModel()->update($key, [ 'secret' => $secret, 'expires_at' => $this->carbon->now()->addMinutes($this->config->get('pterodactyl.api.key_expire_time'))->toDateTimeString(), ]); diff --git a/app/Services/Databases/DatabasePasswordService.php b/app/Services/Databases/DatabasePasswordService.php index 4f6443ced..8f8a9582d 100644 --- a/app/Services/Databases/DatabasePasswordService.php +++ b/app/Services/Databases/DatabasePasswordService.php @@ -69,7 +69,7 @@ class DatabasePasswordService $this->dynamic->set('dynamic', $database->database_host_id); $this->connection->beginTransaction(); - $updated = $this->repository->withoutFresh()->update($database->id, [ + $updated = $this->repository->withoutFreshModel()->update($database->id, [ 'password' => $this->encrypter->encrypt($password), ]); diff --git a/app/Services/Eggs/EggUpdateService.php b/app/Services/Eggs/EggUpdateService.php index 2932b7457..14d655178 100644 --- a/app/Services/Eggs/EggUpdateService.php +++ b/app/Services/Eggs/EggUpdateService.php @@ -57,6 +57,6 @@ class EggUpdateService } } - $this->repository->withoutFresh()->update($egg->id, $data); + $this->repository->withoutFreshModel()->update($egg->id, $data); } } diff --git a/app/Services/Eggs/Scripts/InstallScriptService.php b/app/Services/Eggs/Scripts/InstallScriptService.php index 094469944..0d9e66bcc 100644 --- a/app/Services/Eggs/Scripts/InstallScriptService.php +++ b/app/Services/Eggs/Scripts/InstallScriptService.php @@ -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_is_privileged' => array_get($data, 'script_is_privileged', 1), 'script_entry' => array_get($data, 'script_entry'), diff --git a/app/Services/Eggs/Sharing/EggUpdateImporterService.php b/app/Services/Eggs/Sharing/EggUpdateImporterService.php index 3cb275ff7..50342667d 100644 --- a/app/Services/Eggs/Sharing/EggUpdateImporterService.php +++ b/app/Services/Eggs/Sharing/EggUpdateImporterService.php @@ -89,7 +89,7 @@ class EggUpdateImporterService // Update Existing Variables collect($parsed->variables)->each(function ($variable) use ($egg) { - $this->variableRepository->withoutFresh()->updateOrCreate([ + $this->variableRepository->withoutFreshModel()->updateOrCreate([ 'egg_id' => $egg, 'env_variable' => $variable->env_variable, ], collect($variable)->except(['egg_id', 'env_variable'])->toArray()); diff --git a/app/Services/Eggs/Variables/VariableUpdateService.php b/app/Services/Eggs/Variables/VariableUpdateService.php index 91694b166..12930f892 100644 --- a/app/Services/Eggs/Variables/VariableUpdateService.php +++ b/app/Services/Eggs/Variables/VariableUpdateService.php @@ -64,7 +64,7 @@ class VariableUpdateService $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_editable' => in_array('user_editable', $options), ])); diff --git a/app/Services/Nests/NestUpdateService.php b/app/Services/Nests/NestUpdateService.php index 12f3a506a..c3cdcdd5d 100644 --- a/app/Services/Nests/NestUpdateService.php +++ b/app/Services/Nests/NestUpdateService.php @@ -42,6 +42,6 @@ class NestUpdateService unset($data['author']); } - $this->repository->withoutFresh()->update($nest, $data); + $this->repository->withoutFreshModel()->update($nest, $data); } } diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index ace620b28..4a969255b 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -72,7 +72,7 @@ class NodeUpdateService unset($data['reset_secret']); } - $updateResponse = $this->repository->withoutFresh()->update($node->id, $data); + $updateResponse = $this->repository->withoutFreshModel()->update($node->id, $data); try { $this->configRepository->setNode($node->id)->update(); diff --git a/app/Services/Packs/PackUpdateService.php b/app/Services/Packs/PackUpdateService.php index 3354a66f5..a22a55b9f 100644 --- a/app/Services/Packs/PackUpdateService.php +++ b/app/Services/Packs/PackUpdateService.php @@ -70,6 +70,6 @@ class PackUpdateService $data['visible'] = isset($data['visible']); $data['locked'] = isset($data['locked']); - return $this->repository->withoutFresh()->update($pack->id, $data); + return $this->repository->withoutFreshModel()->update($pack->id, $data); } } diff --git a/app/Services/Schedules/Tasks/TaskCreationService.php b/app/Services/Schedules/Tasks/TaskCreationService.php index 9ea1c1783..8ed06e5fd 100644 --- a/app/Services/Schedules/Tasks/TaskCreationService.php +++ b/app/Services/Schedules/Tasks/TaskCreationService.php @@ -56,7 +56,7 @@ class TaskCreationService 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([ 'schedule_id' => $schedule, 'sequence_id' => $data['sequence_id'], diff --git a/app/Services/Servers/DetailsModificationService.php b/app/Services/Servers/DetailsModificationService.php index d18bccd73..f500ab3d2 100644 --- a/app/Services/Servers/DetailsModificationService.php +++ b/app/Services/Servers/DetailsModificationService.php @@ -94,7 +94,7 @@ class DetailsModificationService } $this->connection->beginTransaction(); - $this->repository->withoutFresh()->update($server->id, [ + $this->repository->withoutFreshModel()->update($server->id, [ 'owner_id' => array_get($data, 'owner_id'), 'name' => array_get($data, 'name'), 'description' => array_get($data, 'description', ''), @@ -125,7 +125,7 @@ class DetailsModificationService } $this->connection->beginTransaction(); - $this->repository->withoutFresh()->update($server->id, ['image' => $image]); + $this->repository->withoutFreshModel()->update($server->id, ['image' => $image]); try { $this->daemonServerRepository->setNode($server->node_id)->setAccessServer($server->uuid)->update([ diff --git a/app/Services/Servers/ReinstallServerService.php b/app/Services/Servers/ReinstallServerService.php index d5292adf2..7b8a09728 100644 --- a/app/Services/Servers/ReinstallServerService.php +++ b/app/Services/Servers/ReinstallServerService.php @@ -72,7 +72,7 @@ class ReinstallServerService } $this->database->beginTransaction(); - $this->repository->withoutFresh()->update($server->id, [ + $this->repository->withoutFreshModel()->update($server->id, [ 'installed' => 0, ]); diff --git a/app/Services/Servers/StartupModificationService.php b/app/Services/Servers/StartupModificationService.php index 784b60a05..62c614bc8 100644 --- a/app/Services/Servers/StartupModificationService.php +++ b/app/Services/Servers/StartupModificationService.php @@ -91,7 +91,7 @@ class StartupModificationService $results = $this->validatorService->handle(array_get($data, 'egg_id', $server->egg_id), array_get($data, 'environment', [])); $results->each(function ($result) use ($server) { - $this->serverVariableRepository->withoutFresh()->updateOrCreate([ + $this->serverVariableRepository->withoutFreshModel()->updateOrCreate([ 'server_id' => $server->id, 'variable_id' => $result->id, ], [ diff --git a/app/Services/Servers/SuspensionService.php b/app/Services/Servers/SuspensionService.php index dec29da50..045d92cb3 100644 --- a/app/Services/Servers/SuspensionService.php +++ b/app/Services/Servers/SuspensionService.php @@ -91,7 +91,7 @@ class SuspensionService } $this->database->beginTransaction(); - $this->repository->withoutFresh()->update($server->id, [ + $this->repository->withoutFreshModel()->update($server->id, [ 'suspended' => $action === 'suspend', ]); diff --git a/app/Services/Subusers/PermissionCreationService.php b/app/Services/Subusers/PermissionCreationService.php index d44d63008..0173e8015 100644 --- a/app/Services/Subusers/PermissionCreationService.php +++ b/app/Services/Subusers/PermissionCreationService.php @@ -56,6 +56,6 @@ class PermissionCreationService } } - $this->repository->withoutFresh()->insert($insertPermissions); + $this->repository->withoutFreshModel()->insert($insertPermissions); } } diff --git a/app/Services/Users/ToggleTwoFactorService.php b/app/Services/Users/ToggleTwoFactorService.php index e03a76389..6fe8bc9dd 100644 --- a/app/Services/Users/ToggleTwoFactorService.php +++ b/app/Services/Users/ToggleTwoFactorService.php @@ -75,7 +75,7 @@ class ToggleTwoFactorService throw new TwoFactorAuthenticationTokenInvalid; } - $this->repository->withoutFresh()->update($user->id, [ + $this->repository->withoutFreshModel()->update($user->id, [ 'totp_authenticated_at' => Carbon::now(), 'use_totp' => (is_null($toggleState) ? ! $user->use_totp : $toggleState), ]); diff --git a/app/Services/Users/TwoFactorSetupService.php b/app/Services/Users/TwoFactorSetupService.php index a8554ccfc..4d2ecff8a 100644 --- a/app/Services/Users/TwoFactorSetupService.php +++ b/app/Services/Users/TwoFactorSetupService.php @@ -72,7 +72,7 @@ class TwoFactorSetupService $secret = $this->google2FA->generateSecretKey($this->config->get('pterodactyl.auth.2fa.bytes')); $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), ]); diff --git a/tests/Unit/Commands/User/DisableTwoFactorCommandTest.php b/tests/Unit/Commands/User/DisableTwoFactorCommandTest.php index d741e8be4..32f9e43eb 100644 --- a/tests/Unit/Commands/User/DisableTwoFactorCommandTest.php +++ b/tests/Unit/Commands/User/DisableTwoFactorCommandTest.php @@ -49,7 +49,7 @@ class DisableTwoFactorCommandTest extends CommandTestCase $this->repository->shouldReceive('setColumns')->with(['id', 'email'])->once()->andReturnSelf() ->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, [ 'use_totp' => false, 'totp_secret' => null, @@ -70,7 +70,7 @@ class DisableTwoFactorCommandTest extends CommandTestCase $this->repository->shouldReceive('setColumns')->with(['id', 'email'])->once()->andReturnSelf() ->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, [ 'use_totp' => false, 'totp_secret' => null, diff --git a/tests/Unit/Jobs/Schedule/RunTaskJobTest.php b/tests/Unit/Jobs/Schedule/RunTaskJobTest.php index c72ab33b5..c26bfbaf3 100644 --- a/tests/Unit/Jobs/Schedule/RunTaskJobTest.php +++ b/tests/Unit/Jobs/Schedule/RunTaskJobTest.php @@ -98,7 +98,7 @@ class RunTaskJobTest extends TestCase $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->scheduleRepository->shouldReceive('withoutFresh->update')->with($schedule->id, [ + $this->scheduleRepository->shouldReceive('withoutFreshModel->update')->with($schedule->id, [ 'is_processing' => false, 'last_run_at' => Carbon::now()->toDateTimeString(), ])->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('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, 'last_run_at' => Carbon::now()->toDateTimeString(), ])->once()->andReturnNull(); diff --git a/tests/Unit/Services/Allocations/SetDefaultAllocationServiceTest.php b/tests/Unit/Services/Allocations/SetDefaultAllocationServiceTest.php index 72a837e78..99916bc6b 100644 --- a/tests/Unit/Services/Allocations/SetDefaultAllocationServiceTest.php +++ b/tests/Unit/Services/Allocations/SetDefaultAllocationServiceTest.php @@ -68,7 +68,7 @@ class SetDefaultAllocationServiceTest extends TestCase $this->repository->shouldReceive('findWhere')->with([['server_id', '=', $model->id]])->once()->andReturn($allocations); $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, [ 'allocation_id' => $allocations->first()->id, ])->once()->andReturnNull(); @@ -118,7 +118,7 @@ class SetDefaultAllocationServiceTest extends TestCase $this->repository->shouldReceive('findWhere')->with([['server_id', '=', $model->id]])->once()->andReturn(collect([$allocation])); $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, [ 'allocation_id' => $allocation->id, ])->once()->andReturnNull(); diff --git a/tests/Unit/Services/Api/PermissionServiceTest.php b/tests/Unit/Services/Api/PermissionServiceTest.php index 432f0289a..384acec72 100644 --- a/tests/Unit/Services/Api/PermissionServiceTest.php +++ b/tests/Unit/Services/Api/PermissionServiceTest.php @@ -43,7 +43,7 @@ class PermissionServiceTest extends TestCase */ 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']) ->once()->andReturn(true); diff --git a/tests/Unit/Services/DaemonKeys/DaemonKeyCreationServiceTest.php b/tests/Unit/Services/DaemonKeys/DaemonKeyCreationServiceTest.php index b376b8061..8efcb2f42 100644 --- a/tests/Unit/Services/DaemonKeys/DaemonKeyCreationServiceTest.php +++ b/tests/Unit/Services/DaemonKeys/DaemonKeyCreationServiceTest.php @@ -83,7 +83,7 @@ class DaemonKeyCreationServiceTest extends TestCase ->shouldReceive('addMinutes')->with(100)->once()->andReturnSelf() ->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([ 'user_id' => 1, 'server_id' => 2, diff --git a/tests/Unit/Services/DaemonKeys/DaemonKeyUpdateServiceTest.php b/tests/Unit/Services/DaemonKeys/DaemonKeyUpdateServiceTest.php index 999bdaf06..badc29bf1 100644 --- a/tests/Unit/Services/DaemonKeys/DaemonKeyUpdateServiceTest.php +++ b/tests/Unit/Services/DaemonKeys/DaemonKeyUpdateServiceTest.php @@ -70,7 +70,7 @@ class DaemonKeyUpdateServiceTest extends TestCase ->shouldReceive('addMinutes')->with(100)->once()->andReturnSelf() ->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, [ 'secret' => $secret, 'expires_at' => '00:00:00', diff --git a/tests/Unit/Services/Databases/DatabasePasswordServiceTest.php b/tests/Unit/Services/Databases/DatabasePasswordServiceTest.php index 2388e2d34..946f977d4 100644 --- a/tests/Unit/Services/Databases/DatabasePasswordServiceTest.php +++ b/tests/Unit/Services/Databases/DatabasePasswordServiceTest.php @@ -63,7 +63,7 @@ class DatabasePasswordServiceTest extends TestCase $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); $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('dropUser')->with($model->username, $model->remote)->once()->andReturn(true); diff --git a/tests/Unit/Services/Eggs/EggUpdateServiceTest.php b/tests/Unit/Services/Eggs/EggUpdateServiceTest.php index db548b962..5e1d29bb4 100644 --- a/tests/Unit/Services/Eggs/EggUpdateServiceTest.php +++ b/tests/Unit/Services/Eggs/EggUpdateServiceTest.php @@ -52,7 +52,7 @@ class EggUpdateServiceTest extends TestCase */ public function testEggIsUpdatedWhenNoConfigFromIsProvided() { - $this->repository->shouldReceive('withoutFresh->update') + $this->repository->shouldReceive('withoutFreshModel->update') ->with($this->model->id, ['test_field' => 'field_value'])->once()->andReturnNull(); $this->service->handle($this->model, ['test_field' => 'field_value']); @@ -70,7 +70,7 @@ class EggUpdateServiceTest extends TestCase ['id', '=', 1], ])->once()->andReturn(1); - $this->repository->shouldReceive('withoutFresh->update') + $this->repository->shouldReceive('withoutFreshModel->update') ->with($this->model->id, ['config_from' => 1])->once()->andReturnNull(); $this->service->handle($this->model, ['config_from' => 1]); @@ -102,7 +102,7 @@ class EggUpdateServiceTest extends TestCase public function testIntegerCanBePassedInPlaceOfModel() { $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(); $this->service->handle($this->model->id, ['test_field' => 'field_value']); diff --git a/tests/Unit/Services/Eggs/Scripts/InstallScriptServiceTest.php b/tests/Unit/Services/Eggs/Scripts/InstallScriptServiceTest.php index ac29f44c4..0bb9e7800 100644 --- a/tests/Unit/Services/Eggs/Scripts/InstallScriptServiceTest.php +++ b/tests/Unit/Services/Eggs/Scripts/InstallScriptServiceTest.php @@ -66,7 +66,7 @@ class InstallScriptServiceTest extends TestCase $this->data['copy_script_from'] = 1; $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(); $this->service->handle($this->model, $this->data); @@ -93,7 +93,7 @@ class InstallScriptServiceTest extends TestCase */ 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(); $this->service->handle($this->model, $this->data); @@ -105,7 +105,7 @@ class InstallScriptServiceTest extends TestCase public function testFunctionAcceptsIntegerInPlaceOfModel() { $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(); $this->service->handle($this->model->id, $this->data); diff --git a/tests/Unit/Services/Eggs/Sharing/EggUpdateImporterServiceTest.php b/tests/Unit/Services/Eggs/Sharing/EggUpdateImporterServiceTest.php index df95ee214..1818058c9 100644 --- a/tests/Unit/Services/Eggs/Sharing/EggUpdateImporterServiceTest.php +++ b/tests/Unit/Services/Eggs/Sharing/EggUpdateImporterServiceTest.php @@ -81,7 +81,7 @@ class EggUpdateImporterServiceTest extends TestCase 'name' => $egg->name, ]), true, true)->once()->andReturn($egg); - $this->variableRepository->shouldReceive('withoutFresh->updateOrCreate')->with([ + $this->variableRepository->shouldReceive('withoutFreshModel->updateOrCreate')->with([ 'egg_id' => $egg->id, 'env_variable' => $variable->env_variable, ], collect($variable)->except(['egg_id', 'env_variable'])->toArray())->once()->andReturnNull(); @@ -121,7 +121,7 @@ class EggUpdateImporterServiceTest extends TestCase 'name' => $egg->name, ]), true, true)->once()->andReturn($egg); - $this->variableRepository->shouldReceive('withoutFresh->updateOrCreate')->with([ + $this->variableRepository->shouldReceive('withoutFreshModel->updateOrCreate')->with([ 'egg_id' => $egg->id, 'env_variable' => $variable1->env_variable, ], collect($variable1)->except(['egg_id', 'env_variable'])->toArray())->once()->andReturnNull(); diff --git a/tests/Unit/Services/Eggs/Variables/VariableUpdateServiceTest.php b/tests/Unit/Services/Eggs/Variables/VariableUpdateServiceTest.php index 84d082b33..8bfa67689 100644 --- a/tests/Unit/Services/Eggs/Variables/VariableUpdateServiceTest.php +++ b/tests/Unit/Services/Eggs/Variables/VariableUpdateServiceTest.php @@ -45,7 +45,7 @@ class VariableUpdateServiceTest extends TestCase */ public function testVariableIsUpdatedWhenNoEnvironmentVariableIsPassed() { - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('update')->with($this->model->id, [ 'user_viewable' => false, 'user_editable' => false, @@ -61,7 +61,7 @@ class VariableUpdateServiceTest extends TestCase public function testVariableIdCanBePassedInPlaceOfModel() { $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, [ 'user_viewable' => false, 'user_editable' => false, @@ -83,7 +83,7 @@ class VariableUpdateServiceTest extends TestCase ['id', '!=', $this->model->id], ])->once()->andReturn(0); - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('update')->with($this->model->id, [ 'user_viewable' => false, 'user_editable' => false, @@ -101,7 +101,7 @@ class VariableUpdateServiceTest extends TestCase */ public function testNullOptionValueIsPassedAsArray() { - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('update')->with($this->model->id, [ 'user_viewable' => false, 'user_editable' => false, @@ -123,7 +123,7 @@ class VariableUpdateServiceTest extends TestCase ['id', '!=', $this->model->id], ])->once()->andReturn(0); - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('update')->with($this->model->id, [ 'user_viewable' => false, 'user_editable' => false, diff --git a/tests/Unit/Services/Nests/NestUpdateServiceTest.php b/tests/Unit/Services/Nests/NestUpdateServiceTest.php index e5b03e974..0aa2b388f 100644 --- a/tests/Unit/Services/Nests/NestUpdateServiceTest.php +++ b/tests/Unit/Services/Nests/NestUpdateServiceTest.php @@ -43,7 +43,7 @@ class NestUpdateServiceTest extends TestCase */ 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(); $this->service->handle(1, ['author' => 'author1', 'otherfield' => 'value']); @@ -54,7 +54,7 @@ class NestUpdateServiceTest extends TestCase */ 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(); $this->service->handle(1, ['otherfield' => 'value']); diff --git a/tests/Unit/Services/Nodes/NodeUpdateServiceTest.php b/tests/Unit/Services/Nodes/NodeUpdateServiceTest.php index da851e6c0..0a68c80b0 100644 --- a/tests/Unit/Services/Nodes/NodeUpdateServiceTest.php +++ b/tests/Unit/Services/Nodes/NodeUpdateServiceTest.php @@ -84,7 +84,7 @@ class NodeUpdateServiceTest extends TestCase $this->getFunctionMock('\\Pterodactyl\\Services\\Nodes', 'str_random') ->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, [ 'name' => 'NewName', 'daemonSecret' => 'random_string', @@ -101,7 +101,7 @@ class NodeUpdateServiceTest extends TestCase */ public function testNodeIsUpdatedAndDaemonSecretIsNotChanged() { - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('update')->with($this->node->id, [ 'name' => 'NewName', ])->andReturn(true); @@ -117,7 +117,7 @@ class NodeUpdateServiceTest extends TestCase */ public function testExceptionCausedByDaemonIsHandled() { - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('update')->with($this->node->id, [ 'name' => 'NewName', ])->andReturn(true); @@ -144,7 +144,7 @@ class NodeUpdateServiceTest extends TestCase public function testFunctionCanAcceptANodeIdInPlaceOfModel() { $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, [ 'name' => 'NewName', ])->andReturn(true); diff --git a/tests/Unit/Services/Packs/PackUpdateServiceTest.php b/tests/Unit/Services/Packs/PackUpdateServiceTest.php index 7078a003c..614807435 100644 --- a/tests/Unit/Services/Packs/PackUpdateServiceTest.php +++ b/tests/Unit/Services/Packs/PackUpdateServiceTest.php @@ -53,7 +53,7 @@ class PackUpdateServiceTest extends TestCase public function testPackIsUpdated() { $model = factory(Pack::class)->make(); - $this->repository->shouldReceive('withoutFresh->update')->with($model->id, [ + $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [ 'locked' => false, 'visible' => false, 'selectable' => false, @@ -87,7 +87,7 @@ class PackUpdateServiceTest extends TestCase $this->repository->shouldReceive('setColumns')->with(['id', 'egg_id'])->once()->andReturnSelf() ->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, 'visible' => false, 'selectable' => false, diff --git a/tests/Unit/Services/Schedules/Tasks/TaskCreationServiceTest.php b/tests/Unit/Services/Schedules/Tasks/TaskCreationServiceTest.php index b70ca5275..f6c797ec1 100644 --- a/tests/Unit/Services/Schedules/Tasks/TaskCreationServiceTest.php +++ b/tests/Unit/Services/Schedules/Tasks/TaskCreationServiceTest.php @@ -81,7 +81,7 @@ class TaskCreationServiceTest extends TestCase { $schedule = factory(Schedule::class)->make(); - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('create')->with([ 'schedule_id' => $schedule->id, 'sequence_id' => 1, @@ -108,7 +108,7 @@ class TaskCreationServiceTest extends TestCase */ public function testIdCanBePassedInPlaceOfScheduleModel() { - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('create')->with([ 'schedule_id' => 1234, 'sequence_id' => 1, diff --git a/tests/Unit/Services/Servers/DetailsModificationServiceTest.php b/tests/Unit/Services/Servers/DetailsModificationServiceTest.php index 7d1e19862..3d04b0106 100644 --- a/tests/Unit/Services/Servers/DetailsModificationServiceTest.php +++ b/tests/Unit/Services/Servers/DetailsModificationServiceTest.php @@ -103,7 +103,7 @@ class DetailsModificationServiceTest extends TestCase $data = ['owner_id' => 1, 'name' => 'New Name', 'description' => 'New Description']; $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, [ 'owner_id' => $data['owner_id'], 'name' => $data['name'], @@ -129,7 +129,7 @@ class DetailsModificationServiceTest extends TestCase $this->repository->shouldReceive('find')->with($server->id)->once()->andReturn($server); $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, [ 'owner_id' => $data['owner_id'], 'name' => $data['name'], @@ -155,7 +155,7 @@ class DetailsModificationServiceTest extends TestCase $data = ['owner_id' => 2, 'name' => 'New Name', 'description' => 'New Description']; $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, [ 'owner_id' => $data['owner_id'], 'name' => $data['name'], @@ -178,7 +178,7 @@ class DetailsModificationServiceTest extends TestCase $server = factory(Server::class)->make(['node_id' => 1]); $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, [ 'image' => 'new/image', ])->once()->andReturnNull(); @@ -206,7 +206,7 @@ class DetailsModificationServiceTest extends TestCase $this->repository->shouldReceive('find')->with($server->id)->once()->andReturn($server); $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, [ 'image' => 'new/image', ])->once()->andReturnNull(); @@ -233,7 +233,7 @@ class DetailsModificationServiceTest extends TestCase $server = factory(Server::class)->make(['node_id' => 1]); $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, [ 'image' => 'new/image', ])->once()->andReturnNull(); @@ -266,7 +266,7 @@ class DetailsModificationServiceTest extends TestCase $server = factory(Server::class)->make(['node_id' => 1]); $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, [ 'image' => 'new/image', ])->once()->andReturnNull(); diff --git a/tests/Unit/Services/Servers/ReinstallServerServiceTest.php b/tests/Unit/Services/Servers/ReinstallServerServiceTest.php index b7635467a..82f018670 100644 --- a/tests/Unit/Services/Servers/ReinstallServerServiceTest.php +++ b/tests/Unit/Services/Servers/ReinstallServerServiceTest.php @@ -89,7 +89,7 @@ class ReinstallServerServiceTest extends TestCase $this->repository->shouldNotReceive('find'); $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, [ 'installed' => 0, ])->once()->andReturnNull(); @@ -110,7 +110,7 @@ class ReinstallServerServiceTest extends TestCase $this->repository->shouldReceive('find')->with($this->server->id)->once()->andReturn($this->server); $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, [ 'installed' => 0, ])->once()->andReturnNull(); @@ -129,7 +129,7 @@ class ReinstallServerServiceTest extends TestCase public function testExceptionThrownByGuzzleShouldBeReRenderedAsDisplayable() { $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, [ 'installed' => 0, ])->once()->andReturnNull(); @@ -161,7 +161,7 @@ class ReinstallServerServiceTest extends TestCase public function testExceptionNotThrownByGuzzleShouldNotBeTransformedToDisplayable() { $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, [ 'installed' => 0, ])->once()->andReturnNull(); diff --git a/tests/Unit/Services/Servers/StartupModificationServiceTest.php b/tests/Unit/Services/Servers/StartupModificationServiceTest.php index ca1dc33c0..0c06b1799 100644 --- a/tests/Unit/Services/Servers/StartupModificationServiceTest.php +++ b/tests/Unit/Services/Servers/StartupModificationServiceTest.php @@ -81,7 +81,7 @@ class StartupModificationServiceTest extends TestCase 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([ 'server_id' => $model->id, 'variable_id' => 1, @@ -116,7 +116,7 @@ class StartupModificationServiceTest extends TestCase 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([ 'server_id' => $model->id, 'variable_id' => 1, diff --git a/tests/Unit/Services/Servers/SuspensionServiceTest.php b/tests/Unit/Services/Servers/SuspensionServiceTest.php index c24f6e0f0..e899ca747 100644 --- a/tests/Unit/Services/Servers/SuspensionServiceTest.php +++ b/tests/Unit/Services/Servers/SuspensionServiceTest.php @@ -101,7 +101,7 @@ class SuspensionServiceTest extends TestCase $this->server->suspended = 0; $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(); $this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id)->once()->andReturnSelf() @@ -120,7 +120,7 @@ class SuspensionServiceTest extends TestCase $this->server->suspended = 1; $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(); $this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id)->once()->andReturnSelf() @@ -159,7 +159,7 @@ class SuspensionServiceTest extends TestCase $this->server->suspended = 0; $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(); $this->daemonServerRepository->shouldReceive('setNode')->with($this->server->node_id) diff --git a/tests/Unit/Services/Subusers/PermissionCreationServiceTest.php b/tests/Unit/Services/Subusers/PermissionCreationServiceTest.php index ddfd8c551..397d3d88a 100644 --- a/tests/Unit/Services/Subusers/PermissionCreationServiceTest.php +++ b/tests/Unit/Services/Subusers/PermissionCreationServiceTest.php @@ -44,7 +44,7 @@ class PermissionCreationServiceTest extends TestCase { $permissions = ['reset-sftp', 'view-sftp']; - $this->repository->shouldReceive('withoutFresh')->withNoArgs()->once()->andReturnSelf() + $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() ->shouldReceive('insert')->with([ ['subuser_id' => 1, 'permission' => 'reset-sftp'], ['subuser_id' => 1, 'permission' => 'view-sftp'], diff --git a/tests/Unit/Services/Users/ToggleTwoFactorServiceTest.php b/tests/Unit/Services/Users/ToggleTwoFactorServiceTest.php index c8d1cc852..0b8f453cc 100644 --- a/tests/Unit/Services/Users/ToggleTwoFactorServiceTest.php +++ b/tests/Unit/Services/Users/ToggleTwoFactorServiceTest.php @@ -63,7 +63,7 @@ class ToggleTwoFactorServiceTest extends TestCase $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->repository->shouldReceive('withoutFresh->update')->with($model->id, [ + $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [ 'totp_authenticated_at' => Carbon::now(), 'use_totp' => true, ])->once()->andReturnNull(); @@ -79,7 +79,7 @@ class ToggleTwoFactorServiceTest extends TestCase $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->repository->shouldReceive('withoutFresh->update')->with($model->id, [ + $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [ 'totp_authenticated_at' => Carbon::now(), 'use_totp' => false, ])->once()->andReturnNull(); @@ -95,7 +95,7 @@ class ToggleTwoFactorServiceTest extends TestCase $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->repository->shouldReceive('withoutFresh->update')->with($model->id, [ + $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [ 'totp_authenticated_at' => Carbon::now(), 'use_totp' => false, ])->once()->andReturnNull(); diff --git a/tests/Unit/Services/Users/TwoFactorSetupServiceTest.php b/tests/Unit/Services/Users/TwoFactorSetupServiceTest.php index d6f5f8b90..8cb097537 100644 --- a/tests/Unit/Services/Users/TwoFactorSetupServiceTest.php +++ b/tests/Unit/Services/Users/TwoFactorSetupServiceTest.php @@ -58,7 +58,7 @@ class TwoFactorSetupServiceTest extends TestCase $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->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); $this->assertNotEmpty($response);