-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
I quickly hacked up this to support testing my class that uses DateTime's extensively.
Could it be of interest to others? The function can of course just be copy-pasted straight into the argument generation, but I figured this might help someone else. If only as an issue that be found through searching.
class GeneratorWithDates extends Gen
{
/**
* Generate DateTime objects
*
* @return Generator
*/
public static function dates($from = 1000, $to = 3000)
{
return self::choose($from, to)->map(
function ($i) {
return new DateTime($i);
}
);
}
}
Metadata
Metadata
Assignees
Labels
No labels