From c54a29a3719b299f47b0a33cf2fd41f49daf8916 Mon Sep 17 00:00:00 2001 From: Peter Date: Tue, 19 Sep 2023 10:13:51 +0800 Subject: [PATCH] Let assertEquals be strict assertSame --- tests/CountryListTest.php | 6 +++--- tests/DataBuilderTest.php | 8 ++++---- tests/DisplayRegionTest.php | 2 +- tests/PrimaryLanguageTest.php | 4 ++-- tests/RegionTest.php | 2 +- tests/VersionTest.php | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/CountryListTest.php b/tests/CountryListTest.php index 4d05f7c..70737d7 100644 --- a/tests/CountryListTest.php +++ b/tests/CountryListTest.php @@ -14,7 +14,7 @@ public function testCountryListForEn(): void $this->assertIsArray($countryList); $this->assertArrayHasKey('GB', $countryList); - $this->assertEquals('United Kingdom', $countryList['GB']); + $this->assertSame('United Kingdom', $countryList['GB']); } public function testCountryListInheriting(): void @@ -24,10 +24,10 @@ public function testCountryListInheriting(): void $this->assertIsArray($countryList); $this->assertArrayHasKey('TA', $countryList); - $this->assertEquals('Tristán da Cunha', $countryList['TA']); + $this->assertSame('Tristán da Cunha', $countryList['TA']); $this->assertArrayHasKey('GB', $countryList); - $this->assertEquals('Reino Unido', $countryList['GB']); + $this->assertSame('Reino Unido', $countryList['GB']); } public function testCountryListForInvalidLocale(): void diff --git a/tests/DataBuilderTest.php b/tests/DataBuilderTest.php index 1a1e5f8..aecd40f 100644 --- a/tests/DataBuilderTest.php +++ b/tests/DataBuilderTest.php @@ -45,7 +45,7 @@ public function testGeneratingData(): string $this->assertFileExists($versionFile); $version = require $versionFile; - $this->assertEquals('1', $version); + $this->assertSame('1', $version); return $outputDir; } @@ -63,10 +63,10 @@ public function testEnglishData(string $outputDir): void $data = require $englishFile; $this->assertArrayHasKey('MFC', $data); - $this->assertEquals('My First Country', $data['MFC']); + $this->assertSame('My First Country', $data['MFC']); $this->assertArrayHasKey('MSC', $data); - $this->assertEquals('My Second Country', $data['MSC']); + $this->assertSame('My Second Country', $data['MSC']); $this->assertArrayNotHasKey('EU', $data, 'EU is part of the ignored region list, so should be ignored'); $this->assertArrayNotHasKey('GB-alt-short', $data, 'GB-alt-short is an alternative name, so should be ignored'); @@ -89,7 +89,7 @@ public function testGBData(string $outputDir): void $this->assertArrayNotHasKey('MFC', $data); $this->assertArrayHasKey('MSC', $data); - $this->assertEquals('My Second Country is different here', $data['MSC']); + $this->assertSame('My Second Country is different here', $data['MSC']); } /** diff --git a/tests/DisplayRegionTest.php b/tests/DisplayRegionTest.php index 73e5f77..28577a5 100644 --- a/tests/DisplayRegionTest.php +++ b/tests/DisplayRegionTest.php @@ -15,7 +15,7 @@ class DisplayRegionTest extends TestCase */ public function testGetDisplayRegion(string $locale, string $inLocale, string $expectedRegion): void { - $this->assertEquals( + $this->assertSame( $expectedRegion, Locale::getDisplayRegion($locale, $inLocale), "getDisplayRegion with $locale and $inLocale" diff --git a/tests/PrimaryLanguageTest.php b/tests/PrimaryLanguageTest.php index 1f2fc92..e3afe2d 100644 --- a/tests/PrimaryLanguageTest.php +++ b/tests/PrimaryLanguageTest.php @@ -14,7 +14,7 @@ class PrimaryLanguageTest extends TestCase */ public function testGetPrimaryLanguage(string $locale, string $language): void { - $this->assertEquals($language, Locale::getPrimaryLanguage($locale)); + $this->assertSame($language, Locale::getPrimaryLanguage($locale)); } /** @@ -249,7 +249,7 @@ public function dataListOfPrimaryLanguages(): array */ public function testUnderscoreOrDash(string $locale, string $language): void { - $this->assertEquals($language, Locale::getPrimaryLanguage($locale)); + $this->assertSame($language, Locale::getPrimaryLanguage($locale)); } /** diff --git a/tests/RegionTest.php b/tests/RegionTest.php index cac37f2..e9b0043 100644 --- a/tests/RegionTest.php +++ b/tests/RegionTest.php @@ -14,7 +14,7 @@ class RegionTest extends TestCase */ public function testGetRegion(string $locale, string $expectedRegion): void { - $this->assertEquals($expectedRegion, Locale::getRegion($locale)); + $this->assertSame($expectedRegion, Locale::getRegion($locale)); } /** diff --git a/tests/VersionTest.php b/tests/VersionTest.php index fbfd3c2..770d47d 100644 --- a/tests/VersionTest.php +++ b/tests/VersionTest.php @@ -26,6 +26,6 @@ public function testGetVersion(): void } $this->assertNotNull($version); - $this->assertEquals($version, Locale::getVersion()); + $this->assertSame($version, Locale::getVersion()); } }