From a765e0dbb6f728caf84c93f5f87c22a86dca4e63 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Tue, 27 Feb 2018 19:43:47 -0600 Subject: [PATCH] closes #991 --- CHANGELOG.md | 4 +++ .../Servers/ReinstallServerService.php | 2 +- .../Servers/ReinstallServerServiceTest.php | 28 ++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c69c8776..bbed28aac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa This project follows [Semantic Versioning](http://semver.org) guidelines. +## v0.7.4 (Derelict Dermodactylus) +### Fixed +* Fixes a bug when reinstalling a server that would not mark the server as installing, resulting in some UI issues. + ## v0.7.3 (Derelict Dermodactylus) ### Fixed * Fixes server creation API endpoint not passing the provided `external_id` to the creation service. diff --git a/app/Services/Servers/ReinstallServerService.php b/app/Services/Servers/ReinstallServerService.php index 682813e36..85800473f 100644 --- a/app/Services/Servers/ReinstallServerService.php +++ b/app/Services/Servers/ReinstallServerService.php @@ -66,7 +66,7 @@ class ReinstallServerService $this->database->beginTransaction(); $this->repository->withoutFreshModel()->update($server->id, [ 'installed' => 0, - ]); + ], true, true); try { $this->daemonServerRepository->setServer($server)->reinstall(); diff --git a/tests/Unit/Services/Servers/ReinstallServerServiceTest.php b/tests/Unit/Services/Servers/ReinstallServerServiceTest.php index 349aa571a..f00614f77 100644 --- a/tests/Unit/Services/Servers/ReinstallServerServiceTest.php +++ b/tests/Unit/Services/Servers/ReinstallServerServiceTest.php @@ -81,10 +81,9 @@ class ReinstallServerServiceTest extends TestCase $this->repository->shouldNotReceive('find'); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); - $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() - ->shouldReceive('update')->with($this->server->id, [ - 'installed' => 0, - ])->once()->andReturnNull(); + $this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [ + 'installed' => 0, + ], true, true)->once()->andReturnNull(); $this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andReturnSelf() ->shouldReceive('reinstall')->withNoArgs()->once()->andReturn(new Response); @@ -101,10 +100,9 @@ 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('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() - ->shouldReceive('update')->with($this->server->id, [ - 'installed' => 0, - ])->once()->andReturnNull(); + $this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [ + 'installed' => 0, + ], true, true)->once()->andReturnNull(); $this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andReturnSelf() ->shouldReceive('reinstall')->withNoArgs()->once()->andReturn(new Response); @@ -121,10 +119,9 @@ class ReinstallServerServiceTest extends TestCase public function testExceptionThrownByGuzzleShouldBeReRenderedAsDisplayable() { $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); - $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() - ->shouldReceive('update')->with($this->server->id, [ - 'installed' => 0, - ])->once()->andReturnNull(); + $this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [ + 'installed' => 0, + ], true, true)->once()->andReturnNull(); $this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andThrow($this->exception); @@ -139,10 +136,9 @@ class ReinstallServerServiceTest extends TestCase public function testExceptionNotThrownByGuzzleShouldNotBeTransformedToDisplayable() { $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); - $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() - ->shouldReceive('update')->with($this->server->id, [ - 'installed' => 0, - ])->once()->andReturnNull(); + $this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [ + 'installed' => 0, + ], true, true)->once()->andReturnNull(); $this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andThrow(new Exception());