@@ -151,10 +151,7 @@ public function setUp()
151
151
152
152
public function testAuthorizeActionWillThrowAccessDeniedException ()
153
153
{
154
- $ token = $ this ->getMockBuilder (TokenInterface::class)
155
- ->disableOriginalConstructor ()
156
- ->getMock ()
157
- ;
154
+ $ token = $ this ->createMock (TokenInterface::class);
158
155
159
156
$ this ->tokenStorage
160
157
->expects ($ this ->at (0 ))
@@ -176,10 +173,7 @@ public function testAuthorizeActionWillThrowAccessDeniedException()
176
173
177
174
public function testAuthorizeActionWillRenderTemplate ()
178
175
{
179
- $ token = $ this ->getMockBuilder (TokenInterface::class)
180
- ->disableOriginalConstructor ()
181
- ->getMock ()
182
- ;
176
+ $ token = $ this ->createMock (TokenInterface::class);
183
177
184
178
$ this ->tokenStorage
185
179
->expects ($ this ->at (0 ))
@@ -251,10 +245,7 @@ public function testAuthorizeActionWillRenderTemplate()
251
245
252
246
public function testAuthorizeActionWillFinishClientAuthorization ()
253
247
{
254
- $ token = $ this ->getMockBuilder (TokenInterface::class)
255
- ->disableOriginalConstructor ()
256
- ->getMock ()
257
- ;
248
+ $ token = $ this ->createMock (TokenInterface::class);
258
249
259
250
$ this ->tokenStorage
260
251
->expects ($ this ->at (0 ))
@@ -321,10 +312,7 @@ public function testAuthorizeActionWillFinishClientAuthorization()
321
312
322
313
public function testAuthorizeActionWillEnsureLogout ()
323
314
{
324
- $ token = $ this ->getMockBuilder (TokenInterface::class)
325
- ->disableOriginalConstructor ()
326
- ->getMock ()
327
- ;
315
+ $ token = $ this ->createMock (TokenInterface::class);
328
316
329
317
$ this ->tokenStorage
330
318
->expects ($ this ->at (0 ))
@@ -408,12 +396,9 @@ public function testAuthorizeActionWillEnsureLogout()
408
396
$ this ->assertSame ($ response , $ this ->instance ->authorizeAction ($ this ->request ));
409
397
}
410
398
411
- public function testAuthorizeActionWillProcessForm ()
399
+ public function testAuthorizeActionWillProcessAuthorizationForm ()
412
400
{
413
- $ token = $ this ->getMockBuilder (TokenInterface::class)
414
- ->disableOriginalConstructor ()
415
- ->getMock ()
416
- ;
401
+ $ token = $ this ->createMock (TokenInterface::class);
417
402
418
403
$ this ->tokenStorage
419
404
->expects ($ this ->once ())
@@ -448,27 +433,18 @@ public function testAuthorizeActionWillProcessForm()
448
433
$ this ->event
449
434
->expects ($ this ->once ())
450
435
->method ('isAuthorizedClient ' )
451
- ->with ()
452
436
->willReturn (false )
453
437
;
454
438
455
439
$ this ->authorizeFormHandler
456
440
->expects ($ this ->once ())
457
441
->method ('process ' )
458
- ->with (
459
- $ this ->user ,
460
- $ this ->authorizeFormHandler ,
461
- $ this ->request
462
- )
463
442
->willReturn (true )
464
443
;
465
444
466
- $ this ->markTestIncomplete ('Not finished yet ' );
467
-
468
445
$ this ->authorizeFormHandler
469
446
->expects ($ this ->exactly (2 ))
470
447
->method ('isAccepted ' )
471
- ->with ()
472
448
->willReturn (true )
473
449
;
474
450
@@ -486,14 +462,12 @@ public function testAuthorizeActionWillProcessForm()
486
462
$ this ->form
487
463
->expects ($ this ->once ())
488
464
->method ('getName ' )
489
- ->with ()
490
465
->willReturn ($ formName )
491
466
;
492
467
493
468
$ this ->request ->query
494
469
->expects ($ this ->once ())
495
470
->method ('all ' )
496
- ->with ()
497
471
->willReturn ([])
498
472
;
499
473
@@ -507,16 +481,15 @@ public function testAuthorizeActionWillProcessForm()
507
481
$ randomScope = 'scope ' . \random_bytes (10 );
508
482
509
483
$ this ->authorizeFormHandler
510
- ->expects ($ this ->at ( 3 ))
484
+ ->expects ($ this ->once ( ))
511
485
->method ('getScope ' )
512
- ->with ('scope ' , null )
513
486
->willReturn ($ randomScope )
514
487
;
515
488
516
489
$ response = new Response ();
517
490
518
491
$ this ->oAuth2Server
519
- ->expects ($ this ->at ( 4 ))
492
+ ->expects ($ this ->once ( ))
520
493
->method ('finishClientAuthorization ' )
521
494
->with (
522
495
true ,
@@ -527,8 +500,6 @@ public function testAuthorizeActionWillProcessForm()
527
500
->willReturn ($ response )
528
501
;
529
502
530
- var_dump ($ this ->instance ->authorizeAction ($ this ->request ));
531
- return ;
532
503
$ this ->assertSame ($ response , $ this ->instance ->authorizeAction ($ this ->request ));
533
504
}
534
505
}
0 commit comments