Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
only test available date range on 32-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Nov 10, 2017
1 parent 910a79d commit cd1d5dd
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions test/Faker/Provider/fi_FI/PersonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,25 @@ public function testPersonalIdentityNumberUsesBirthDateIfProvided($seed, $birthd

public function testPersonalIdentityNumberGeneratesCompliantNumbers()
{
for ($i = 0; $i < 10; $i++) {
$birthdate = $this->faker->dateTimeBetween('1800-01-01 00:00:00', '1899-12-31 23:59:59');
$pin = $this->faker->personalIdentityNumber($birthdate);
$this->assertRegExp('/^[0-9]{6}\+[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin);
if (strtotime('1800-01-01 00:00:00')) {
$min="1900";
$max="2099";
for ($i = 0; $i < 10; $i++) {
$birthdate = $this->faker->dateTimeBetween('1800-01-01 00:00:00', '1899-12-31 23:59:59');
$pin = $this->faker->personalIdentityNumber($birthdate, NULL, true);
$this->assertRegExp('/^[0-9]{6}\+[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin);
}
} else { // timestamp limit for 32-bit computer
$min="1902";
$max="2037";
}
for ($i = 0; $i < 10; $i++) {
$birthdate = $this->faker->dateTimeBetween('1900-01-01 00:00:00', '1999-12-31 23:59:59');
$birthdate = $this->faker->dateTimeBetween("$min-01-01 00:00:00", '1999-12-31 23:59:59');
$pin = $this->faker->personalIdentityNumber($birthdate);
$this->assertRegExp('/^[0-9]{6}-[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin);
}
for ($i = 0; $i < 10; $i++) {
$birthdate = $this->faker->dateTimeBetween('2000-01-01 00:00:00', '2099-12-31 23:59:59');
$birthdate = $this->faker->dateTimeBetween('2000-01-01 00:00:00', "$max-12-31 23:59:59");
$pin = $this->faker->personalIdentityNumber($birthdate);
$this->assertRegExp('/^[0-9]{6}A[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin);
}
Expand Down

0 comments on commit cd1d5dd

Please sign in to comment.