summaryrefslogtreecommitdiffstats
path: root/1348.patch
blob: 635da1b3dc57d686db0b9244e24ee6fcac97adf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From cd1d5dd8a603eab9e02e331b61aa60e6cf6f8c78 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 10 Nov 2017 11:48:37 +0100
Subject: [PATCH] only test available date range on 32-bit

---
 test/Faker/Provider/fi_FI/PersonTest.php | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/test/Faker/Provider/fi_FI/PersonTest.php b/test/Faker/Provider/fi_FI/PersonTest.php
index 5aefb8584..b979666e9 100644
--- a/test/Faker/Provider/fi_FI/PersonTest.php
+++ b/test/Faker/Provider/fi_FI/PersonTest.php
@@ -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);
         }