8000 minor #58476 [HttpKernel] harden test to not depend on the system's c… · devloop42/symfony@e5f794d · GitHub
[go: up one dir, main page]

Skip to content

Commit e5f794d

Browse files
committed
minor symfony#58476 [HttpKernel] harden test to not depend on the system's configured default timezone (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [HttpKernel] harden test to not depend on the system's configured default timezone | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT fixes https://ci.appveyor.com/project/fabpot/symfony/builds/50740552#L1528 Commits ------- e17aad0 harden test to not depend on the system's configured default timezone
2 parents cdc130d + e17aad0 commit e5f794d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/HttpKernel/Tests/HttpCache/ResponseCacheStrategyTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function testMaxAgeUpdatedFromExpiresHeader()
102102
$cacheStrategy = new ResponseCacheStrategy();
103103

104104
$response1 = new Response();
105-
$response1->setExpires(new \DateTime('+ 1 hour'));
105+
$response1->setExpires(new \DateTime('+ 1 hour', new \DateTimeZone('UTC')));
106106
$response1->setPublic();
107107
$cacheStrategy->add($response1);
108108

@@ -112,15 +112,15 @@ public function testMaxAgeUpdatedFromExpiresHeader()
112112

113113
$this->assertSame('3600', $response->headers->getCacheControlDirective('max-age'));
114114
$this->assertNull($response->headers->getCacheControlDirective('s-maxage'));
115-
$this->assertSame((new \DateTime('+ 1 hour'))->format('D, d M Y H:i:s').' GMT', $response->headers->get('Expires'));
115+
$this->assertSame((new \DateTime('+ 1 hour', new \DateTimeZone('UTC')))->format('D, d M Y H:i:s').' GMT', $response->headers->get('Expires'));
116116
}
117117

118118
public function testMaxAgeAndSharedMaxAgeUpdatedFromExpiresHeader()
119119
{
120120
$cacheStrategy = new ResponseCacheStrategy();
121121

122122
$response1 = new Response();
123-
$response1->setExpires(new \DateTime('+ 1 day'));
123+
$response1->setExpires(new \DateTime('+ 1 day', new \DateTimeZone('UTC')));
124124
$response1->setPublic();
125125
$cacheStrategy->add($response1);
126126

@@ -131,7 +131,7 @@ public function testMaxAgeAndSharedMaxAgeUpdatedFromExpiresHeader()
131131

132132
$this->assertSame('3600', $response->headers->getCacheControlDirective('max-age'));
133133
$this->assertSame('86400', $response->headers->getCacheControlDirective('s-maxage'));
134-
$this->assertSame((new \DateTime('+ 1 hour'))->format('D, d M Y H:i:s').' GMT', $response->headers->get('Expires'));
134+
$this->assertSame((new \DateTime('+ 1 hour', new \DateTimeZone('UTC')))->format('D, d M Y H:i:s').' GMT', $response->headers->get('Expires'));
135135
}
136136

137137
public function testMainResponseNotCacheableWhenEmbeddedResponseRequiresValidation()

0 commit comments

Comments
 (0)
0