Skip to content

Commit

Permalink
test: fix param types
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Oct 27, 2023
1 parent 78dc645 commit f8c8ca5
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/system/Commands/ClearDebugbarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function createDummyDebugbarJson(): void

// create 10 dummy debugbar json files
for ($i = 0; $i < 10; $i++) {
$path = str_replace($time, $time - $i, $path);
$path = str_replace((string) $time, (string) ($time - $i), $path);
file_put_contents($path, "{}\n");

$time -= $i;
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CommonFunctionsSendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testRedirectResponseCookiesSent(): void

$response = redirect()->route('login')
->setCookie('foo', 'onething', YEAR)
->setCookie('login_time', $loginTime, YEAR);
->setCookie('login_time', (string) $loginTime, YEAR);
$response->pretend(false);
$this->assertTrue($response->hasCookie('foo', 'onething'));
$this->assertTrue($response->hasCookie('login_time'));
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ public function testRedirectResponseCookies1(): void

$answer1 = redirect()->route('login')
->setCookie('foo', 'onething', YEAR)
->setCookie('login_time', $loginTime, YEAR);
->setCookie('login_time', (string) $loginTime, YEAR);

$this->assertTrue($answer1->hasCookie('foo', 'onething'));
$this->assertTrue($answer1->hasCookie('login_time'));
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Debug/Toolbar/Collectors/HistoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private function createDummyDebugbarJson(): void

// create 20 dummy debugbar json files
for ($i = 0; $i < 20; $i++) {
$path = str_replace($time, sprintf('%.6f', $time - self::STEP), $path);
$path = str_replace((string) $time, sprintf('%.6f', $time - self::STEP), $path);
file_put_contents($path, json_encode($dummyData));
$time = sprintf('%.6f', $time - self::STEP);
}
Expand Down
4 changes: 3 additions & 1 deletion tests/system/HTTP/ResponseSendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ public function testRedirectResponseCookies(): void

$answer1 = $response->redirect('/login')
->setCookie('foo', 'bar', YEAR)
->setCookie('login_time', $loginTime, YEAR);
->setCookie('login_time', (string) $loginTime, YEAR);

$this->assertTrue($answer1->hasCookie('foo', 'bar'));
$this->assertTrue($answer1->hasCookie('login_time'));

$response->setBody('Hello');

// send it
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ public function testRedirectResponseCookies(): void
$response = new Response(new App());
$answer1 = $response->redirect('/login')
->setCookie('foo', 'bar', YEAR)
->setCookie('login_time', $loginTime, YEAR);
->setCookie('login_time', (string) $loginTime, YEAR);

$this->assertTrue($answer1->hasCookie('foo'));
$this->assertTrue($answer1->hasCookie('login_time'));
Expand Down
4 changes: 3 additions & 1 deletion tests/system/Helpers/CookieHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ public function testSameSiteParamArray(): void

public function testSameSiteParam(): void
{
set_cookie($this->name, $this->value, $this->expire, '', '', '', '', '', 'Strict');
set_cookie($this->name, $this->value, $this->expire, '', '', '', null, null, 'Strict');

$this->assertTrue($this->response->hasCookie($this->name));

$theCookie = $this->response->getCookie($this->name);

$this->assertSame('Strict', $theCookie->getSameSite());

delete_cookie($this->name);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Helpers/FilesystemHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function testDirectoryMapShowsHiddenFiles(): void
$root = vfsStream::setup('root', null, $this->structure);
$this->assertTrue($root->hasChild('foo'));

$this->assertSame($expected, directory_map(vfsStream::url('root'), false, true));
$this->assertSame($expected, directory_map(vfsStream::url('root'), 0, true));
}

public function testDirectoryMapLimitsRecursion(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Helpers/TextHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function testIncrementString(): void
$this->assertSame('file_5', increment_string('file_4'));
$this->assertSame('file-5', increment_string('file-4', '-'));
$this->assertSame('file-5', increment_string('file-4', '-'));
$this->assertSame('file-1', increment_string('file', '-', '1'));
$this->assertSame('file-1', increment_string('file', '-', 1));
$this->assertSame('124', increment_string('123', ''));
}

Expand Down

0 comments on commit f8c8ca5

Please sign in to comment.