@@ -118,20 +118,20 @@ public function provideUrlCases(): iterable
118
118
* @param array<0|string, string|int|false> $page
119
119
* @param array<string, string> $extraRequestUrlArgs
120
120
*/
121
- public function testUrl (string $ requestUrl , array $ appStickyGetArguments , array $ page , array $ extraRequestUrlArgs , string $ exceptedUrl ): void
121
+ public function testUrl (string $ requestUrl , array $ appStickyGetArguments , array $ page , array $ extraRequestUrlArgs , string $ expectedUrl ): void
122
122
{
123
123
$ request = (new Psr17Factory ())->createServerRequest ('GET ' , $ requestUrl );
124
124
125
125
$ app = $ this ->createApp ([
126
126
'request ' => $ request ,
127
127
'stickyGetArguments ' => $ appStickyGetArguments ,
128
128
]);
129
- self ::assertSame ($ exceptedUrl , $ app ->url ($ page , $ extraRequestUrlArgs ));
129
+ self ::assertSame ($ expectedUrl , $ app ->url ($ page , $ extraRequestUrlArgs ));
130
130
$ pageAssocOnly = array_diff_key ($ page , [true ]);
131
- self ::assertSame ($ exceptedUrl , $ app ->url (($ page [0 ] ?? '' ) . (count ($ pageAssocOnly ) > 0 ? '? ' . implode ('& ' , array_map (static fn ($ k ) => $ k . '= ' . $ pageAssocOnly [$ k ], array_keys ($ pageAssocOnly ))) : '' ), $ extraRequestUrlArgs ));
132
- self ::assertSame ($ exceptedUrl , $ app ->jsUrl ($ page , array_merge (['__atk_json ' => null ], $ extraRequestUrlArgs )));
131
+ self ::assertSame ($ expectedUrl , $ app ->url (($ page [0 ] ?? '' ) . (count ($ pageAssocOnly ) > 0 ? '? ' . implode ('& ' , array_map (static fn ($ k ) => $ k . '= ' . $ pageAssocOnly [$ k ], array_keys ($ pageAssocOnly ))) : '' ), $ extraRequestUrlArgs ));
132
+ self ::assertSame ($ expectedUrl , $ app ->jsUrl ($ page , array_merge (['__atk_json ' => null ], $ extraRequestUrlArgs )));
133
133
134
- $ replaceExpectedUrlFx = static function (string $ indexPage , string $ ext ) use ($ page , $ exceptedUrl ) {
134
+ $ replaceExpectedUrlFx = static function (string $ indexPage , string $ ext ) use ($ page , $ expectedUrl ) {
135
135
return preg_replace_callback ('~^[^?]*?\K([^/?]*)(\.php)(?=\?|$)~ ' , static function ($ matches ) use ($ page , $ indexPage , $ ext ) {
136
136
if ($ matches [1 ] === 'index ' && !preg_match ('~(^|/)index(\.php)?(?=\?|$)~ ' , $ page [0 ] ?? '' )) {
137
137
$ matches [1 ] = $ indexPage ;
@@ -141,7 +141,7 @@ public function testUrl(string $requestUrl, array $appStickyGetArguments, array
141
141
}
142
142
143
143
return $ matches [1 ] . $ matches [2 ];
144
- }, $ exceptedUrl , 1 );
144
+ }, $ expectedUrl , 1 );
145
145
};
146
146
147
147
$ app = $ this ->createApp ([
@@ -150,25 +150,25 @@ public function testUrl(string $requestUrl, array $appStickyGetArguments, array
150
150
'urlBuildingIndexPage ' => 'default ' ,
151
151
'urlBuildingExt ' => '.php8 ' ,
152
152
]);
153
- $ exceptedUrlCustom = $ replaceExpectedUrlFx ('default ' , '.php8 ' );
154
- self ::assertSame ($ exceptedUrlCustom , $ app ->url ($ page , $ extraRequestUrlArgs ));
153
+ $ expectedUrlCustom = $ replaceExpectedUrlFx ('default ' , '.php8 ' );
154
+ self ::assertSame ($ expectedUrlCustom , $ app ->url ($ page , $ extraRequestUrlArgs ));
155
155
156
156
$ app = $ this ->createApp ([
157
157
'request ' => $ request ,
158
158
'stickyGetArguments ' => $ appStickyGetArguments ,
159
159
'urlBuildingIndexPage ' => '' ,
160
160
'urlBuildingExt ' => '' ,
161
161
]);
162
- $ exceptedUrlAutoindex = $ replaceExpectedUrlFx ('' , '' );
163
- self ::assertSame ($ exceptedUrlAutoindex , $ app ->url ($ page , $ extraRequestUrlArgs ));
162
+ $ expectedUrlAutoindex = $ replaceExpectedUrlFx ('' , '' );
163
+ self ::assertSame ($ expectedUrlAutoindex , $ app ->url ($ page , $ extraRequestUrlArgs ));
164
164
165
165
$ app = $ this ->createApp ([
166
166
'request ' => $ request ,
167
167
'stickyGetArguments ' => $ appStickyGetArguments ,
168
168
'urlBuildingIndexPage ' => '' ,
169
169
'urlBuildingExt ' => '.html ' ,
170
170
]);
171
- $ exceptedUrlAutoindex2 = $ replaceExpectedUrlFx ('' , '.html ' );
172
- self ::assertSame ($ exceptedUrlAutoindex2 , $ app ->url ($ page , $ extraRequestUrlArgs ));
171
+ $ expectedUrlAutoindex2 = $ replaceExpectedUrlFx ('' , '.html ' );
172
+ self ::assertSame ($ expectedUrlAutoindex2 , $ app ->url ($ page , $ extraRequestUrlArgs ));
173
173
}
174
174
}
0 commit comments