Skip to content

Commit 4ace472

Browse files
committed
minor #37784 PHPUnit's assertContains() performs strict comparisons (derrabus)
This PR was merged into the 3.4 branch. Discussion ---------- PHPUnit's assertContains() performs strict comparisons | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Part of #37564 | License | MIT | Doc PR | N/A In PHPUnit 9.3, `assertContains()` performs a strict comparison which causes a few test failures in our test suite. This PR should fix them. Commits ------- 9f4dec5 PHPUnit's assertContains() performs strict comparisons now.
2 parents 1dcb67e + 9f4dec5 commit 4ace472

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testCollect()
5151
$this->assertEquals(['name' => 'foo'], $c->getRouteParams());
5252
$this->assertSame([], $c->getSessionAttributes());
5353
$this->assertSame('en', $c->getLocale());
54-
$this->assertContains(__FILE__, $attributes->get('resource'));
54+
$this->assertContainsEquals(__FILE__, $attributes->get('resource'));
5555
$this->assertSame('stdClass', $attributes->get('object')->getType());
5656

5757
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getResponseHeaders());

src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ public function testStatusCode()
293293

294294
$tokens = $this->storage->find('', '', 10, '');
295295
$this->assertCount(2, $tokens);
296-
$this->assertContains($tokens[0]['status_code'], [200, 404]);
297-
$this->assertContains($tokens[1]['status_code'], [200, 404]);
296+
$this->assertContains((int) $tokens[0]['status_code'], [200, 404]);
297+
$this->assertContains((int) $tokens[1]['status_code'], [200, 404]);
298298
}
299299

300300
public function testMultiRowIndexFile()

src/Symfony/Component/Translation/Tests/TranslatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,12 @@ public function testFallbackCatalogueResources()
319319

320320
$resources = $translator->getCatalogue('en')->getResources();
321321
$this->assertCount(1, $resources);
322-
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
322+
$this->assertContainsEquals(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
323323

324324
$resources = $translator->getCatalogue('en_GB')->getResources();
325325
$this->assertCount(2, $resources);
326-
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'empty.yml', $resources);
327-
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
326+
$this->assertContainsEquals(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'empty.yml', $resources);
327+
$this->assertContainsEquals(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
328328
}
329329

330330
/**

0 commit comments

Comments
 (0)