Skip to content

Commit 4090d5b

Browse files
committed
Use assertSame instead of assertEquals where applicable
1 parent b0295a5 commit 4090d5b

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,9 +1353,9 @@ public function testEsiCacheIncludesEmbeddedResponseContentWhenMainResponseFails
13531353

13541354
// prime the cache
13551355
$this->request('GET', '/', [], [], true);
1356-
$this->assertEquals(200, $this->response->getStatusCode());
1357-
$this->assertEquals('main embedded', $this->response->getContent());
1358-
$this->assertEquals('Mon, 12 Aug 2024 10:05:00 +0000', $this->response->getLastModified()->format(\DATE_RFC2822)); // max of both values
1356+
$this->assertSame(200, $this->response->getStatusCode());
1357+
$this->assertSame('main embedded', $this->response->getContent());
1358+
$this->assertSame('Mon, 12 Aug 2024 10:05:00 +0000', $this->response->getLastModified()->format(\DATE_RFC2822)); // max of both values
13591359

13601360
$this->setNextResponses([
13611361
[
@@ -1374,16 +1374,16 @@ public function testEsiCacheIncludesEmbeddedResponseContentWhenMainResponseFails
13741374
// Re-request with Last-Modified time that we received when the cache was primed
13751375
$this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => 'Mon, 12 Aug 2024 10:05:00 +0000'], [], true);
13761376

1377-
$this->assertEquals(200, $this->response->getStatusCode());
1377+
$this->assertSame(200, $this->response->getStatusCode());
13781378

13791379
// The cache should use the content ("embedded") from the cached entry
1380-
$this->assertEquals('main embedded', $this->response->getContent());
1380+
$this->assertSame('main embedded', $this->response->getContent());
13811381

13821382
$traces = $this->cache->getTraces();
1383-
$this->assertEquals(['stale', 'invalid', 'store'], $traces['GET /']);
1383+
$this->assertSame(['stale', 'invalid', 'store'], $traces['GET /']);
13841384

13851385
// The embedded resource was still fresh
1386-
$this->assertEquals(['fresh'], $traces['GET /foo']);
1386+
$this->assertSame(['fresh'], $traces['GET /foo']);
13871387
}
13881388

13891389
public function testEsiCacheIncludesEmbeddedResponseContentWhenMainResponseFailsRevalidationAndEmbeddedResponseIsValid()
@@ -1410,9 +1410,9 @@ public function testEsiCacheIncludesEmbeddedResponseContentWhenMainResponseFails
14101410

14111411
// prime the cache
14121412
$this->request('GET', '/', [], [], true);
1413-
$this->assertEquals(200, $this->response->getStatusCode());
1414-
$this->assertEquals('main embedded', $this->response->getContent());
1415-
$this->assertEquals('Mon, 12 Aug 2024 10:05:00 +0000', $this->response->getLastModified()->format(\DATE_RFC2822)); // max of both values
1413+
$this->assertSame(200, $this->response->getStatusCode());
1414+
$this->assertSame('main embedded', $this->response->getContent());
1415+
$this->assertSame('Mon, 12 Aug 2024 10:05:00 +0000', $this->response->getLastModified()->format(\DATE_RFC2822)); // max of both values
14161416

14171417
$this->setNextResponses([
14181418
[
@@ -1439,16 +1439,16 @@ public function testEsiCacheIncludesEmbeddedResponseContentWhenMainResponseFails
14391439
// Re-request with Last-Modified time that we received when the cache was primed
14401440
$this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => 'Mon, 12 Aug 2024 10:05:00 +0000'], [], true);
14411441

1442-
$this->assertEquals(200, $this->response->getStatusCode());
1442+
$this->assertSame(200, $this->response->getStatusCode());
14431443

14441444
// The cache should use the content ("embedded") from the cached entry
1445-
$this->assertEquals('main embedded', $this->response->getContent());
1445+
$this->assertSame('main embedded', $this->response->getContent());
14461446

14471447
$traces = $this->cache->getTraces();
1448-
$this->assertEquals(['stale', 'invalid', 'store'], $traces['GET /']);
1448+
$this->assertSame(['stale', 'invalid', 'store'], $traces['GET /']);
14491449

14501450
// Check that the embedded resource was successfully revalidated
1451-
$this->assertEquals(['stale', 'valid', 'store'], $traces['GET /foo']);
1451+
$this->assertSame(['stale', 'valid', 'store'], $traces['GET /foo']);
14521452
}
14531453

14541454
public function testEsiCacheIncludesEmbeddedResponseContentWhenMainAndEmbeddedResponseAreFresh()
@@ -1475,9 +1475,9 @@ public function testEsiCacheIncludesEmbeddedResponseContentWhenMainAndEmbeddedRe
14751475

14761476
// prime the cache
14771477
$this->request('GET', '/', [], [], true);
1478-
$this->assertEquals(200, $this->response->getStatusCode());
1479-
$this->assertEquals('main embedded', $this->response->getContent());
1480-
$this->assertEquals('Mon, 12 Aug 2024 10:05:00 +0000', $this->response->getLastModified()->format(\DATE_RFC2822));
1478+
$this->assertSame(200, $this->response->getStatusCode());
1479+
$this->assertSame('main embedded', $this->response->getContent());
1480+
$this->assertSame('Mon, 12 Aug 2024 10:05:00 +0000', $this->response->getLastModified()->format(\DATE_RFC2822));
14811481

14821482
// Assume that a client received 'Mon, 12 Aug 2024 10:00:00 +0000' as last-modified information in the past. This may, for example,
14831483
// be the case when the "main" response at that point had an older Last-Modified time, so the embedded response's Last-Modified time
@@ -1486,16 +1486,16 @@ public function testEsiCacheIncludesEmbeddedResponseContentWhenMainAndEmbeddedRe
14861486
// Now this client does a revalidation request.
14871487
$this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => 'Mon, 12 Aug 2024 10:00:00 +0000'], [], true);
14881488

1489-
$this->assertEquals(200, $this->response->getStatusCode());
1489+
$this->assertSame(200, $this->response->getStatusCode());
14901490

14911491
// The cache should use the content ("embedded") from the cached entry
1492-
$this->assertEquals('main embedded', $this->response->getContent());
1492+
$this->assertSame('main embedded', $this->response->getContent());
14931493

14941494
$traces = $this->cache->getTraces();
1495-
$this->assertEquals(['fresh'], $traces['GET /']);
1495+
$this->assertSame(['fresh'], $traces['GET /']);
14961496

14971497
// Check that the embedded resource was successfully revalidated
1498-
$this->assertEquals(['fresh'], $traces['GET /foo']);
1498+
$this->assertSame(['fresh'], $traces['GET /foo']);
14991499
}
15001500

15011501
public function testEsiCacheForceValidation()

0 commit comments

Comments
 (0)