1010
1111require_once __DIR__ . '/BaseIntegrationTest.php ' ;
1212
13- class SettingsControllerTest extends BaseIntegrationTest {
14- public static function adminGetRouteProvider (): array {
13+ class SettingsControllerTest extends BaseIntegrationTest
14+ {
15+ public static function adminGetRouteProvider (): array
16+ {
1517 return [
1618 ['getAuthMethod ' ],
1719 ['getCache ' ],
1820 ['getHashlookup ' ],
1921 ];
2022 }
2123
22- public static function adminPostRouteProvider (): array {
24+ public static function adminPostRouteProvider (): array
25+ {
2326 return [
2427 // TODO: use default settings
2528 ['adminSettings ' , [
@@ -37,7 +40,8 @@ public static function adminPostRouteProvider(): array {
3740 ];
3841 }
3942
40- public static function operatorGetRouteProvider (): array {
43+ public static function operatorGetRouteProvider (): array
44+ {
4145 return [
4246 ['getSendMailOnVirusUpload ' ],
4347 ['getAutoScan ' ],
@@ -47,7 +51,8 @@ public static function operatorGetRouteProvider(): array {
4751 ];
4852 }
4953
50- public static function operatorPostRouteProvider (): array {
54+ public static function operatorPostRouteProvider (): array
55+ {
5156 return [
5257 ['operatorSettings ' , [
5358 'quarantineFolder ' => '' ,
@@ -63,114 +68,119 @@ public static function operatorPostRouteProvider(): array {
6368 }
6469
6570 #[DataProvider('adminGetRouteProvider ' )]
66- public function testAdminCanAccessAdminGetRoutes (string $ route ): void {
71+ public function testAdminCanAccessAdminGetRoutes (string $ route ): void
72+ {
6773 $ this ->testGetEndpoint ($ route , "Admin access to {$ route }" , 200 );
6874 }
6975
7076
7177 #[DataProvider('adminPostRouteProvider ' )]
72- public function testAdminCanAccessAdminPostRoutes (string $ route , array $ data ): void {
78+ public function testAdminCanAccessAdminPostRoutes (string $ route , array $ data ): void
79+ {
7380 $ this ->testPostEndpoint ($ route , $ data , "Admin access to {$ route }" , 200 );
7481 }
7582
7683 #[DataProvider('operatorGetRouteProvider ' )]
77- public function testAdminCanAccessOperatorGetRoutes (string $ route ): void {
84+ public function testAdminCanAccessOperatorGetRoutes (string $ route ): void
85+ {
7886 $ this ->testGetEndpoint ($ route , "Admin access to {$ route }" , 200 );
7987 }
8088
8189 #[DataProvider('operatorPostRouteProvider ' )]
82- public function testAdminCanAccessOperatorPostRoutes (string $ route , array $ data ): void {
90+ public function testAdminCanAccessOperatorPostRoutes (string $ route , array $ data ): void
91+ {
8392 $ this ->testPostEndpoint ($ route , $ data , "Admin access to {$ route }" , 200 );
8493 }
8594
8695
8796 #[DataProvider('adminGetRouteProvider ' )]
88- public function testOperatorCannotAccessAdminGetRoutes (string $ route ): void {
97+ public function testOperatorCannotAccessAdminGetRoutes (string $ route ): void
98+ {
8999 $ this ->testGetEndpoint (
90- $ route ,
91- "Operator access to {$ route }" ,
92- 403 ,
93- username: 'vaas-operator ' ,
100+ $ route ,
101+ "Operator access to {$ route }" ,
102+ 403 ,
103+ username: 'vaas-operator ' ,
94104 password: 'gdatavaas-operator '
95105 );
96106 }
97107
98108
99109 #[DataProvider('adminPostRouteProvider ' )]
100- public function testOperatorCannotAccessAdminPostRoutes (string $ route , array $ data ): void {
110+ public function testOperatorCannotAccessAdminPostRoutes (string $ route , array $ data ): void
111+ {
101112 $ this ->testPostEndpoint (
102- $ route ,
103- $ data ,
104- "Operator access to {$ route }" ,
105- 403 ,
106- username: 'vaas-operator ' ,
113+ $ route ,
114+ $ data ,
115+ "Operator access to {$ route }" ,
116+ 403 ,
117+ username: 'vaas-operator ' ,
107118 password: 'gdatavaas-operator '
108119 );
109120 }
110121
111122 #[DataProvider('operatorGetRouteProvider ' )]
112- public function testOperatorCanAccessOperatorGetRoutes (string $ route ): void {
123+ public function testOperatorCanAccessOperatorGetRoutes (string $ route ): void
124+ {
113125 $ this ->testGetEndpoint (
114- $ route ,
115- "Operator access to {$ route }" ,
116- 200 ,
117- username: 'vaas-operator ' ,
126+ $ route ,
127+ "Operator access to {$ route }" ,
128+ 200 ,
129+ username: 'vaas-operator ' ,
118130 password: 'gdatavaas-operator '
119131 );
120132 }
121133
122134 #[DataProvider('operatorPostRouteProvider ' )]
123- public function testOperatorCanAccessOperatorPostRoutes (string $ route , array $ data ): void {
135+ public function testOperatorCanAccessOperatorPostRoutes (string $ route , array $ data ): void
136+ {
124137 $ this ->testPostEndpoint (
125- $ route ,
126- $ data ,
127- "Operator access to {$ route }" ,
128- 200 ,
129- username: 'vaas-operator ' ,
138+ $ route ,
139+ $ data ,
140+ "Operator access to {$ route }" ,
141+ 200 ,
142+ username: 'vaas-operator ' ,
130143 password: 'gdatavaas-operator '
131144 );
132145 }
133146
134147
135148 #[DataProvider('adminGetRouteProvider ' )]
136- public function testUserCannotAccessAdminGetRoutes (string $ route ): void {
149+ public function testUserCannotAccessAdminGetRoutes (string $ route ): void
150+ {
137151 $ this ->testGetEndpoint ($ route , "User access to {$ route }" , 403 , username: 'user ' , password: 'gdatavaas-user ' );
138152 }
139153
140154
141155 #[DataProvider('adminPostRouteProvider ' )]
142- public function testUserCannotAccessAdminPostRoutes (string $ route , array $ data ): void {
156+ public function testUserCannotAccessAdminPostRoutes (string $ route , array $ data ): void
157+ {
143158 $ this ->testPostEndpoint (
144- $ route ,
145- $ data ,
146- "Operator access to {$ route }" ,
147- 403 ,
148- username: 'user ' ,
159+ $ route ,
160+ $ data ,
161+ "Operator access to {$ route }" ,
162+ 403 ,
163+ username: 'user ' ,
149164 password: 'gdatavaas-user '
150165 );
151166 }
152167
153168 #[DataProvider('operatorGetRouteProvider ' )]
154- public function testUserCannotAccessOperatorGetRoutes (string $ route ): void {
169+ public function testUserCannotAccessOperatorGetRoutes (string $ route ): void
170+ {
155171 $ this ->testGetEndpoint ($ route , "Operator access to {$ route }" , 403 , username: 'user ' , password: 'gdatavaas-user ' );
156172 }
157173
158174 #[DataProvider('operatorPostRouteProvider ' )]
159- public function testUserCannotAccessOperatorPostRoutes (string $ route , array $ data ): void {
175+ public function testUserCannotAccessOperatorPostRoutes (string $ route , array $ data ): void
176+ {
160177 $ this ->testPostEndpoint (
161- $ route ,
162- $ data ,
163- "Operator access to {$ route }" ,
164- 403 ,
165- username: 'user ' ,
178+ $ route ,
179+ $ data ,
180+ "Operator access to {$ route }" ,
181+ 403 ,
182+ username: 'user ' ,
166183 password: 'gdatavaas-user '
167184 );
168185 }
169-
170-
171- #[DataProvider('adminPostRouteProvider ' )]
172- #[DataProvider('operatorPostRouteProvider ' )]
173- public function testPostRoutesReturn400ForEmptyBody (string $ route , array $ data ): void {
174- $ this ->testPostEndpoint ($ route , [], "Admin access to {$ route }" , 400 );
175- }
176186}
0 commit comments