Skip to content

Commit

Permalink
Merge pull request #25 from peter279k/improve_assert_equals
Browse files Browse the repository at this point in the history
Let assertEquals be strict assertSame
  • Loading branch information
giggsey authored Sep 19, 2023
2 parents a6b33df + c54a29a commit fa131ae
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions tests/CountryListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/DataBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testGeneratingData(): string
$this->assertFileExists($versionFile);
$version = require $versionFile;

$this->assertEquals('1', $version);
$this->assertSame('1', $version);

return $outputDir;
}
Expand All @@ -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');
Expand All @@ -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']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/DisplayRegionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/PrimaryLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down Expand Up @@ -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));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/RegionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/VersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public function testGetVersion(): void
}

$this->assertNotNull($version);
$this->assertEquals($version, Locale::getVersion());
$this->assertSame($version, Locale::getVersion());
}
}

0 comments on commit fa131ae

Please sign in to comment.