Skip to content

Commit

Permalink
Added the EuropeanUnion::isNotAMemberState() method
Browse files Browse the repository at this point in the history
  • Loading branch information
fulopattila122 committed Apr 3, 2024
1 parent bd8463c commit 653e7d8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Address Module Changelog

## Unreleased
##### 2024-XX-YY

- Added the `EuropeanUnion::isNotAMemberState()` method

## 3.1.0
##### 2024-03-11

Expand Down
5 changes: 5 additions & 0 deletions src/Utils/EuropeanUnion.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ public static function isMemberState(string $countryCode, string|DateTimeInterfa

return null === $member['left'] || $at->isBefore(Date::parse($member['left']));
}

public static function isNotAMemberState(string $countryCode, string|DateTimeInterface $at = null): bool
{
return !self::isMemberState($countryCode, $at);
}
}
14 changes: 14 additions & 0 deletions tests/EuropeanUnionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,18 @@ public function is_member_state_test(string $country, string|null $date, bool $i
sprintf('%s should %sbe the member of the EU on %s', $country, $isMember ? '' : 'not ', $date)
);
}

/**
* @test
* @dataProvider memberStateProvider
*/
public function is_not_member_state_tests(string $country, string|null $date, bool $isMember): void
{
$this->assertEquals(
!$isMember,
EuropeanUnion::isNotAMemberState($country, $date),
sprintf('%s should %sbe the member of the EU on %s', $country, $isMember ? '' : 'not ', $date)
);

}
}

0 comments on commit 653e7d8

Please sign in to comment.