forked from fzaninotto/Faker
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timezone() does not respect country code #606
Comments
What is fake()? Please report a valid standalone usecase of Faker |
index.php consists of <?php
require_once './vendor/autoload.php';
$countryCode = 'US';
$faker = new \Faker\Provider\DateTime(new \Faker\Generator());
echo 'This timezone should be in ' . $countryCode. ': `' . $faker::timezone($countryCode) . '`' . PHP_EOL; composer.json consists of {
"require": {
"fakerphp/faker": "^1.21"
}
} Output: $ php index.php
This timezone should be in US: `America/Cuiaba`
$ php index.php
This timezone should be in US: `Europe/Istanbul`
$ php index.php
This timezone should be in US: `Australia/Perth`
$ php index.php
This timezone should be in US: `America/St_Vincent`
$ php index.php
This timezone should be in US: `America/Argentina/Rio_Gallegos`
$ php index.php
This timezone should be in US: `Antarctica/Davis`
$ php index.php
This timezone should be in US: `America/Monterrey`
Change composer.json to {
"require": {
"fakerphp/faker": "dev-jefhar/bugfix-country-timezones"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/jefhar/Faker"
}
]
} Output: $ php index.php
This timezone should be in US: `America/Nome`
$ php index.php
This timezone should be in US: `America/North_Dakota/Center`
$ php index.php
This timezone should be in US: `America/Denver`
$ php index.php
This timezone should be in US: `America/Boise`
$ php index.php
This timezone should be in US: `America/Sitka`
$ php index.php
This timezone should be in US: `America/New_York`
$ php index.php
This timezone should be in US: `America/Indiana/Tell_City` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Faker\Provider\DateTime::timezone()
is missing the optional$countryCode
that is found inFaker\Core\DateTime::timezone()
.This has the effect (in Laravel anyway) that
fake()->timezone('US')
provides a random timezone instead of returning a timezone in the designated country code.Versions
fakerphp/faker
Self-enclosed code snippet for reproduction
Expected output
Actual output
The text was updated successfully, but these errors were encountered: