@@ -81,7 +81,8 @@ public function setUp()
8181 */
8282 public function testUserIsDeletedIfNoServersAreAttachedToAccount ()
8383 {
84- $ this ->serverRepository ->shouldReceive ('findWhere ' )->with ([['owner_id ' , '= ' , $ this ->user ->id ]])->once ()->andReturn ([]);
84+ $ this ->serverRepository ->shouldReceive ('withColumns ' )->with ('id ' )->once ()->andReturnSelf ()
85+ ->shouldReceive ('findCountWhere ' )->with ([['owner_id ' , '= ' , $ this ->user ->id ]])->once ()->andReturn (0 );
8586 $ this ->repository ->shouldReceive ('delete ' )->with ($ this ->user ->id )->once ()->andReturn (true );
8687
8788 $ this ->assertTrue (
@@ -97,7 +98,8 @@ public function testUserIsDeletedIfNoServersAreAttachedToAccount()
9798 */
9899 public function testExceptionIsThrownIfServersAreAttachedToAccount ()
99100 {
100- $ this ->serverRepository ->shouldReceive ('findWhere ' )->with ([['owner_id ' , '= ' , $ this ->user ->id ]])->once ()->andReturn (['item ' ]);
101+ $ this ->serverRepository ->shouldReceive ('withColumns ' )->with ('id ' )->once ()->andReturnSelf ()
102+ ->shouldReceive ('findCountWhere ' )->with ([['owner_id ' , '= ' , $ this ->user ->id ]])->once ()->andReturn (1 );
101103 $ this ->translator ->shouldReceive ('trans ' )->with ('admin/user.exceptions.user_has_servers ' )->once ()->andReturnNull ();
102104
103105 $ this ->service ->handle ($ this ->user ->id );
@@ -108,7 +110,8 @@ public function testExceptionIsThrownIfServersAreAttachedToAccount()
108110 */
109111 public function testModelCanBePassedInPlaceOfUserId ()
110112 {
111- $ this ->serverRepository ->shouldReceive ('findWhere ' )->with ([['owner_id ' , '= ' , $ this ->user ->id ]])->once ()->andReturn ([]);
113+ $ this ->serverRepository ->shouldReceive ('withColumns ' )->with ('id ' )->once ()->andReturnSelf ()
114+ ->shouldReceive ('findCountWhere ' )->with ([['owner_id ' , '= ' , $ this ->user ->id ]])->once ()->andReturn (0 );
112115 $ this ->repository ->shouldReceive ('delete ' )->with ($ this ->user ->id )->once ()->andReturn (true );
113116
114117 $ this ->assertTrue (
0 commit comments