Skip to content

Commit

Permalink
Normalize keys & csfixer
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsFrank committed Mar 19, 2023
1 parent a0cecdd commit f56d864
Show file tree
Hide file tree
Showing 8 changed files with 1,295 additions and 996 deletions.
498 changes: 249 additions & 249 deletions src/CountryShort/CountryAlpha2.php

Large diffs are not rendered by default.

498 changes: 249 additions & 249 deletions src/CountryShort/CountryAlpha3.php

Large diffs are not rendered by default.

498 changes: 249 additions & 249 deletions src/CountryShort/CountryName.php

Large diffs are not rendered by default.

498 changes: 249 additions & 249 deletions src/CountryShort/CountryNumeric.php

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions tests/Unit/CountryShort/CountryAlpha2Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);

namespace PrinsFrank\Standards\Tests\Unit\CountryShort;

use PHPUnit\Framework\TestCase;
use PrinsFrank\Standards\CountryShort\CountryAlpha2;
use TypeError;

/**
* @coversDefaultClass \PrinsFrank\Standards\CountryShort\CountryAlpha2
*/
class CountryAlpha2Test extends TestCase
{
/**
* @covers ::toISO3166_1_Alpha_3
*/
public function testAllCasesCanBeConvertedToISO3166Alpha3(): void
{
$cases = CountryAlpha2::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Alpha_3();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Alpha_3', $case->name));
}
}
}

/**
* @covers ::toISO3166_1_Numeric
*/
public function testAllCasesCanBeConvertedToISO3166Numeric(): void
{
$cases = CountryAlpha2::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Numeric();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Numeric', $case->name));
}
}
}

/**
* @covers ::toISO3166_Name
*/
public function testAllCasesCanBeConvertedToISO3166Name(): void
{
$cases = CountryAlpha2::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_Name();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Name', $case->name));
}
}
}

/**
* @covers ::lowerCaseValue
*/
public function testLowerCaseValue(): void
{
static::assertSame('af', CountryAlpha2::Afghanistan->lowerCaseValue());
}
}
70 changes: 70 additions & 0 deletions tests/Unit/CountryShort/CountryAlpha3Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);

namespace PrinsFrank\Standards\Tests\Unit\CountryShort;

use PHPUnit\Framework\TestCase;
use PrinsFrank\Standards\CountryShort\CountryAlpha3;
use TypeError;

/**
* @coversDefaultClass \PrinsFrank\Standards\CountryShort\CountryAlpha3
*/
class CountryAlpha3Test extends TestCase
{
/**
* @covers ::toISO3166_1_Alpha_2
*/
public function testAllCasesCanBeConvertedToISO3166Alpha2(): void
{
$cases = CountryAlpha3::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Alpha_2();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Alpha_2', $case->name));
}
}
}

/**
* @covers ::toISO3166_1_Numeric
*/
public function testAllCasesCanBeConvertedToISO3166Numeric(): void
{
$cases = CountryAlpha3::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Numeric();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Numeric', $case->name));
}
}
}

/**
* @covers ::toISO3166_Name
*/
public function testAllCasesCanBeConvertedToISO3166Name(): void
{
$cases = CountryAlpha3::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_Name();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Name', $case->name));
}
}
}

/**
* @covers ::lowerCaseValue
*/
public function testLowerCaseValue(): void
{
static::assertSame('afg', CountryAlpha3::Afghanistan->lowerCaseValue());
}
}
62 changes: 62 additions & 0 deletions tests/Unit/CountryShort/CountryNameTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);

namespace PrinsFrank\Standards\Tests\Unit\CountryShort;

use PHPUnit\Framework\TestCase;
use PrinsFrank\Standards\CountryShort\CountryName;
use TypeError;

/**
* @coversDefaultClass \PrinsFrank\Standards\Country\ISO3166_1_Name
*/
class CountryNameTest extends TestCase
{
/**
* @covers ::toISO3166_1_Alpha_2
*/
public function testAllCasesCanBeConvertedToISO3166Alpha2(): void
{
$cases = CountryName::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Alpha_2();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Alpha_2', $case->name));
}
}
}

/**
* @covers ::toISO3166_1_Alpha_3
*/
public function testAllCasesCanBeConvertedToISO3166Alpha3(): void
{
$cases = CountryName::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Alpha_3();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Alpha_3', $case->name));
}
}
}

/**
* @covers ::toISO3166_1_Numeric
*/
public function testAllCasesCanBeConvertedToISO3166Numeric(): void
{
$cases = CountryName::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Numeric();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Numeric', $case->name));
}
}
}
}
97 changes: 97 additions & 0 deletions tests/Unit/CountryShort/CountryNumericTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php
declare(strict_types=1);

namespace PrinsFrank\Standards\Tests\Unit\CountryShort;

use PHPUnit\Framework\TestCase;
use PrinsFrank\Standards\CountryShort\CountryNumeric;
use TypeError;
use ValueError;

/**
* @coversDefaultClass \PrinsFrank\Standards\CountryShort\CountryNumeric
*/
class CountryNumericTest extends TestCase
{
/**
* @covers ::toISO3166_1_Alpha_2
*/
public function testAllCasesCanBeConvertedToISO3166Alpha2(): void
{
$cases = CountryNumeric::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Alpha_2();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Alpha_2', $case->name));
}
}
}

/**
* @covers ::toISO3166_1_Alpha_3
*/
public function testAllCasesCanBeConvertedToISO3166Alpha3(): void
{
$cases = CountryNumeric::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_1_Alpha_3();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Alpha_3', $case->name));
}
}
}

/**
* @covers ::toISO3166_Name
*/
public function testAllCasesCanBeConvertedToISO3166Name(): void
{
$cases = CountryNumeric::cases();
static::assertNotEmpty($cases);
foreach ($cases as $case) {
try {
$case->toISO3166_Name();
} catch (TypeError) {
$this->fail(sprintf('Case %s could not be converted to ISO3166_1_Name', $case->name));
}
}
}

/**
* @covers ::fromInt
*/
public function testFromInt(): void
{
static::assertEquals(CountryNumeric::Albania, CountryNumeric::fromInt(8));
}

/**
* @covers ::fromInt
*/
public function testFromIntThrowsExceptionOnNonExistingValue(): void
{
$this->expectException(ValueError::class);
static::assertNull(CountryNumeric::fromInt(1));
}

/**
* @covers ::tryFromInt
*/
public function testTryFromInt(): void
{
static::assertEquals(CountryNumeric::Albania, CountryNumeric::tryFromInt(8));
static::assertNull(CountryNumeric::tryFromInt(1));
}

/**
* @covers ::valueAsInt
*/
public function testValueAsInt(): void
{
static::assertSame(4, CountryNumeric::Afghanistan->valueAsInt());
}
}

0 comments on commit f56d864

Please sign in to comment.