File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
tests/TestCase/Controller/Component Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,14 @@ public function initialize(array $config)
8585 */
8686 public function beforeFilter ()
8787 {
88+ if ($ this ->_authentication === null ) {
89+ throw new Exception ('The request object does not contain the required `authentication` attribute ' );
90+ }
91+
92+ if (!($ this ->_authentication instanceof AuthenticationServiceInterface)) {
93+ throw new Exception ('Authentication service does not implement ' . AuthenticationServiceInterface::class);
94+ }
95+
8896 $ provider = $ this ->_authentication ->getAuthenticationProvider ();
8997
9098 if ($ provider === null ||
@@ -110,14 +118,6 @@ public function beforeFilter()
110118 */
111119 public function startup ()
112120 {
113- if ($ this ->_authentication === null ) {
114- throw new Exception ('The request object does not contain the required `authentication` attribute ' );
115- }
116-
117- if (!($ this ->_authentication instanceof AuthenticationServiceInterface)) {
118- throw new Exception ('Authentication service does not implement ' . AuthenticationServiceInterface::class);
119- }
120-
121121 if (!$ this ->getConfig ('requireIdentity ' )) {
122122 return ;
123123 }
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public function testInitializeMissingServiceAttribute()
8282 $ controller = new Controller ($ this ->request , $ this ->response );
8383 $ registry = new ComponentRegistry ($ controller );
8484 $ component = new AuthenticationComponent ($ registry );
85- $ component ->startup ();
85+ $ component ->beforeFilter ();
8686 }
8787
8888 /**
@@ -98,7 +98,7 @@ public function testInitializeInvalidServiceObject()
9898 $ controller = new Controller ($ request , $ this ->response );
9999 $ registry = new ComponentRegistry ($ controller );
100100 $ component = new AuthenticationComponent ($ registry );
101- $ component ->startup ();
101+ $ component ->beforeFilter ();
102102 }
103103
104104 /**
You can’t perform that action at this time.
0 commit comments