This repository was archived by the owner on Mar 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +0
-38
lines changed Expand file tree Collapse file tree 3 files changed +0
-38
lines changed Original file line number Diff line number Diff line change 3
3
namespace SwooleTW \Http \Websocket ;
4
4
5
5
use InvalidArgumentException ;
6
- use Illuminate \Support \Facades \Auth ;
7
6
use Illuminate \Contracts \Auth \Authenticatable as AuthenticatableContract ;
8
7
9
8
trait Authenticatable
10
9
{
11
- protected $ user ;
12
10
protected $ userId ;
13
11
14
12
/**
@@ -57,22 +55,6 @@ public function toUserId($userIds)
57
55
return $ this ;
58
56
}
59
57
60
- /**
61
- * Get current auth user by sender's fd.
62
- */
63
- public function getUser ()
64
- {
65
- if ($ this ->user instanceof AuthenticatableContract) {
66
- return $ this ->user ;
67
- }
68
-
69
- if (! is_null ($ uid = $ this ->getUserId ()) && $ user = Auth::loginUsingId ($ uid )) {
70
- $ this ->user = $ user ;
71
- }
72
-
73
- return $ this ->user ;
74
- }
75
-
76
58
/**
77
59
* Get current auth user id by sender's fd.
78
60
*/
Original file line number Diff line number Diff line change @@ -317,7 +317,6 @@ public function reset($force = false)
317
317
318
318
if ($ force ) {
319
319
$ this ->sender = null ;
320
- $ this ->user = null ;
321
320
$ this ->userId = null ;
322
321
}
323
322
Original file line number Diff line number Diff line change 7
7
use InvalidArgumentException ;
8
8
use Illuminate \Pipeline \Pipeline ;
9
9
use SwooleTW \Http \Tests \TestCase ;
10
- use Illuminate \Support \Facades \Auth ;
11
10
use SwooleTW \Http \Websocket \Websocket ;
12
11
use SwooleTW \Http \Websocket \Rooms \RoomContract ;
13
12
use Illuminate \Contracts \Auth \Authenticatable as AuthenticatableContract ;
@@ -206,24 +205,6 @@ public function testGetUserId()
206
205
$ this ->assertEquals ($ sender , $ websocket ->getUserId ());
207
206
}
208
207
209
- public function testGetUser ()
210
- {
211
- $ room = m::mock (RoomContract::class);
212
- $ room ->shouldReceive ('getRooms ' )
213
- ->with ($ sender = 1 )
214
- ->once ()
215
- ->andReturn (['uid_1 ' ]);
216
-
217
- $ user = m::mock (AuthenticatableContract::class);
218
- Auth::shouldReceive ('loginUsingId ' )
219
- ->with ($ sender )
220
- ->once ()
221
- ->andReturn ($ user );
222
-
223
- $ websocket = $ this ->getWebsocket ($ room )->setSender ($ sender );
224
- $ this ->assertEquals ($ user , $ websocket ->getUser ());
225
- }
226
-
227
208
public function testReset ()
228
209
{
229
210
$ websocket = $ this ->getWebsocket ();
You can’t perform that action at this time.
0 commit comments