@@ -26,8 +26,7 @@ public function setUp(): void
2626 {
2727 parent ::setUp ();
2828
29- $ this ->daemonServerRepository = Mockery::mock (DaemonServerRepository::class);
30- $ this ->swap (DaemonServerRepository::class, $ this ->daemonServerRepository );
29+ $ this ->daemonServerRepository = $ this ->mock (DaemonServerRepository::class);
3130 }
3231
3332 /**
@@ -50,7 +49,7 @@ public function testAllocationsCanBeModifiedForTheServer()
5049 $ allocations [2 ]->update (['server_id ' => $ server2 ->id ]);
5150 $ allocations [3 ]->update (['server_id ' => $ server2 ->id ]);
5251
53- $ this ->daemonServerRepository ->expects ('setServer->update ' )->andReturnUndefined ();
52+ $ this ->daemonServerRepository ->expects ('setServer->sync ' )->andReturnUndefined ();
5453
5554 $ response = $ this ->getService ()->handle ($ server , [
5655 // Attempt to add one new allocation, and an allocation assigned to another server. The
@@ -113,20 +112,7 @@ public function testServerBuildDataIsProperlyUpdatedOnWings()
113112 return $ s ->id === $ server ->id ;
114113 }))->andReturnSelf ();
115114
116- $ this ->daemonServerRepository ->expects ('update ' )->with (Mockery::on (function ($ data ) {
117- $ this ->assertEquals ([
118- 'build ' => [
119- 'memory_limit ' => 256 ,
120- 'swap ' => 128 ,
121- 'io_weight ' => 600 ,
122- 'cpu_limit ' => 150 ,
123- 'threads ' => '1,2 ' ,
124- 'disk_space ' => 1024 ,
125- ],
126- ], $ data );
127-
128- return true ;
129- }))->andReturnUndefined ();
115+ $ this ->daemonServerRepository ->expects ('sync ' )->withNoArgs ()->andReturnUndefined ();
130116
131117 $ response = $ this ->getService ()->handle ($ server , [
132118 'oom_disabled ' => false ,
@@ -162,7 +148,7 @@ public function testConnectionExceptionIsIgnoredWhenUpdatingServerSettings()
162148 {
163149 $ server = $ this ->createServerModel ();
164150
165- $ this ->daemonServerRepository ->expects ('setServer->update ' )->andThrows (
151+ $ this ->daemonServerRepository ->expects ('setServer->sync ' )->andThrows (
166152 new DaemonConnectionException (
167153 new RequestException ('Bad request ' , new Request ('GET ' , '/test ' ), new Response ())
168154 )
@@ -186,7 +172,7 @@ public function testNoExceptionIsThrownIfOnlyRemovingAllocation()
186172 /** @var \Pterodactyl\Models\Allocation $allocation */
187173 $ allocation = Allocation::factory ()->create (['node_id ' => $ server ->node_id , 'server_id ' => $ server ->id ]);
188174
189- $ this ->daemonServerRepository ->expects ('setServer->update ' )->andReturnUndefined ();
175+ $ this ->daemonServerRepository ->expects ('setServer->sync ' )->andReturnUndefined ();
190176
191177 $ this ->getService ()->handle ($ server , [
192178 'remove_allocations ' => [$ allocation ->id ],
@@ -209,7 +195,7 @@ public function testAllocationInBothAddAndRemoveIsAdded()
209195 /** @var \Pterodactyl\Models\Allocation $allocation */
210196 $ allocation = Allocation::factory ()->create (['node_id ' => $ server ->node_id ]);
211197
212- $ this ->daemonServerRepository ->expects ('setServer->update ' )->andReturnUndefined ();
198+ $ this ->daemonServerRepository ->expects ('setServer->sync ' )->andReturnUndefined ();
213199
214200 $ this ->getService ()->handle ($ server , [
215201 'add_allocations ' => [$ allocation ->id ],
@@ -230,7 +216,7 @@ public function testUsingSameAllocationIdMultipleTimesDoesNotError()
230216 /** @var \Pterodactyl\Models\Allocation $allocation2 */
231217 $ allocation2 = Allocation::factory ()->create (['node_id ' => $ server ->node_id ]);
232218
233- $ this ->daemonServerRepository ->expects ('setServer->update ' )->andReturnUndefined ();
219+ $ this ->daemonServerRepository ->expects ('setServer->sync ' )->andReturnUndefined ();
234220
235221 $ this ->getService ()->handle ($ server , [
236222 'add_allocations ' => [$ allocation2 ->id , $ allocation2 ->id ],
@@ -253,7 +239,7 @@ public function testThatUpdatesAreRolledBackIfExceptionIsEncountered()
253239 /** @var \Pterodactyl\Models\Allocation $allocation */
254240 $ allocation = Allocation::factory ()->create (['node_id ' => $ server ->node_id ]);
255241
256- $ this ->daemonServerRepository ->expects ('setServer->update ' )->andThrows (new DisplayException ('Test ' ));
242+ $ this ->daemonServerRepository ->expects ('setServer->sync ' )->andThrows (new DisplayException ('Test ' ));
257243
258244 $ this ->expectException (DisplayException::class);
259245
0 commit comments