Update calls to missing function
This commit is contained in:
parent
60eb60013c
commit
5f9fe4a69b
45 changed files with 78 additions and 78 deletions
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue