From 98f400afc861741492abbe4d0d97caf4035a16c7 Mon Sep 17 00:00:00 2001 From: Francois Zaninotto Date: Fri, 21 Mar 2014 18:22:03 +0100 Subject: [PATCH 1/2] add doc about seeding with maximum timestamp using dateTime formatters --- readme.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/readme.md b/readme.md index 9f2f053f..48d2e8b4 100644 --- a/readme.md +++ b/readme.md @@ -370,6 +370,13 @@ $faker->seed(1234); echo $faker->name; // 'Jess Mraz I'; ``` +> **Tip**: DateTime formatters won't reproduce the same fake data if you don't fix the `$max` value: +> +> // even when seeded, this line will return different results because $max varies +> $faker->dateTime(); // equivalent to $faker->dateTime($max = 'now') +> // make sure you fix the $max parameter +> $faker->dateTime('2014-02-25 08:37:17'); // will return always the same date when seeded + ## Faker Internals: Understanding Providers A `Faker\Generator` alone can't do much generation. It needs `Faker\Provider` objects to delegate the data generation to them. `Faker\Factory::create()` actually creates a `Faker\Generator` bundled with the default providers. Here is what happens under the hood: From 3da8c930ed95f37f8aef6d62b22138004ada08ae Mon Sep 17 00:00:00 2001 From: Francois Zaninotto Date: Fri, 21 Mar 2014 18:25:22 +0100 Subject: [PATCH 2/2] Fix code highlighting --- readme.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 48d2e8b4..71c0dd7e 100644 --- a/readme.md +++ b/readme.md @@ -372,10 +372,12 @@ echo $faker->name; // 'Jess Mraz I'; > **Tip**: DateTime formatters won't reproduce the same fake data if you don't fix the `$max` value: > -> // even when seeded, this line will return different results because $max varies -> $faker->dateTime(); // equivalent to $faker->dateTime($max = 'now') -> // make sure you fix the $max parameter -> $faker->dateTime('2014-02-25 08:37:17'); // will return always the same date when seeded +> ```php +> // even when seeded, this line will return different results because $max varies +> $faker->dateTime(); // equivalent to $faker->dateTime($max = 'now') +> // make sure you fix the $max parameter +> $faker->dateTime('2014-02-25 08:37:17'); // will return always the same date when seeded ## Faker Internals: Understanding Providers