Skip to content

Commit 1e411bf

Browse files
committedSep 17, 2023
fix typo
1 parent 9c7407c commit 1e411bf

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed
 

‎tests/AppTest.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,20 @@ public function provideUrlCases(): iterable
118118
* @param array<0|string, string|int|false> $page
119119
* @param array<string, string> $extraRequestUrlArgs
120120
*/
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
122122
{
123123
$request = (new Psr17Factory())->createServerRequest('GET', $requestUrl);
124124

125125
$app = $this->createApp([
126126
'request' => $request,
127127
'stickyGetArguments' => $appStickyGetArguments,
128128
]);
129-
self::assertSame($exceptedUrl, $app->url($page, $extraRequestUrlArgs));
129+
self::assertSame($expectedUrl, $app->url($page, $extraRequestUrlArgs));
130130
$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)));
133133

134-
$replaceExpectedUrlFx = static function (string $indexPage, string $ext) use ($page, $exceptedUrl) {
134+
$replaceExpectedUrlFx = static function (string $indexPage, string $ext) use ($page, $expectedUrl) {
135135
return preg_replace_callback('~^[^?]*?\K([^/?]*)(\.php)(?=\?|$)~', static function ($matches) use ($page, $indexPage, $ext) {
136136
if ($matches[1] === 'index' && !preg_match('~(^|/)index(\.php)?(?=\?|$)~', $page[0] ?? '')) {
137137
$matches[1] = $indexPage;
@@ -141,7 +141,7 @@ public function testUrl(string $requestUrl, array $appStickyGetArguments, array
141141
}
142142

143143
return $matches[1] . $matches[2];
144-
}, $exceptedUrl, 1);
144+
}, $expectedUrl, 1);
145145
};
146146

147147
$app = $this->createApp([
@@ -150,25 +150,25 @@ public function testUrl(string $requestUrl, array $appStickyGetArguments, array
150150
'urlBuildingIndexPage' => 'default',
151151
'urlBuildingExt' => '.php8',
152152
]);
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));
155155

156156
$app = $this->createApp([
157157
'request' => $request,
158158
'stickyGetArguments' => $appStickyGetArguments,
159159
'urlBuildingIndexPage' => '',
160160
'urlBuildingExt' => '',
161161
]);
162-
$exceptedUrlAutoindex = $replaceExpectedUrlFx('', '');
163-
self::assertSame($exceptedUrlAutoindex, $app->url($page, $extraRequestUrlArgs));
162+
$expectedUrlAutoindex = $replaceExpectedUrlFx('', '');
163+
self::assertSame($expectedUrlAutoindex, $app->url($page, $extraRequestUrlArgs));
164164

165165
$app = $this->createApp([
166166
'request' => $request,
167167
'stickyGetArguments' => $appStickyGetArguments,
168168
'urlBuildingIndexPage' => '',
169169
'urlBuildingExt' => '.html',
170170
]);
171-
$exceptedUrlAutoindex2 = $replaceExpectedUrlFx('', '.html');
172-
self::assertSame($exceptedUrlAutoindex2, $app->url($page, $extraRequestUrlArgs));
171+
$expectedUrlAutoindex2 = $replaceExpectedUrlFx('', '.html');
172+
self::assertSame($expectedUrlAutoindex2, $app->url($page, $extraRequestUrlArgs));
173173
}
174174
}

0 commit comments

Comments
 (0)