forked from fzaninotto/Faker
-
Notifications
You must be signed in to change notification settings - Fork 360
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
fix e164PhoneNumber to only generate valid phone numbers with valid country codes #264
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7be67d2
fix e164PhoneNumber to only generate valid phone numbers with valid c…
Gummibeer 8eaec61
fix php cs
Gummibeer 0bf80a7
update testcase name
Gummibeer 05d6bfe
add all possible country calling codes
Gummibeer 4fb2363
add en_US/GB specific provider formats
Gummibeer 1f2e9e9
add testcases for specific country providers
Gummibeer 66b14df
fix php cs
Gummibeer 245374e
Merge branch 'main' of https://github.com/FakerPHP/Faker into main
Gummibeer a159368
update regex assertions with E164 compatible regex
Gummibeer ac76e29
test e164 generator multiple times
Gummibeer f93d97b
update comment to explain max string length
Gummibeer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Faker\Test\Provider\de_DE; | ||
|
||
use Faker\Provider\de_DE\PhoneNumber; | ||
use Faker\Test\TestCase; | ||
|
||
/** | ||
* @group legacy | ||
*/ | ||
final class PhoneNumberTest extends TestCase | ||
{ | ||
public function testE164PhoneNumberFormat() | ||
{ | ||
for ($i = 0; $i < 10; ++$i) { | ||
$number = $this->faker->e164PhoneNumber(); | ||
self::assertMatchesRegularExpression('/^\+49\d{1,13}$/', $number); | ||
} | ||
} | ||
|
||
protected function getProviders(): iterable | ||
{ | ||
yield new PhoneNumber($this->faker); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why the calling codes for de_AT and de_CH are missing while de_DE and fr_FR are included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default array is only copied from the linked source above.
There are even more countries missing but I think that this list is big enough for testing and every country provider can define the specific ones.