updated backend
This commit is contained in:
parent
1fea0f4fe7
commit
11521c2339
3459 changed files with 72735 additions and 168535 deletions
2
pfosten/vendor/fzaninotto/faker/.gitignore
vendored
2
pfosten/vendor/fzaninotto/faker/.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
|||
vendor
|
||||
composer.lock
|
||||
25
pfosten/vendor/fzaninotto/faker/.travis.yml
vendored
25
pfosten/vendor/fzaninotto/faker/.travis.yml
vendored
|
|
@ -1,25 +0,0 @@
|
|||
language: php
|
||||
|
||||
dist: precise
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- nightly
|
||||
|
||||
sudo: false
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
before_script:
|
||||
- travis_retry composer self-update
|
||||
- travis_retry composer install --no-interaction --prefer-dist
|
||||
|
||||
script: make sniff test
|
||||
145
pfosten/vendor/fzaninotto/faker/CHANGELOG.md
vendored
145
pfosten/vendor/fzaninotto/faker/CHANGELOG.md
vendored
|
|
@ -1,8 +1,120 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
# CHANGELOG
|
||||
|
||||
2018-07-12, v1.8.0
|
||||
------------------
|
||||
## 2019-12-03, v1.9.1
|
||||
|
||||
- Add link to PHPStan extension to readme [\#1834](https://github.com/fzaninotto/Faker/pull/1834) ([finwe](https://github.com/finwe))
|
||||
- Enhancement: Collect code coverage [\#1824](https://github.com/fzaninotto/Faker/pull/1824) ([localheinz](https://github.com/localheinz))
|
||||
- Enhancement: Use all columns when running tests [\#1823](https://github.com/fzaninotto/Faker/pull/1823) ([localheinz](https://github.com/localheinz))
|
||||
- Enhancement: Configure verbose output via phpunit.xml.dist [\#1822](https://github.com/fzaninotto/Faker/pull/1822) ([localheinz](https://github.com/localheinz))
|
||||
- Curly braces for arrays is deprecated in PHP 7.4 [\#1843](https://github.com/fzaninotto/Faker/pull/1843) ([wimg](https://github.com/wimg))
|
||||
- Fix: Reduce visibility of setUp\(\) and tearDown\(\) [\#1821](https://github.com/fzaninotto/Faker/pull/1821) ([localheinz](https://github.com/localheinz))
|
||||
- Fix: Mark test classes as final [\#1820](https://github.com/fzaninotto/Faker/pull/1820) ([localheinz](https://github.com/localheinz))
|
||||
- Fix: Remove unnecessary class-level DocBlocks [\#1819](https://github.com/fzaninotto/Faker/pull/1819) ([localheinz](https://github.com/localheinz))
|
||||
|
||||
## 2019-11-10, v1.9.0
|
||||
|
||||
This will the last minor release in the `1.x` cycle.
|
||||
|
||||
- Add all Iran's provinces land lines numbers [\#1806](https://github.com/fzaninotto/Faker/pull/1806) ([kingofnull](https://github.com/kingofnull))
|
||||
- replace latin "B" to cyrillic "B" for uk\_UA locale [\#1800](https://github.com/fzaninotto/Faker/pull/1800) ([FI-LIFE](https://github.com/FI-LIFE))
|
||||
- Add elgentos/masquerade to third-party library list [\#1798](https://github.com/fzaninotto/Faker/pull/1798) ([erikhansen](https://github.com/erikhansen))
|
||||
- Add link to Gravatar provider repository [\#1796](https://github.com/fzaninotto/Faker/pull/1796) ([ottaviano](https://github.com/ottaviano))
|
||||
- Add mobileNumber\(\) method for nb\_NO [\#1788](https://github.com/fzaninotto/Faker/pull/1788) ([carestad](https://github.com/carestad))
|
||||
- Enhancement: Slightly clean up Company provider [\#1783](https://github.com/fzaninotto/Faker/pull/1783) ([localheinz](https://github.com/localheinz))
|
||||
- Added some more information for autoloading in the readme [\#1780](https://github.com/fzaninotto/Faker/pull/1780) ([pimjansen](https://github.com/pimjansen))
|
||||
- Enhancement: Add issue template for bug report [\#1779](https://github.com/fzaninotto/Faker/pull/1779) ([localheinz](https://github.com/localheinz))
|
||||
- Add hslColor to ColorProvider [\#1776](https://github.com/fzaninotto/Faker/pull/1776) ([icanhazstring](https://github.com/icanhazstring))
|
||||
- Enhancement: Consistently use composer package name for link content [\#1770](https://github.com/fzaninotto/Faker/pull/1770) ([localheinz](https://github.com/localheinz))
|
||||
- Add Correct Thai words for streets,soi etc names and add Thai First a… [\#1769](https://github.com/fzaninotto/Faker/pull/1769) ([pierrejoye](https://github.com/pierrejoye))
|
||||
- Enhancement: Assert that postcode generated by Austrian Address provider matches format [\#1766](https://github.com/fzaninotto/Faker/pull/1766) ([localheinz](https://github.com/localheinz))
|
||||
- Enhancement: Update squizlabs/php\_codesniffer [\#1763](https://github.com/fzaninotto/Faker/pull/1763) ([localheinz](https://github.com/localheinz))
|
||||
- Enhancement: Assert that imageUrl can be used with gray flag [\#1762](https://github.com/fzaninotto/Faker/pull/1762) ([localheinz](https://github.com/localheinz))
|
||||
- Enhancement: Introduce build and help targets [\#1761](https://github.com/fzaninotto/Faker/pull/1761) ([localheinz](https://github.com/localheinz))
|
||||
- Enhancement: Disable Xdebug as early as possible [\#1758](https://github.com/fzaninotto/Faker/pull/1758) ([localheinz](https://github.com/localheinz))
|
||||
- Enhancement: Clean up .gitattributes [\#1756](https://github.com/fzaninotto/Faker/pull/1756) ([localheinz](https://github.com/localheinz))
|
||||
- Enhancement: Reference phpunit.xsd as installed with composer [\#1755](https://github.com/fzaninotto/Faker/pull/1755) ([localheinz](https://github.com/localheinz))
|
||||
- add id\_ID Color [\#1754](https://github.com/fzaninotto/Faker/pull/1754) ([cacing69](https://github.com/cacing69))
|
||||
- PHP 7.4 compatibility [\#1748](https://github.com/fzaninotto/Faker/pull/1748) ([pimjansen](https://github.com/pimjansen))
|
||||
- Add lastName gender specific on ru\_RU locale [\#1747](https://github.com/fzaninotto/Faker/pull/1747) ([aanfarhan](https://github.com/aanfarhan))
|
||||
- Update README - Add a new faker. [\#1731](https://github.com/fzaninotto/Faker/pull/1731) ([drupol](https://github.com/drupol))
|
||||
- Add faker-eddy-malou third-party library [\#1717](https://github.com/fzaninotto/Faker/pull/1717) ([Metrakit](https://github.com/Metrakit))
|
||||
- \[de\_DE\] Company\JobTitle: list of common german job titles [\#1716](https://github.com/fzaninotto/Faker/pull/1716) ([amacado](https://github.com/amacado))
|
||||
- Added 'red' to $safeColorNames [\#1701](https://github.com/fzaninotto/Faker/pull/1701) ([xfudox](https://github.com/xfudox))
|
||||
- \[pt\_PT/Address\] Add abbreviature to 'travessa' and 'largo' [\#1606](https://github.com/fzaninotto/Faker/pull/1606) ([simaolemos](https://github.com/simaolemos))
|
||||
- Fix method name for en\_NZ provider in readme [\#1595](https://github.com/fzaninotto/Faker/pull/1595) ([gdhnz](https://github.com/gdhnz))
|
||||
- Refactoring of the TextTest class [\#1590](https://github.com/fzaninotto/Faker/pull/1590) ([stevegrunwell](https://github.com/stevegrunwell))
|
||||
- add gender variants for last name \[lt\_LT\] [\#1586](https://github.com/fzaninotto/Faker/pull/1586) ([ikerasLT](https://github.com/ikerasLT))
|
||||
- add .id TLD [\#1566](https://github.com/fzaninotto/Faker/pull/1566) ([ad3n](https://github.com/ad3n))
|
||||
- Add Color provider to es\_ES locale [\#1559](https://github.com/fzaninotto/Faker/pull/1559) ([juananruiz](https://github.com/juananruiz))
|
||||
- Enhancement: Keep packages sorted in composer.json [\#1551](https://github.com/fzaninotto/Faker/pull/1551) ([localheinz](https://github.com/localheinz))
|
||||
- Portuguese providers for Companies and Internet [\#1537](https://github.com/fzaninotto/Faker/pull/1537) ([promatik](https://github.com/promatik))
|
||||
- Improve Dutch company names [\#1529](https://github.com/fzaninotto/Faker/pull/1529) ([koole](https://github.com/koole))
|
||||
- Document randomDigitNot base formatter. [\#1514](https://github.com/fzaninotto/Faker/pull/1514) ([shawnlindstrom](https://github.com/shawnlindstrom))
|
||||
- Estonian names [\#1461](https://github.com/fzaninotto/Faker/pull/1461) ([much-rebel](https://github.com/much-rebel))
|
||||
- add birthplace support for ID nik generator [\#1451](https://github.com/fzaninotto/Faker/pull/1451) ([mikk150](https://github.com/mikk150))
|
||||
- List of banks in Brazil added [\#1427](https://github.com/fzaninotto/Faker/pull/1427) ([diegohenicka](https://github.com/diegohenicka))
|
||||
- Remove last names from the male first names array \(et\_EE\) [\#1799](https://github.com/fzaninotto/Faker/pull/1799) ([Mihkel100](https://github.com/Mihkel100))
|
||||
- Update out-of-date currency codes [\#1795](https://github.com/fzaninotto/Faker/pull/1795) ([Brindster](https://github.com/Brindster))
|
||||
- Floor is not always returning an int [\#1790](https://github.com/fzaninotto/Faker/pull/1790) ([pimjansen](https://github.com/pimjansen))
|
||||
- typo [\#1789](https://github.com/fzaninotto/Faker/pull/1789) ([enumag](https://github.com/enumag))
|
||||
- Added batch inserts for doctrine orm populate [\#1781](https://github.com/fzaninotto/Faker/pull/1781) ([pimjansen](https://github.com/pimjansen))
|
||||
- FIx: Avoid deprecation warning in newer CakePHP version [\#1777](https://github.com/fzaninotto/Faker/pull/1777) ([icanhazstring](https://github.com/icanhazstring))
|
||||
- Fix: Consistently link to GitHub repositories [\#1774](https://github.com/fzaninotto/Faker/pull/1774) ([localheinz](https://github.com/localheinz))
|
||||
- Fix: Name of package [\#1772](https://github.com/fzaninotto/Faker/pull/1772) ([localheinz](https://github.com/localheinz))
|
||||
- Remove BV and HM country codes. [\#1767](https://github.com/fzaninotto/Faker/pull/1767) ([oliverpool](https://github.com/oliverpool))
|
||||
- Fix: Remove sudo configuration [\#1760](https://github.com/fzaninotto/Faker/pull/1760) ([localheinz](https://github.com/localheinz))
|
||||
- Fix: Allow nightly builds to fail [\#1759](https://github.com/fzaninotto/Faker/pull/1759) ([localheinz](https://github.com/localheinz))
|
||||
- Fix: No need to update composer itself [\#1757](https://github.com/fzaninotto/Faker/pull/1757) ([localheinz](https://github.com/localheinz))
|
||||
- duplicate first name and last name removal [\#1729](https://github.com/fzaninotto/Faker/pull/1729) ([sagautam5](https://github.com/sagautam5))
|
||||
- Fix-Isreal--Israel [\#1724](https://github.com/fzaninotto/Faker/pull/1724) ([GitEvil](https://github.com/GitEvil))
|
||||
- fix\(issue-1721\): add phpdoc method and properties annotations for php… [\#1722](https://github.com/fzaninotto/Faker/pull/1722) ([lugus](https://github.com/lugus))
|
||||
- Typo in function PHPDoc [\#1711](https://github.com/fzaninotto/Faker/pull/1711) ([Dzhuneyt](https://github.com/Dzhuneyt))
|
||||
- Fix: Add allowed type DateTime to param annotation [\#1697](https://github.com/fzaninotto/Faker/pull/1697) ([localheinz](https://github.com/localheinz))
|
||||
- Calling a non static method as static not allowed. [\#1696](https://github.com/fzaninotto/Faker/pull/1696) ([wilco-1985](https://github.com/wilco-1985))
|
||||
- Bug Fix en\_SG mobile number generation [\#1658](https://github.com/fzaninotto/Faker/pull/1658) ([ziming](https://github.com/ziming))
|
||||
- Update ja\_JP Address Provider [\#1649](https://github.com/fzaninotto/Faker/pull/1649) ([atmngw](https://github.com/atmngw))
|
||||
- Fixed realText on ja\_JP locale broken, /u missing [\#1634](https://github.com/fzaninotto/Faker/pull/1634) ([mihit](https://github.com/mihit))
|
||||
- Removed comma and space from $firstNameMale for en\_IN [\#1608](https://github.com/fzaninotto/Faker/pull/1608) ([phpspider](https://github.com/phpspider))
|
||||
- Prevent Transliterator class autoloading [\#1575](https://github.com/fzaninotto/Faker/pull/1575) ([MontealegreLuis](https://github.com/MontealegreLuis))
|
||||
- building numbers in Germany never start with a zero or are zero [\#1530](https://github.com/fzaninotto/Faker/pull/1530) ([fostam](https://github.com/fostam))
|
||||
- Fixing sk\_SK men last names set [\#1459](https://github.com/fzaninotto/Faker/pull/1459) ([pavoltanuska](https://github.com/pavoltanuska))
|
||||
- Taiwan ID. The initial letter must be a capital letter. p-\>P [\#1434](https://github.com/fzaninotto/Faker/pull/1434) ([slawa-dev](https://github.com/slawa-dev))
|
||||
- Revert "Added 'red' to $safeColorNames" [\#1778](https://github.com/fzaninotto/Faker/pull/1778) ([fzaninotto](https://github.com/fzaninotto))
|
||||
- Added realText capability for fr\_CA [\#1686](https://github.com/fzaninotto/Faker/pull/1686) ([bobanum](https://github.com/bobanum))
|
||||
- Add loremflickr.com Provider to the thrid parties [\#1683](https://github.com/fzaninotto/Faker/pull/1683) ([xvladxtremal](https://github.com/xvladxtremal))
|
||||
- Add Undeclared Faker Instance to PhoneNumber Test in en\_NG [\#1682](https://github.com/fzaninotto/Faker/pull/1682) ([thearsalan](https://github.com/thearsalan))
|
||||
- PSR-2 updates to readme [\#1679](https://github.com/fzaninotto/Faker/pull/1679) ([b3none](https://github.com/b3none))
|
||||
- PHPDoc for `passthrough` function on Generator [\#1678](https://github.com/fzaninotto/Faker/pull/1678) ([tabakhase](https://github.com/tabakhase))
|
||||
- Make en\_CA Phone Provider Extend the en\_US One [\#1676](https://github.com/fzaninotto/Faker/pull/1676) ([darrylhein](https://github.com/darrylhein))
|
||||
- Add Valid National Code Generator to fa\_IR Person [\#1675](https://github.com/fzaninotto/Faker/pull/1675) ([thearsalan](https://github.com/thearsalan))
|
||||
- Updated readme.md: added a missing backslash [\#1673](https://github.com/fzaninotto/Faker/pull/1673) ([aubryfr](https://github.com/aubryfr))
|
||||
- Add 'Faker\Provider\en\_US\Company::catchPhrase' to ru\_RU locale [\#1668](https://github.com/fzaninotto/Faker/pull/1668) ([axklim](https://github.com/axklim))
|
||||
- Update deprecated \PHPUnit\_Framework\_TestCase with PHPUnit\Framework\TestCase [\#1664](https://github.com/fzaninotto/Faker/pull/1664) ([thewhit](https://github.com/thewhit))
|
||||
- Support populating Doctrine's immutable date types [\#1639](https://github.com/fzaninotto/Faker/pull/1639) ([voronkovich](https://github.com/voronkovich))
|
||||
- add titleMale and titleFemale method to all Person classes [\#1635](https://github.com/fzaninotto/Faker/pull/1635) ([RiverDanceGit](https://github.com/RiverDanceGit))
|
||||
- Minor typo fix [\#1631](https://github.com/fzaninotto/Faker/pull/1631) ([nhedger](https://github.com/nhedger))
|
||||
- Add link to er1z/fakemock [\#1622](https://github.com/fzaninotto/Faker/pull/1622) ([er1z](https://github.com/er1z))
|
||||
- Add Dutch \(nl\_NL\) job titles [\#1618](https://github.com/fzaninotto/Faker/pull/1618) ([SjorsO](https://github.com/SjorsO))
|
||||
- Exclude files and folder from release archive [\#1617](https://github.com/fzaninotto/Faker/pull/1617) ([ankurk91](https://github.com/ankurk91))
|
||||
- Update doc block [\#1615](https://github.com/fzaninotto/Faker/pull/1615) ([ankurk91](https://github.com/ankurk91))
|
||||
- Suggest PSR-4 compliant autoloader in comment [\#1614](https://github.com/fzaninotto/Faker/pull/1614) ([samnela](https://github.com/samnela))
|
||||
- Fix dateTimeBetween\(\) Argument on Generator phpdoc [\#1583](https://github.com/fzaninotto/Faker/pull/1583) ([hisomura](https://github.com/hisomura))
|
||||
- Fix Dutch typo [\#1580](https://github.com/fzaninotto/Faker/pull/1580) ([gizburdt](https://github.com/gizburdt))
|
||||
- Old city names changed to new ones [\#1578](https://github.com/fzaninotto/Faker/pull/1578) ([goszowski](https://github.com/goszowski))
|
||||
- Correct documentation [\#1571](https://github.com/fzaninotto/Faker/pull/1571) ([rquadling](https://github.com/rquadling))
|
||||
- Make $suffix protected not private in nl\_NL\Person provider [\#1561](https://github.com/fzaninotto/Faker/pull/1561) ([SpadXIII](https://github.com/SpadXIII))
|
||||
- Add PicsumPhotos Provider to the thrid parties [\#1560](https://github.com/fzaninotto/Faker/pull/1560) ([bluemmb](https://github.com/bluemmb))
|
||||
- fix austrian postal codes starting with invalid 0 [\#1545](https://github.com/fzaninotto/Faker/pull/1545) ([mpge](https://github.com/mpge))
|
||||
- Restore a random seed when the Generator is destroyed [\#1534](https://github.com/fzaninotto/Faker/pull/1534) ([lyrixx](https://github.com/lyrixx))
|
||||
- Add a swiss social security number \(AVS13\) generator [\#1533](https://github.com/fzaninotto/Faker/pull/1533) ([nhedger](https://github.com/nhedger))
|
||||
- Small tweaks [\#1526](https://github.com/fzaninotto/Faker/pull/1526) ([carusogabriel](https://github.com/carusogabriel))
|
||||
- fix ukraine first name person, delete space [\#1525](https://github.com/fzaninotto/Faker/pull/1525) ([Yasuslik](https://github.com/Yasuslik))
|
||||
- Removed unknown postcode [\#1440](https://github.com/fzaninotto/Faker/pull/1440) ([ayanozturk](https://github.com/ayanozturk))
|
||||
- Add more PhoneNumber options for es\_ES [\#1219](https://github.com/fzaninotto/Faker/pull/1219) ([driade](https://github.com/driade))
|
||||
- Fix duplication in uk\_UA male first names [\#1214](https://github.com/fzaninotto/Faker/pull/1214) ([fre5h](https://github.com/fre5h))
|
||||
- Added missing grayscale option/flag to Image provider [\#928](https://github.com/fzaninotto/Faker/pull/928) ([sebastianvilla](https://github.com/sebastianvilla))
|
||||
|
||||
## 2018-07-12, v1.8.0
|
||||
|
||||
- Typo in readme [\#1521](https://github.com/fzaninotto/Faker/pull/1521) ([jmhobbs](https://github.com/jmhobbs))
|
||||
- Replaced Hilll with Hill [\#1516](https://github.com/fzaninotto/Faker/pull/1516) ([MarkVaughn](https://github.com/MarkVaughn))
|
||||
|
|
@ -81,8 +193,7 @@ CHANGELOG
|
|||
- Added idNumber for nl\_NL [\#1283](https://github.com/fzaninotto/Faker/pull/1283) ([artorozenga](https://github.com/artorozenga))
|
||||
- Feature/en us company ein [\#1273](https://github.com/fzaninotto/Faker/pull/1273) ([zachflower](https://github.com/zachflower))
|
||||
|
||||
2017-08-15, v1.7.0
|
||||
------------------
|
||||
## 2017-08-15, v1.7.0
|
||||
|
||||
- Added more Ukrainian banks [\#1271](https://github.com/fzaninotto/Faker/pull/1271) ([iamraccoon](https://github.com/iamraccoon))
|
||||
- Hotfix/failing unit tests [\#1269](https://github.com/fzaninotto/Faker/pull/1269) ([zachflower](https://github.com/zachflower))
|
||||
|
|
@ -215,8 +326,7 @@ CHANGELOG
|
|||
- Fix Doctrine ODM Support [\#489](https://github.com/fzaninotto/Faker/pull/489) ([cbourgois](https://github.com/cbourgois))
|
||||
|
||||
|
||||
2016-04-29, v1.6.0
|
||||
------------------
|
||||
## 2016-04-29, v1.6.0
|
||||
|
||||
- Remove parts of the Hungarian (hu\_HU) address formatters [\#902](https://github.com/fzaninotto/Faker/pull/902) ([fzaninotto](https://github.com/fzaninotto))
|
||||
- Renamed norwegian (nb\_NO) locale [\#901](https://github.com/fzaninotto/Faker/pull/901) ([fzaninotto](https://github.com/fzaninotto))
|
||||
|
|
@ -347,8 +457,7 @@ CHANGELOG
|
|||
- Updated `optional` and `boolean` apis to be more consistent [\#513](https://github.com/fzaninotto/Faker/pull/513) ([EmanueleMinotto](https://github.com/EmanueleMinotto))
|
||||
- Added Greek (el\_GR) `Address` provider [\#504](https://github.com/fzaninotto/Faker/pull/504) ([drakakisgeo](https://github.com/drakakisgeo))
|
||||
|
||||
2015-05-29, v1.5.0
|
||||
------------------
|
||||
## 2015-05-29, v1.5.0
|
||||
|
||||
* Added ability to print custom text on the images fetched by the Image provider [\#583](https://github.com/fzaninotto/Faker/pull/583) ([fzaninotto](https://github.com/fzaninotto))
|
||||
* Fixed typos in Peruvian (es\_PE) Person provider [\#581](https://github.com/fzaninotto/Faker/pull/581) [\#580](https://github.com/fzaninotto/Faker/pull/580) ([ysramirez](https://github.com/ysramirez))
|
||||
|
|
@ -458,8 +567,7 @@ CHANGELOG
|
|||
* Added English for New Zealand (en\_NZ) locale [\#283](https://github.com/fzaninotto/Faker/pull/283) ([JasonMortonNZ](https://github.com/JasonMortonNZ))
|
||||
* Added mention of external Provider for cron expressions to readme[\#498](https://github.com/fzaninotto/Faker/pull/498) ([swekaj](https://github.com/swekaj))
|
||||
|
||||
2014-06-04, v1.4.0
|
||||
------------------
|
||||
## 2014-06-04, v1.4.0
|
||||
|
||||
* Fixed typo in Slovak person names (cinan)
|
||||
* Added tests for uk_UA providers (serge-kuharev)
|
||||
|
|
@ -522,8 +630,7 @@ CHANGELOG
|
|||
* Added 'kana' (ja_JP) name formatters (kzykhys)
|
||||
* Added allow_failure for hhvm to travis-ci and test against php 5.5 (toin0u)
|
||||
|
||||
2013-12-16, v1.3.0
|
||||
------------------
|
||||
## 2013-12-16, v1.3.0
|
||||
|
||||
* Fixed state generator in Australian (en_AU) provider (sebklaus)
|
||||
* Fixed IDE insights for locale specific providers (ulrikjohansson)
|
||||
|
|
@ -570,9 +677,7 @@ CHANGELOG
|
|||
* Added Color provider with hexColor, rgbColor, rgbColorAsArray, rgbCssColor, safeColorName, and colorName formatters (lsv)
|
||||
* Added support for associative arrays in `randomElement` (aRn0D)
|
||||
|
||||
|
||||
2013-06-09, v1.2.0
|
||||
------------------
|
||||
## 2013-06-09, v1.2.0
|
||||
|
||||
* Added new provider for fr_BE locale (jflefebvre)
|
||||
* Updated locale provider to use a static locale list (spawn-guy)
|
||||
|
|
@ -617,8 +722,7 @@ CHANGELOG
|
|||
* Fixed bug in Doctrine EntityPopulator (beberlei)
|
||||
* Added Finnish (fi_FI) provider (drodil)
|
||||
|
||||
2012-10-29, v1.1.0
|
||||
------------------
|
||||
## 2012-10-29, v1.1.0
|
||||
|
||||
* Updated text provider to return paragraphs as a string instead of array. Great for populating markdown textarea fields (Seldaek)
|
||||
* Updated dateTimeBetween to accept DateTime instances (Seldaek)
|
||||
|
|
@ -635,7 +739,6 @@ CHANGELOG
|
|||
* Added latitude and longitude formatters to Address provider (fixe)
|
||||
* Added Serbian provider (umpirsky)
|
||||
|
||||
2012-07-10, v1.0.0
|
||||
-----------------
|
||||
## 2012-07-10, v1.0.0
|
||||
|
||||
* Initial Version
|
||||
|
|
|
|||
22
pfosten/vendor/fzaninotto/faker/CONTRIBUTING.md
vendored
22
pfosten/vendor/fzaninotto/faker/CONTRIBUTING.md
vendored
|
|
@ -1,22 +0,0 @@
|
|||
Contributing
|
||||
============
|
||||
|
||||
If you've written a new formatter, adapted Faker to a new locale, or fixed a bug, your contribution is welcome!
|
||||
|
||||
Before proposing a pull request, check the following:
|
||||
|
||||
* Your code should follow the [PSR-2 coding standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). Run `make sniff` to check that the coding standards are followed, and use [php-cs-fixer](https://github.com/fabpot/PHP-CS-Fixer) to fix inconsistencies.
|
||||
* Unit tests should still pass after your patch. Run the tests on your dev server (with `make test`) or check the continuous integration status for your pull request.
|
||||
* As much as possible, add unit tests for your code
|
||||
* Never use `rand()` in your providers. Faker uses the Mersenne Twister Randomizer, so use `mt_rand()` or any of the base generators (`randomNumber`, `randomElement`, etc.) instead.
|
||||
* If you add new providers (or new locales) and that they embed a lot of data for random generation (e.g. first names in a new language), please add a `@link` to the reference you used for this list (example [in the ru_RU locale](https://github.com/fzaninotto/Faker/blob/master/src/Faker/Provider/ru_RU/Person.php#L13)). This will ease future updates of the list and debates about the most relevant data for this provider.
|
||||
* If you add long list of random data, please split the list into several lines. This makes diffs easier to read, and facilitates core review.
|
||||
* If you add new formatters, please include documentation for it in the README. Don't forget to add a line about new formatters in the `@property` or `@method` phpDoc entries in [Generator.php](https://github.com/fzaninotto/Faker/blob/master/src/Faker/Generator.php#L6-L118) to help IDEs auto-complete your formatters.
|
||||
* If your new formatters are specific to a certain locale, document them in the [Language-specific formatters](https://github.com/fzaninotto/Faker#language-specific-formatters) list instead.
|
||||
* Avoid changing existing sets of data. Some developers use Faker with seeding for unit tests ; changing the data makes their tests fail.
|
||||
* Speed is important in all Faker usages. Make sure your code is optimized to generate thousands of fake items in no time, without consuming too much memory or CPU.
|
||||
* If you commit a new feature, be prepared to help maintaining it. Watch the project on GitHub, and please comment on issues or PRs regarding the feature you contributed.
|
||||
|
||||
Once your code is merged, it is available for free to everybody under the MIT License. Publishing your Pull Request on the Faker GitHub repository means that you agree with this license for your contribution.
|
||||
|
||||
Thank you for your contribution! Faker wouldn't be so great without you.
|
||||
10
pfosten/vendor/fzaninotto/faker/Makefile
vendored
10
pfosten/vendor/fzaninotto/faker/Makefile
vendored
|
|
@ -1,10 +0,0 @@
|
|||
vendor/autoload.php:
|
||||
composer install --no-interaction --prefer-dist
|
||||
|
||||
.PHONY: sniff
|
||||
sniff: vendor/autoload.php
|
||||
vendor/bin/phpcs --standard=PSR2 src -n
|
||||
|
||||
.PHONY: test
|
||||
test: vendor/autoload.php
|
||||
vendor/bin/phpunit --verbose
|
||||
15
pfosten/vendor/fzaninotto/faker/composer.json
vendored
15
pfosten/vendor/fzaninotto/faker/composer.json
vendored
|
|
@ -2,7 +2,11 @@
|
|||
"name": "fzaninotto/faker",
|
||||
"type": "library",
|
||||
"description": "Faker is a PHP library that generates fake data for you.",
|
||||
"keywords": ["faker", "fixtures", "data"],
|
||||
"keywords": [
|
||||
"faker",
|
||||
"fixtures",
|
||||
"data"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
|
|
@ -13,9 +17,9 @@
|
|||
"php": "^5.3.3 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-intl": "*",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7",
|
||||
"squizlabs/php_codesniffer": "^1.5",
|
||||
"ext-intl": "*"
|
||||
"squizlabs/php_codesniffer": "^2.9.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
@ -29,7 +33,10 @@
|
|||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.8-dev"
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
pfosten/vendor/fzaninotto/faker/phpunit.xml.dist
vendored
12
pfosten/vendor/fzaninotto/faker/phpunit.xml.dist
vendored
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Faker Test Suite">
|
||||
<directory>./test/Faker/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
167
pfosten/vendor/fzaninotto/faker/readme.md
vendored
167
pfosten/vendor/fzaninotto/faker/readme.md
vendored
|
|
@ -1,5 +1,7 @@
|
|||
# Faker
|
||||
|
||||
[](https://codecov.io/gh/fzaninotto/Faker)
|
||||
|
||||
Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you.
|
||||
|
||||
Faker is heavily inspired by Perl's [Data::Faker](http://search.cpan.org/~jasonk/Data-Faker-0.07/), and by ruby's [Faker](https://rubygems.org/gems/faker).
|
||||
|
|
@ -51,14 +53,29 @@ composer require fzaninotto/faker
|
|||
|
||||
## Basic Usage
|
||||
|
||||
### Autoloading
|
||||
|
||||
Faker supports both `PSR-0` as `PSR-4` autoloaders.
|
||||
```php
|
||||
<?php
|
||||
# When installed via composer
|
||||
require_once 'vendor/autoload.php';
|
||||
```
|
||||
|
||||
You can also load `Fakers` shipped `PSR-0` autoloader
|
||||
```php
|
||||
<?php
|
||||
# Load Fakers own autoloader
|
||||
require_once '/path/to/Faker/src/autoload.php';
|
||||
```
|
||||
|
||||
*alternatively, you can use any another PSR-4 compliant autoloader*
|
||||
|
||||
### Create fake data
|
||||
Use `Faker\Factory::create()` to create and initialize a faker generator, which can generate data by accessing properties named after the type of data you want.
|
||||
|
||||
```php
|
||||
<?php
|
||||
// require the Faker autoloader
|
||||
require_once '/path/to/Faker/src/autoload.php';
|
||||
// alternatively, use another PSR-0 compliant autoloader (like the Symfony2 ClassLoader for instance)
|
||||
|
||||
// use the factory to create a Faker\Generator instance
|
||||
$faker = Faker\Factory::create();
|
||||
|
||||
|
|
@ -79,7 +96,7 @@ Even if this example shows a property access, each call to `$faker->name` yields
|
|||
|
||||
```php
|
||||
<?php
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
echo $faker->name, "\n";
|
||||
}
|
||||
// Adaline Reichel
|
||||
|
|
@ -103,6 +120,7 @@ Each of the generator properties (like `name`, `address`, and `lorem`) are calle
|
|||
### `Faker\Provider\Base`
|
||||
|
||||
randomDigit // 7
|
||||
randomDigitNot(5) // 0, 1, 2, 3, 4, 6, 7, 8, or 9
|
||||
randomDigitNotNull // 5
|
||||
randomNumber($nbDigits = NULL, $strict = false) // 79907610
|
||||
randomFloat($nbMaxDecimals = NULL, $min = 0, $max = NULL) // 48.8932
|
||||
|
|
@ -250,6 +268,8 @@ Methods accepting a `$timezone` argument default to `date_default_timezone_get()
|
|||
rgbCssColor // 'rgb(0,255,122)'
|
||||
safeColorName // 'fuchsia'
|
||||
colorName // 'Gainsbor'
|
||||
hslColor // '340,50,20'
|
||||
hslColorAsArray // array(340,50,20)
|
||||
|
||||
### `Faker\Provider\File`
|
||||
|
||||
|
|
@ -265,7 +285,7 @@ Methods accepting a `$timezone` argument default to `date_default_timezone_get()
|
|||
imageUrl($width = 640, $height = 480) // 'http://lorempixel.com/640/480/'
|
||||
imageUrl($width, $height, 'cats') // 'http://lorempixel.com/800/600/cats/'
|
||||
imageUrl($width, $height, 'cats', true, 'Faker') // 'http://lorempixel.com/800/400/cats/Faker'
|
||||
imageUrl($width, $height, 'cats', true, 'Faker', true) // 'http://lorempixel.com/grey/800/400/cats/Faker/' Monochrome image
|
||||
imageUrl($width, $height, 'cats', true, 'Faker', true) // 'http://lorempixel.com/gray/800/400/cats/Faker/' Monochrome image
|
||||
image($dir = '/tmp', $width = 640, $height = 480) // '/tmp/13b73edae8443990be1aa8f1a483bc27.jpg'
|
||||
image($dir, $width, $height, 'cats') // 'tmp/13b73edae8443990be1aa8f1a483bc27.jpg' it's a cat!
|
||||
image($dir, $width, $height, 'cats', false) // '13b73edae8443990be1aa8f1a483bc27.jpg' it's a filename without path
|
||||
|
|
@ -314,7 +334,7 @@ Faker provides three special providers, `unique()`, `optional()`, and `valid()`,
|
|||
```php
|
||||
// unique() forces providers to return unique values
|
||||
$values = array();
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
// get a random digit, but always a new one, to avoid duplicates
|
||||
$values []= $faker->unique()->randomDigit;
|
||||
}
|
||||
|
|
@ -323,7 +343,7 @@ print_r($values); // [4, 1, 8, 5, 0, 2, 6, 9, 7, 3]
|
|||
// providers with a limited range will throw an exception when no new unique value can be generated
|
||||
$values = array();
|
||||
try {
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$values []= $faker->unique()->randomDigitNotNull;
|
||||
}
|
||||
} catch (\OverflowException $e) {
|
||||
|
|
@ -336,7 +356,7 @@ $faker->unique($reset = true)->randomDigitNotNull; // will not throw OverflowExc
|
|||
|
||||
// optional() sometimes bypasses the provider to return a default value instead (which defaults to NULL)
|
||||
$values = array();
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
// get a random digit, but also null sometimes
|
||||
$values []= $faker->optional()->randomDigit;
|
||||
}
|
||||
|
|
@ -357,7 +377,7 @@ $values = array();
|
|||
$evenValidator = function($digit) {
|
||||
return $digit % 2 === 0;
|
||||
};
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$values []= $faker->valid($evenValidator)->randomDigit;
|
||||
}
|
||||
print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6]
|
||||
|
|
@ -384,7 +404,7 @@ $faker->optional()->passthrough(mt_rand(5, 15));
|
|||
```php
|
||||
<?php
|
||||
$faker = Faker\Factory::create('fr_FR'); // create a French faker
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
echo $faker->name, "\n";
|
||||
}
|
||||
// Luce du Coulon
|
||||
|
|
@ -407,12 +427,15 @@ Faker provides adapters for Object-Relational and Object-Document Mappers (curre
|
|||
|
||||
To populate entities, create a new populator class (using a generator instance as parameter), then list the class and number of all the entities that must be generated. To launch the actual data population, call the `execute()` method.
|
||||
|
||||
Note that some of the `populators` could require additional parameters. As example the `doctrine` populator has an option to specify
|
||||
its batchSize on how often it will flush the UnitOfWork to the database.
|
||||
|
||||
Here is an example showing how to populate 5 `Author` and 10 `Book` objects:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$generator = \Faker\Factory::create();
|
||||
$populator = new Faker\ORM\Propel\Populator($generator);
|
||||
$populator = new \Faker\ORM\Propel\Populator($generator);
|
||||
$populator->addEntity('Author', 5);
|
||||
$populator->addEntity('Book', 10);
|
||||
$insertedPKs = $populator->execute();
|
||||
|
|
@ -450,6 +473,8 @@ print_r($insertedPKs);
|
|||
// )
|
||||
```
|
||||
|
||||
**Note:** Due to the fact that `Faker` returns all the primary keys inserted, the memory consumption will go up drastically when you do batch inserts due to the big list of data.
|
||||
|
||||
In the previous example, the `Book` and `Author` models share a relationship. Since `Author` entities are populated first, Faker is smart enough to relate the populated `Book` entities to one of the populated `Author` entities.
|
||||
|
||||
Lastly, if you want to execute an arbitrary function on an entity before insertion, use the fourth argument of the `addEntity()` method:
|
||||
|
|
@ -567,7 +592,7 @@ $faker = Faker\Factory::create();
|
|||
?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<contacts>
|
||||
<?php for ($i=0; $i < 10; $i++): ?>
|
||||
<?php for ($i = 0; $i < 10; $i++): ?>
|
||||
<contact firstName="<?php echo $faker->firstName ?>" lastName="<?php echo $faker->lastName ?>" email="<?php echo $faker->email ?>">
|
||||
<phone number="<?php echo $faker->phoneNumber ?>"/>
|
||||
<?php if ($faker->boolean(25)): ?>
|
||||
|
|
@ -859,6 +884,15 @@ echo $faker->cvr; // "32458723"
|
|||
echo $faker->p; // "5398237590"
|
||||
```
|
||||
|
||||
### `Faker\Provider\de_CH\Person`
|
||||
```php
|
||||
<?php
|
||||
|
||||
// Generates a random AVS13/AHV13 social security number
|
||||
echo $faker->avs13; // "756.1234.5678.97" OR
|
||||
echo $faker->ahv13; // "756.1234.5678.97"
|
||||
```
|
||||
|
||||
### `Faker\Provider\de_DE\Payment`
|
||||
|
||||
```php
|
||||
|
|
@ -925,7 +959,7 @@ echo $faker->name; // 'Oluwunmi Mayowa'
|
|||
<?php
|
||||
|
||||
// Generates a cell (mobile) phone number
|
||||
echo $faker->cellNumber; // "021 123 4567"
|
||||
echo $faker->mobileNumber; // "021 123 4567"
|
||||
|
||||
// Generates a toll free number
|
||||
echo $faker->tollFreeNumber; // "0800 123 456"
|
||||
|
|
@ -1014,6 +1048,18 @@ echo $faker->licenceCode; // B
|
|||
echo $faker->vat; // "A35864370"
|
||||
```
|
||||
|
||||
### `Faker\Provider\es_ES\PhoneNumber`
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
// Generates a special rate toll free phone number
|
||||
echo $faker->tollFreeNumber; // 900 123 456
|
||||
|
||||
// Generates a mobile phone number
|
||||
echo $faker->mobileNumber; // +34 612 12 24
|
||||
```
|
||||
|
||||
### `Faker\Provider\es_PE\Person`
|
||||
|
||||
```php
|
||||
|
|
@ -1023,6 +1069,15 @@ echo $faker->vat; // "A35864370"
|
|||
echo $faker->dni; // '83367512'
|
||||
```
|
||||
|
||||
### `Faker\Provider\fa_IR\Person`
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
// Generates a valid nationalCode
|
||||
echo $faker->nationalCode; // "0078475759"
|
||||
```
|
||||
|
||||
### `Faker\Provider\fa_IR\Address`
|
||||
|
||||
```php
|
||||
|
|
@ -1092,6 +1147,14 @@ echo $faker->nationalId; // 'V11223344'
|
|||
echo $faker->taxpayerIdentificationNumber; // 'J1234567891'
|
||||
```
|
||||
|
||||
### `Faker\Provider\fr_CH\Person`
|
||||
```php
|
||||
<?php
|
||||
|
||||
// Generates a random AVS13/AHV13 social security number
|
||||
echo $faker->avs13; // "756.1234.5678.97"
|
||||
```
|
||||
|
||||
### `Faker\Provider\fr_FR\Address`
|
||||
|
||||
```php
|
||||
|
|
@ -1192,6 +1255,14 @@ echo $faker->bankAccountNumber; // "HU09904437680048220079300783"
|
|||
echo $faker->nik(); // "8522246001570940"
|
||||
```
|
||||
|
||||
### `Faker\Provider\it_CH\Person`
|
||||
```php
|
||||
<?php
|
||||
|
||||
// Generates a random AVS13/AHV13 social security number
|
||||
echo $faker->avs13; // "756.1234.5678.97"
|
||||
```
|
||||
|
||||
### `Faker\Provider\it_IT\Company`
|
||||
|
||||
```php
|
||||
|
|
@ -1412,6 +1483,7 @@ echo $faker->rrn('female'); // "50032089858" - Belgian Rijksregisternummer for a
|
|||
```php
|
||||
<?php
|
||||
|
||||
echo $faker->jobTitle; // "Houtbewerker"
|
||||
echo $faker->vat; // "NL123456789B01" - Dutch Value Added Tax number
|
||||
echo $faker->btw; // "NL123456789B01" - Dutch Value Added Tax number (alias)
|
||||
```
|
||||
|
|
@ -1424,6 +1496,17 @@ echo $faker->btw; // "NL123456789B01" - Dutch Value Added Tax number (alias)
|
|||
echo $faker->idNumber; // "111222333" - Dutch Personal identification number (BSN)
|
||||
```
|
||||
|
||||
### `Faker\Provider\nb_NO\MobileNumber`
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
// Generates a random Norwegian mobile phone number
|
||||
echo $faker->mobileNumber; // "+4799988777"
|
||||
echo $faker->mobileNumber; // "999 88 777"
|
||||
echo $faker->mobileNumber; // "99988777"
|
||||
```
|
||||
|
||||
### `Faker\Provider\nb_NO\Payment`
|
||||
|
||||
```php
|
||||
|
|
@ -1678,30 +1761,38 @@ echo $faker->VAT; //23456789
|
|||
|
||||
## Third-Party Libraries Extending/Based On Faker
|
||||
|
||||
* Symfony2 bundles:
|
||||
* [BazingaFakerBundle](https://github.com/willdurand/BazingaFakerBundle): Put the awesome Faker library into the Symfony2 DIC and populate your database with fake data.
|
||||
* [AliceBundle](https://github.com/hautelook/AliceBundle), [AliceFixturesBundle](https://github.com/h4cc/AliceFixturesBundle): Bundles for using [Alice](https://packagist.org/packages/nelmio/alice) and Faker with data fixtures. Able to use Doctrine ORM as well as Doctrine MongoDB ODM.
|
||||
* [FakerServiceProvider](https://github.com/EmanueleMinotto/FakerServiceProvider): Faker Service Provider for Silex
|
||||
* [faker-cli](https://github.com/bit3/faker-cli): Command Line Tool for the Faker PHP library
|
||||
* [Factory Muffin](https://github.com/thephpleague/factory-muffin): enable the rapid creation of objects (PHP port of factory-girl)
|
||||
* [CompanyNameGenerator](https://github.com/fzaninotto/CompanyNameGenerator): Generate names for English tech companies with class
|
||||
* [PlaceholdItProvider](https://github.com/EmanueleMinotto/PlaceholdItProvider): Generate images using placehold.it
|
||||
* [datalea](https://github.com/spyrit/datalea) A highly customizable random test data generator web app
|
||||
* [newage-ipsum](https://github.com/frequenc1/newage-ipsum): A new aged ipsum provider for the faker library inspired by http://sebpearce.com/bullshit/
|
||||
* [xml-faker](https://github.com/prewk/xml-faker): Create fake XML with Faker
|
||||
* [faker-context](https://github.com/denheck/faker-context): Behat context using Faker to generate testdata
|
||||
* [CronExpressionGenerator](https://github.com/swekaj/CronExpressionGenerator): Faker provider for generating random, valid cron expressions.
|
||||
* [pragmafabrik/Pomm2Faker](https://github.com/pragmafabrik/Pomm2Faker): Faker client for Pomm database framework (PostgreSQL)
|
||||
* [nelmio/alice](https://packagist.org/packages/nelmio/alice): Fixtures/object generator with a yaml DSL that can use Faker as data generator.
|
||||
* [CakePHP 2.x Fake Seeder Plugin](https://github.com/ravage84/cakephp-fake-seeder) A CakePHP 2.x shell to seed your database with fake and/or fixed data.
|
||||
* [images-generator](https://github.com/bruceheller/images-generator): An image generator provider using GD for placeholder type pictures
|
||||
* [pattern-lab/plugin-php-faker](https://github.com/pattern-lab/plugin-php-faker): Pattern Lab is a Styleguide, Component Library, and Prototyping tool. This creates unique content each time Pattern Lab is generated.
|
||||
* [guidocella/eloquent-populator](https://github.com/guidocella/eloquent-populator): Adapter for Laravel's Eloquent ORM.
|
||||
* [tamperdata/exiges](https://github.com/tamperdata/exiges): Faker provider for generating random temperatures
|
||||
* [jzonta/FakerRestaurant](https://github.com/jzonta/FakerRestaurant): Faker for Food and Beverage names generate
|
||||
* [aalaap/faker-youtube](https://github.com/aalaap/faker-youtube): Faker for YouTube URLs in various formats
|
||||
* [pelmered/fake-car](https://github.com/pelmered/fake-car): Faker for cars and car data
|
||||
* Symfony bundles:
|
||||
* [`willdurand/faker-bundle`](https://github.com/willdurand/BazingaFakerBundle): Put the awesome Faker library into the Symfony2 DIC and populate your database with fake data.
|
||||
* [`hautelook/alice-bundle`](https://github.com/hautelook/AliceBundle), [`h4cc/alice-fixtures-bundle`](https://github.com/h4cc/AliceFixturesBundle): Bundles for using [`nelmio/alice`](https://packagist.org/packages/nelmio/alice) and Faker with data fixtures. Able to use Doctrine ORM as well as Doctrine MongoDB ODM.
|
||||
* [`emanueleminotto/faker-service-provider`](https://github.com/EmanueleMinotto/FakerServiceProvider): Faker Service Provider for Silex
|
||||
* [`bit3/faker-cli`](https://github.com/bit3/faker-cli): Command Line Tool for the Faker PHP library
|
||||
* [`league/factory-muffin`](https://github.com/thephpleague/factory-muffin): enable the rapid creation of objects (PHP port of factory-girl)
|
||||
* [`fzaninotto/company-name-generator`](https://github.com/fzaninotto/CompanyNameGenerator): Generate names for English tech companies with class
|
||||
* [`emanueleminotto/faker-placehold-it-provider`](https://github.com/EmanueleMinotto/PlaceholdItProvider): Generate images using placehold.it
|
||||
* [`spyrit/datalea`](https://github.com/spyrit/datalea) A highly customizable random test data generator web app
|
||||
* [`frequenc1/newage-ipsum`](https://github.com/frequenc1/newage-ipsum): A new aged ipsum provider for the faker library inspired by http://sebpearce.com/bullshit/
|
||||
* [`prewk/xml-faker`](https://github.com/prewk/xml-faker): Create fake XML with Faker
|
||||
* [`denheck/faker-context`](https://github.com/denheck/faker-context): Behat context using Faker to generate testdata
|
||||
* [`swekaj/cron-expression-generator`](https://github.com/swekaj/CronExpressionGenerator): Faker provider for generating random, valid cron expressions.
|
||||
* [`pragmafabrik/pomm-faker`](https://github.com/pragmafabrik/Pomm2Faker): Faker client for Pomm database framework (PostgreSQL)
|
||||
* [`nelmio/alice`](https://github.com/nelmio/alice): Fixtures/object generator with a yaml DSL that can use Faker as data generator.
|
||||
* [`ravage84/cakephp-fake-seeder`](https://github.com/ravage84/cakephp-fake-seeder) A CakePHP 2.x shell to seed your database with fake and/or fixed data.
|
||||
* [`bheller/images-generator`](https://github.com/bruceheller/images-generator): An image generator provider using GD for placeholder type pictures
|
||||
* [`pattern-lab/plugin-faker`](https://github.com/pattern-lab/plugin-php-faker): Pattern Lab is a Styleguide, Component Library, and Prototyping tool. This creates unique content each time Pattern Lab is generated.
|
||||
* [`guidocella/eloquent-populator`](https://github.com/guidocella/eloquent-populator): Adapter for Laravel's Eloquent ORM.
|
||||
* [`tamperdata/exiges`](https://github.com/tamperdata/exiges): Faker provider for generating random temperatures
|
||||
* [`jzonta/faker-restaurant`](https://github.com/jzonta/FakerRestaurant): Faker for Food and Beverage names generate
|
||||
* [`aalaap/faker-youtube`](https://github.com/aalaap/faker-youtube): Faker for YouTube URLs in various formats
|
||||
* [`pelmered/fake-car`](https://github.com/pelmered/fake-car): Faker for cars and car data
|
||||
* [`bluemmb/faker-picsum-photos-provider`](https://github.com/bluemmb/Faker-PicsumPhotos): Generate images using [picsum.photos](http://picsum.photos/)
|
||||
* [`er1z/fakemock`](https://github.com/er1z/fakemock): Generate mocks using class-configuration and detection via Faker's guesser and Symfony asserts
|
||||
* [`xvladqt/faker-lorem-flickr`](https://github.com/xvladxtremal/Faker-LoremFlickr): Generate images using [loremflickr.com](http://loremflickr.com/)
|
||||
* [`metrakit/faker-eddy-malou`](https://github.com/Metrakit/faker-eddy-malou): Generate French Eddy Malou sentences & paragraphs
|
||||
* [`drupol/belgian-national-number-faker`](https://github.com/drupol/belgian-national-number-faker): Generate fake Belgian national numbers
|
||||
* [`elgentos/masquerade`](https://github.com/elgentos/masquerade): Configuration-based, platform-agnostic, locale-compatible data faker tool (out-of-the-box support for Magento 2)
|
||||
* [`ottaviano/faker-gravatar`](https://github.com/ottaviano/faker-gravatar): Generate avatars using [Gravatar](https://en.gravatar.com/site/implement/images/)
|
||||
* [`finwe/phpstan-faker`](https://github.com/finwe/phpstan-faker): PHPStan extension for Faker methods
|
||||
|
||||
## License
|
||||
|
||||
Faker is released under the MIT Licence. See the bundled LICENSE file for details.
|
||||
Faker is released under the MIT License. See the bundled LICENSE file for details.
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ class Luhn
|
|||
$length = strlen($number);
|
||||
$sum = 0;
|
||||
for ($i = $length - 1; $i >= 0; $i -= 2) {
|
||||
$sum += $number{$i};
|
||||
$sum += $number[$i];
|
||||
}
|
||||
for ($i = $length - 2; $i >= 0; $i -= 2) {
|
||||
$sum += array_sum(str_split($number{$i} * 2));
|
||||
$sum += array_sum(str_split($number[$i] * 2));
|
||||
}
|
||||
|
||||
return $sum % 10;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ namespace Faker;
|
|||
* @property string $city
|
||||
* @property string $streetName
|
||||
* @property string $streetAddress
|
||||
* @property string $secondaryAddress
|
||||
* @property string $postcode
|
||||
* @property string $address
|
||||
* @property string $state
|
||||
* @property string $country
|
||||
* @property float $latitude
|
||||
* @property float $longitude
|
||||
|
|
@ -33,6 +35,7 @@ namespace Faker;
|
|||
* @property string $isbn10
|
||||
*
|
||||
* @property string $phoneNumber
|
||||
* @property string $e164PhoneNumber
|
||||
*
|
||||
* @property string $company
|
||||
* @property string $companySuffix
|
||||
|
|
@ -52,6 +55,7 @@ namespace Faker;
|
|||
* @property string $word
|
||||
* @property string|array $words
|
||||
* @method string|array words($nb = 3, $asText = false)
|
||||
* @method string word()
|
||||
* @property string $sentence
|
||||
* @method string sentence($nbWords = 6, $variableNbWords = true)
|
||||
* @property string|array $sentences
|
||||
|
|
@ -113,7 +117,7 @@ namespace Faker;
|
|||
* @method string year($max = 'now')
|
||||
* @method \DateTime dateTime($max = 'now', $timezone = null)
|
||||
* @method \DateTime dateTimeAd($max = 'now', $timezone = null)
|
||||
* @method \DateTime dateTimeBetween($startDate = '-30 years', $endDate = 'now')
|
||||
* @method \DateTime dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null)
|
||||
* @method \DateTime dateTimeInInterval($date = '-30 years', $interval = '+5 days', $timezone = null)
|
||||
* @method \DateTime dateTimeThisCentury($max = 'now', $timezone = null)
|
||||
* @method \DateTime dateTimeThisDecade($max = 'now', $timezone = null)
|
||||
|
|
@ -132,6 +136,7 @@ namespace Faker;
|
|||
* @method boolean boolean($chanceOfGettingTrue = 50)
|
||||
*
|
||||
* @property int $randomDigit
|
||||
* @property int $randomDigitNot
|
||||
* @property int $randomDigitNotNull
|
||||
* @property string $randomLetter
|
||||
* @property string $randomAscii
|
||||
|
|
@ -154,6 +159,7 @@ namespace Faker;
|
|||
* @method Generator optional($weight = 0.5, $default = null)
|
||||
* @method Generator unique($reset = false, $maxRetries = 10000)
|
||||
* @method Generator valid($validator = null, $maxRetries = 10000)
|
||||
* @method mixed passthrough($passthrough)
|
||||
*
|
||||
* @method integer biasedNumberBetween($min = 0, $max = 100, $function = 'sqrt')
|
||||
*
|
||||
|
|
@ -278,4 +284,9 @@ class Generator
|
|||
{
|
||||
return $this->format($method, $attributes);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->seed();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@ class ColumnTypeGuesser
|
|||
return $generator->uuid();
|
||||
};
|
||||
case 'string':
|
||||
$columnData = $schema->column($column);
|
||||
if (method_exists($schema, 'getColumn')) {
|
||||
$columnData = $schema->getColumn($column);
|
||||
} else {
|
||||
$columnData = $schema->column($column);
|
||||
}
|
||||
$length = $columnData['length'];
|
||||
return function () use ($generator, $length) {
|
||||
return $generator->text($length);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,12 @@ class ColumnTypeGuesser
|
|||
return function () use ($generator) {
|
||||
return $generator->datetime;
|
||||
};
|
||||
case 'datetime_immutable':
|
||||
case 'date_immutable':
|
||||
case 'time_immutable':
|
||||
return function () use ($generator) {
|
||||
return \DateTimeImmutable::createFromMutable($generator->datetime);
|
||||
};
|
||||
default:
|
||||
// no smart way to guess what the user expects here
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Faker\ORM\Doctrine;
|
||||
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Faker\Generator;
|
||||
|
||||
/**
|
||||
* Service class for populating a database using the Doctrine ORM or ODM.
|
||||
|
|
@ -10,20 +11,35 @@ use Doctrine\Common\Persistence\ObjectManager;
|
|||
*/
|
||||
class Populator
|
||||
{
|
||||
/** @var int */
|
||||
protected $batchSize;
|
||||
|
||||
/** @var Generator */
|
||||
protected $generator;
|
||||
|
||||
/** @var ObjectManager|null */
|
||||
protected $manager;
|
||||
|
||||
/** @var array */
|
||||
protected $entities = array();
|
||||
|
||||
/** @var array */
|
||||
protected $quantities = array();
|
||||
|
||||
/** @var array */
|
||||
protected $generateId = array();
|
||||
|
||||
/**
|
||||
* @param \Faker\Generator $generator
|
||||
* Populator constructor.
|
||||
* @param Generator $generator
|
||||
* @param ObjectManager|null $manager
|
||||
* @param int $batchSize
|
||||
*/
|
||||
public function __construct(\Faker\Generator $generator, ObjectManager $manager = null)
|
||||
public function __construct(Generator $generator, ObjectManager $manager = null, $batchSize = 1000)
|
||||
{
|
||||
$this->generator = $generator;
|
||||
$this->manager = $manager;
|
||||
$this->batchSize = $batchSize;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -55,6 +71,9 @@ class Populator
|
|||
/**
|
||||
* Populate the database using all the Entity classes previously added.
|
||||
*
|
||||
* Please note that large amounts of data will result in more memory usage since the the Populator will return
|
||||
* all newly created primary keys after executing.
|
||||
*
|
||||
* @param null|EntityManager $entityManager A Doctrine connection object
|
||||
*
|
||||
* @return array A list of the inserted PKs
|
||||
|
|
@ -72,9 +91,18 @@ class Populator
|
|||
foreach ($this->quantities as $class => $number) {
|
||||
$generateId = $this->generateId[$class];
|
||||
for ($i=0; $i < $number; $i++) {
|
||||
$insertedEntities[$class][]= $this->entities[$class]->execute($entityManager, $insertedEntities, $generateId);
|
||||
$insertedEntities[$class][]= $this->entities[$class]->execute(
|
||||
$entityManager,
|
||||
$insertedEntities,
|
||||
$generateId
|
||||
);
|
||||
if (count($insertedEntities) % $this->batchSize === 0) {
|
||||
$entityManager->flush();
|
||||
$entityManager->clear($class);
|
||||
}
|
||||
}
|
||||
$entityManager->flush();
|
||||
$entityManager->clear($class);
|
||||
}
|
||||
|
||||
return $insertedEntities;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ class EntityPopulator
|
|||
foreach ($relations as $relation) {
|
||||
// We don't need any other relation here.
|
||||
if ($relation instanceof BelongsTo) {
|
||||
|
||||
$fieldName = $relation->localKey();
|
||||
$entityName = $relation->entityName();
|
||||
$field = $fields[$fieldName];
|
||||
|
|
@ -162,14 +161,12 @@ class EntityPopulator
|
|||
if (empty($records)) {
|
||||
return null;
|
||||
}
|
||||
$id = $records[mt_rand(0, count($records) - 1)]['id'];
|
||||
|
||||
return $id;
|
||||
return $records[mt_rand(0, count($records) - 1)]['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class Base
|
|||
/**
|
||||
* Returns randomly ordered subsequence of $count elements from a provided array
|
||||
*
|
||||
* @param array $array Array to take elements from. Defaults to a-f
|
||||
* @param array $array Array to take elements from. Defaults to a-c
|
||||
* @param integer $count Number of elements to take.
|
||||
* @param boolean $allowDuplicates Allow elements to be picked several times. Defaults to false
|
||||
* @throws \LengthException When requesting more elements than provided
|
||||
|
|
@ -492,7 +492,7 @@ class Base
|
|||
// All A-F inside of [] become ABCDEF
|
||||
$regex = preg_replace_callback('/\[([^\]]+)\]/', function ($matches) {
|
||||
return '[' . preg_replace_callback('/(\w|\d)\-(\w|\d)/', function ($range) {
|
||||
return implode(range($range[1], $range[2]), '');
|
||||
return implode('', range($range[1], $range[2]));
|
||||
}, $matches[1]) . ']';
|
||||
}, $regex);
|
||||
// All [ABC] become B (or A or C)
|
||||
|
|
@ -590,10 +590,10 @@ class Base
|
|||
* <code>
|
||||
* $values = array();
|
||||
* $evenValidator = function ($digit) {
|
||||
* return $digit % 2 === 0;
|
||||
* return $digit % 2 === 0;
|
||||
* };
|
||||
* for ($i=0; $i < 10; $i++) {
|
||||
* $values []= $faker->valid($evenValidator)->randomDigit;
|
||||
* $values []= $faker->valid($evenValidator)->randomDigit;
|
||||
* }
|
||||
* print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6]
|
||||
* </code>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Biased extends Base
|
|||
$y = mt_rand() / (mt_getrandmax() + 1);
|
||||
} while (call_user_func($function, $x) < $y);
|
||||
|
||||
return floor($x * ($max - $min + 1) + $min);
|
||||
return (int) floor($x * ($max - $min + 1) + $min);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -113,4 +113,31 @@ class Color extends Base
|
|||
{
|
||||
return static::randomElement(static::$allColorNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example '340,50,20'
|
||||
* @return string
|
||||
*/
|
||||
public static function hslColor()
|
||||
{
|
||||
return sprintf(
|
||||
'%s,%s,%s',
|
||||
static::numberBetween(0, 360),
|
||||
static::numberBetween(0, 100),
|
||||
static::numberBetween(0, 100)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example array(340, 50, 20)
|
||||
* @return array
|
||||
*/
|
||||
public static function hslColorAsArray()
|
||||
{
|
||||
return array(
|
||||
static::numberBetween(0, 360),
|
||||
static::numberBetween(0, 100),
|
||||
static::numberBetween(0, 100)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ class Company extends Base
|
|||
|
||||
/**
|
||||
* @example 'Acme Ltd'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function company()
|
||||
{
|
||||
|
|
@ -26,6 +28,8 @@ class Company extends Base
|
|||
|
||||
/**
|
||||
* @example 'Ltd'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function companySuffix()
|
||||
{
|
||||
|
|
@ -34,6 +38,8 @@ class Company extends Base
|
|||
|
||||
/**
|
||||
* @example 'Job'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jobTitle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class DateTime extends Base
|
|||
protected static $defaultTimezone = null;
|
||||
|
||||
/**
|
||||
* @param string|float|int $max
|
||||
* @param \DateTime|string|float|int $max
|
||||
* @return int|false
|
||||
*/
|
||||
protected static function getMaxTimestamp($max = 'now')
|
||||
|
|
@ -147,7 +147,7 @@ class DateTime extends Base
|
|||
* an interval
|
||||
* Accepts date string that can be recognized by strtotime().
|
||||
*
|
||||
* @param string $date Defaults to 30 years ago
|
||||
* @param \DateTime|string $date Defaults to 30 years ago
|
||||
* @param string $interval Defaults to 5 days after
|
||||
* @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get`
|
||||
* @example dateTimeInInterval('1999-02-02 11:42:52', '+ 5 days')
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class Image extends Base
|
|||
*
|
||||
* @example '/path/to/dir/13b73edae8443990be1aa8f1a483bc27.jpg'
|
||||
*/
|
||||
public static function image($dir = null, $width = 640, $height = 480, $category = null, $fullPath = true, $randomize = true, $word = null)
|
||||
public static function image($dir = null, $width = 640, $height = 480, $category = null, $fullPath = true, $randomize = true, $word = null, $gray = false)
|
||||
{
|
||||
$dir = is_null($dir) ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible
|
||||
// Validate directory path
|
||||
|
|
@ -75,7 +75,7 @@ class Image extends Base
|
|||
$filename = $name .'.jpg';
|
||||
$filepath = $dir . DIRECTORY_SEPARATOR . $filename;
|
||||
|
||||
$url = static::imageUrl($width, $height, $category, $randomize, $word);
|
||||
$url = static::imageUrl($width, $height, $category, $randomize, $word, $gray);
|
||||
|
||||
// save file
|
||||
if (function_exists('curl_exec')) {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ class Internet extends Base
|
|||
}
|
||||
$words = $this->generator->words($nbWords);
|
||||
|
||||
return join($words, '-');
|
||||
return join('-', $words);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -233,7 +233,7 @@ class Internet extends Base
|
|||
}
|
||||
|
||||
$transId = 'Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC;';
|
||||
if (class_exists('Transliterator') && $transliterator = \Transliterator::create($transId)) {
|
||||
if (class_exists('Transliterator', false) && $transliterator = \Transliterator::create($transId)) {
|
||||
$transString = $transliterator->transliterate($string);
|
||||
} else {
|
||||
$transString = static::toAscii($string);
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class Lorem extends Base
|
|||
$words = static::words($nbWords);
|
||||
$words[0] = ucwords($words[0]);
|
||||
|
||||
return implode($words, ' ') . '.';
|
||||
return implode(' ', $words) . '.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,7 +131,7 @@ class Lorem extends Base
|
|||
$nbSentences = self::randomizeNbElements($nbSentences);
|
||||
}
|
||||
|
||||
return implode(static::sentences($nbSentences), ' ');
|
||||
return implode(' ', static::sentences($nbSentences));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -193,7 +193,7 @@ class Lorem extends Base
|
|||
$text[count($text) - 1] .= '.';
|
||||
}
|
||||
|
||||
return implode($text, '');
|
||||
return implode('', $text);
|
||||
}
|
||||
|
||||
protected static function randomizeNbElements($nbElements)
|
||||
|
|
|
|||
|
|
@ -61,28 +61,28 @@ class Miscellaneous extends Base
|
|||
'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR',
|
||||
'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE',
|
||||
'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ',
|
||||
'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD',
|
||||
'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR',
|
||||
'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM',
|
||||
'DO', 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI',
|
||||
'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF',
|
||||
'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS',
|
||||
'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU',
|
||||
'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT',
|
||||
'JE', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN',
|
||||
'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK',
|
||||
'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME',
|
||||
'MF', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ',
|
||||
'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA',
|
||||
'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU',
|
||||
'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM',
|
||||
'PN', 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS',
|
||||
'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI',
|
||||
'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV',
|
||||
'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK',
|
||||
'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA',
|
||||
'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI',
|
||||
'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW',
|
||||
'BR', 'BS', 'BT', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF',
|
||||
'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU',
|
||||
'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO',
|
||||
'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ',
|
||||
'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG',
|
||||
'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT',
|
||||
'GU', 'GW', 'GY', 'HK', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE',
|
||||
'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JE', 'JM',
|
||||
'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR',
|
||||
'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS',
|
||||
'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG',
|
||||
'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS',
|
||||
'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE',
|
||||
'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM',
|
||||
'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR',
|
||||
'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW',
|
||||
'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK',
|
||||
'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY',
|
||||
'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM',
|
||||
'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM',
|
||||
'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU',
|
||||
'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
@ -202,7 +202,7 @@ class Miscellaneous extends Base
|
|||
|
||||
/**
|
||||
* @link https://en.wikipedia.org/wiki/ISO_4217
|
||||
* On date of 2017-07-07
|
||||
* On date of 2019-09-27
|
||||
*
|
||||
* With the following exceptions:
|
||||
* SVC has been replaced by the USD in 2001: https://en.wikipedia.org/wiki/Salvadoran_col%C3%B3n
|
||||
|
|
@ -218,12 +218,12 @@ class Miscellaneous extends Base
|
|||
'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS',
|
||||
'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR',
|
||||
'LRD', 'LSL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP',
|
||||
'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZN', 'NAD', 'NGN', 'NIO',
|
||||
'MRU', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZN', 'NAD', 'NGN', 'NIO',
|
||||
'NOK', 'NPR', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN',
|
||||
'PYG', 'QAR', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SBD', 'SCR', 'SDG',
|
||||
'SEK', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'SSP', 'STD', 'SYP', 'SZL',
|
||||
'SEK', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'SSP', 'STN', 'SYP', 'SZL',
|
||||
'THB', 'TJS', 'TMT', 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS', 'UAH',
|
||||
'UGX', 'USD', 'UYU', 'UZS', 'VEF', 'VND', 'VUV', 'WST', 'XAF', 'XCD',
|
||||
'UGX', 'USD', 'UYU', 'UZS', 'VES', 'VND', 'VUV', 'WST', 'XAF', 'XCD',
|
||||
'XOF', 'XPF', 'YER', 'ZAR', 'ZMW',
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ abstract class Text extends Base
|
|||
* @example 'Alice, swallowing down her flamingo, and began by taking the little golden key'
|
||||
* @param integer $maxNbChars Maximum number of characters the text should contain (minimum: 10)
|
||||
* @param integer $indexSize Determines how many words are considered for the generation of the next word.
|
||||
* The minimum is 1, and it produces the higher level of randomness, although the
|
||||
* The minimum is 1, and it produces a higher level of randomness, although the
|
||||
* generated text usually doesn't make sense. Higher index sizes (up to 5)
|
||||
* produce more correct text, at the price of less randomness.
|
||||
* @return string
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ class Uuid extends Base
|
|||
*/
|
||||
public static function uuid()
|
||||
{
|
||||
// fix for compatibility with 32bit architecture; seed range restricted to 62bit
|
||||
// fix for compatibility with 32bit architecture; each mt_rand call is restricted to 32bit
|
||||
// two such calls will cause 64bits of randomness regardless of architecture
|
||||
$seed = mt_rand(0, 2147483647) . '#' . mt_rand(0, 2147483647);
|
||||
|
||||
// Hash the seed and convert to a byte array
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,6 +58,6 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -60,7 +60,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Payment extends \Faker\Provider\Payment
|
|||
*/
|
||||
public static function vat($spacedNationalPrefix = true)
|
||||
{
|
||||
$prefix = ($spacedNationalPrefix) ? "AT U" : "ATU";
|
||||
$prefix = $spacedNationalPrefix ? "AT U" : "ATU";
|
||||
|
||||
return sprintf("%s%d", $prefix, self::randomNumber(8, true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Payment extends \Faker\Provider\Payment
|
|||
*/
|
||||
public static function vat($spacedNationalPrefix = true)
|
||||
{
|
||||
$prefix = ($spacedNationalPrefix) ? "BG " : "BG";
|
||||
$prefix = $spacedNationalPrefix ? "BG " : "BG";
|
||||
|
||||
return sprintf(
|
||||
"%s%d%d",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,18 @@ class Address extends \Faker\Provider\Address
|
|||
'gasse', 'platz', 'ring', 'straße', 'weg',
|
||||
);
|
||||
|
||||
protected static $postcode = array('####');
|
||||
// As per https://en.wikipedia.org/wiki/List_of_postal_codes_in_Austria (@todo implement more strict postal code values according to wikipedia)
|
||||
protected static $postcode = array(
|
||||
'1###',
|
||||
'2###',
|
||||
'3###',
|
||||
'4###',
|
||||
'5###',
|
||||
'6###',
|
||||
'7###',
|
||||
'8###',
|
||||
'9###',
|
||||
);
|
||||
|
||||
protected static $cityNames = array(
|
||||
'Allentsteig', 'Altheim', 'Althofen', 'Amstetten', 'Ansfelden', 'Attnang-Puchheim',
|
||||
|
|
|
|||
|
|
@ -86,4 +86,32 @@ class Person extends \Faker\Provider\de_DE\Person
|
|||
'Wagner', 'Walker', 'Walser', 'Weber', 'Wehrli', 'Weibel', 'Weiss', 'Wenger', 'Wicki', 'Widmer', 'Willi', 'Wirth', 'Wirz', 'Wittwer', 'Wolf', 'Wyss', 'Wüthrich',
|
||||
'Zaugg', 'Zbinden', 'Zehnder', 'Ziegler', 'Zimmermann', 'Zwahlen', 'Zürcher',
|
||||
);
|
||||
|
||||
/**
|
||||
* Generates a valid random AVS13 (swiss social security) number
|
||||
*
|
||||
* This function acts as a localized alias for the function defined in the
|
||||
* fr_CH provider. In the german-speaking part of Switzerland, the AVS13
|
||||
* number is generally known as AHV13.
|
||||
*
|
||||
* @see \Faker\Provider\fr_CH\Person::avs13()
|
||||
* @return string
|
||||
*/
|
||||
public static function ahv13()
|
||||
{
|
||||
return \Faker\Provider\fr_CH\Person::avs13();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a valid random AVS13 (swiss social security) number
|
||||
*
|
||||
* This function acts as an alias for the function defined in the fr_CH provider.
|
||||
*
|
||||
* @see \Faker\Provider\fr_CH\Person::avs13()
|
||||
* @return string
|
||||
*/
|
||||
public static function avs13()
|
||||
{
|
||||
return \Faker\Provider\fr_CH\Person::avs13();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Faker\Provider\de_DE;
|
|||
|
||||
class Address extends \Faker\Provider\Address
|
||||
{
|
||||
protected static $buildingNumber = array('###', '##', '#', '#/#', '##[abc]', '#[abc]');
|
||||
protected static $buildingNumber = array('%##', '%#', '%', '%/%', '%#[abc]', '%[abc]');
|
||||
|
||||
protected static $streetSuffixLong = array(
|
||||
'Gasse', 'Platz', 'Ring', 'Straße', 'Weg', 'Allee'
|
||||
|
|
|
|||
|
|
@ -11,5 +11,14 @@ class Company extends \Faker\Provider\Company
|
|||
'{{lastName}}',
|
||||
);
|
||||
|
||||
/**
|
||||
* @link http://www.personalseite.de/information/titel.htm
|
||||
*/
|
||||
protected static $jobTitleFormat = array(
|
||||
'Abteilungsdirektor', 'Arbeitsdirektor', 'Aufsichtsrat', 'Beirat', 'Bereichsleiter', 'Betriebsleiter', 'Finanzvorstand', 'Geschäftsführender Gesellschafter', 'Geschäftsführer', 'Gesellschafter',
|
||||
'Handlungsbevollmächtigter', 'Kaufmännischer Vorstand', 'Leiter Rechtsabteilung', 'Mitglied des Aufsichtsrats', 'Personalleiter', 'Prokurist', 'Sellvertretender Vorsitzender des Vorstandes',
|
||||
'Vorsitzender der Geschäftsführung', 'Vorsitzender des Aufsichtsrats', 'Vorsitzender des Vorstandes', 'Vorstand Personal', 'Vorstand Technik', 'Vorstand Vertrieb', 'Vorstandsmitglied', 'Werksleiter'
|
||||
);
|
||||
|
||||
protected static $companySuffix = array('e.G.', 'e.V.', 'GbR', 'GbR', 'OHG mbH', 'GmbH & Co. OHG', 'AG & Co. OHG', 'GmbH', 'GmbH', 'GmbH', 'GmbH', 'AG', 'AG', 'AG', 'AG', 'KG', 'KG', 'KG', 'GmbH & Co. KG', 'GmbH & Co. KG', 'AG & Co. KG', 'Stiftung & Co. KG', 'KGaA', 'GmbH & Co. KGaA', 'AG & Co. KGaA', 'Stiftung & Co. KGaA');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Faker\Provider\en_CA;
|
||||
|
||||
class PhoneNumber extends \Faker\Provider\PhoneNumber
|
||||
class PhoneNumber extends \Faker\Provider\en_US\PhoneNumber
|
||||
{
|
||||
protected static $formats = array(
|
||||
'%##-###-####',
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ class Address extends \Faker\Provider\Address
|
|||
'L40 4LA','LU7 4SW','WV99 1RG','EC3P 3AY','CW5 6DY','CR2 8EN','PO11 0JY','IP33 9GD','WA3 3UR','WD3 3LY','CT6 7HL','TN15 8JE',
|
||||
'L35 5JA','CF23 0EL','TR13 0DP','GL14 2NW','W1D 4PR','SY5 0AR','NP4 8LA','CH45 7RH','S35 4FX','PL20 6JB','NW1 6AB','AB41 7HB',
|
||||
'S72 7HG','RG27 8PG','TA1 3TF','FK3 8EP','MK43 7LX','BT79 7AQ','L9 9BL','PE28 5US','PO4 8NU','WF4 3QZ','SE23 3RG','NN5 7AR',
|
||||
'L15 6UE','CA4 9QG','RH9 8DR','KT18 5DN','AB11 5QE','L2 2TX','NE20 0RB','TF3 2BG','NW2 2SH','IG10 3JT','HR9 7GB','N10 3DS',
|
||||
'PA3 4NH','W8 7EY','HP19 9BW','KA1 3TU','SE26 6JG','SL3 9LU','L38 9EB','M15 6QL','BN6 8DA','PE27 5PP','LS16 8EE','AB15 4YR',
|
||||
'CM0 7HA','SY11 4LB','IG1 3TR','NE63 8EL','CR5 3DN','NW4 4XL','BL9 6QT','KT24 6NU','EH37 5TF','SO16 9RJ','B62 8RS','PL28 8QJ',
|
||||
'L15 6UE','CA4 9QG','RH9 8DR','AB11 5QE','L2 2TX','NE20 0RB','TF3 2BG','NW2 2SH','IG10 3JT','HR9 7GB','N10 3DS',
|
||||
'PA3 4NH','W8 7EY','HP19 9BW','KA1 3TU','SE26 6JG','SL3 9LU','L38 9EB','M15 6QL','BN6 8DA','PE27 5PP','LS16 8EE',
|
||||
'CM0 7HA','SY11 4LB','IG1 3TR','NE63 8EL','CR5 3DN','NW4 4XL','BL9 6QT','KT24 6NU','EH37 5TF','SO16 9RJ','PL28 8QJ',
|
||||
'E9 5LR','BR6 9XJ','M25 3BY','M20 1BT','SE18 7QX','DD1 2NF','NR31 8NS','BH31 6AF','TN23 5PR','TN12 9PU','HR8 2JJ','KT6 5DX',
|
||||
'HX3 0NS','SN7 8NR','SY7 8AQ','CV8 1LS','NR34 9ET','BD23 3EU','YO11 3JN','BH11 9NE','CM3 3AE','KA3 7PR','DE15 9DU','PR8 9LB',
|
||||
'GL53 7EN','OX15 4HW','TS19 9ES','G65 9BG','SE15 6FE','B37 7RA','BT51 3NQ','YO32 9SX','M50 3TU','LL14 5NR','PO35 5XS','W5 9TG',
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Person extends \Faker\Provider\Person
|
|||
'Kartik', 'Koushtubh', 'Kirti', 'Kushal', 'Kailash', 'Kalyan', 'Krishna', 'Kamlesh', 'Kalpit', 'Kabeer', 'Karim',
|
||||
'Lalit', 'Lakshmi', 'Labeen',
|
||||
'Mohan', 'Mukund', 'Mohan', 'Mohit', 'Manish', 'Moti', 'Mowgli', 'Mohanlal', 'Mitesh', 'Manoj', 'Monin', 'Mahmood', 'Malik', 'Mehul', 'Mustafa', 'Manpreet', 'Mukul', 'Munaf', 'Marlo',
|
||||
'Nitin', 'Nayan', 'Naresh', 'Neerendra', 'Nirmal', 'Narayan', 'Nakul', 'Naval', 'Natwar', 'Naseer', 'Nazir', 'Nawab, ',
|
||||
'Nitin', 'Nayan', 'Naresh', 'Neerendra', 'Nirmal', 'Narayan', 'Nakul', 'Naval', 'Natwar', 'Naseer', 'Nazir', 'Nawab',
|
||||
'Parveen', 'Pravin', 'Pranab', 'Prabhat', 'Pradeep', 'Prasoon', 'Preet', 'Pranay', 'Parvez', 'Pirzada', 'Peter',
|
||||
'Omar', 'Obaid', 'Owais',
|
||||
'Qabeel', 'Qabool', 'Qadim',
|
||||
|
|
|
|||
|
|
@ -11,18 +11,15 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|||
|
||||
protected static $zeroToEight = array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
protected static $oneToNine = array(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
protected static $oneToEight = array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
protected static $mobileNumberFormats = array(
|
||||
'{{internationalCodePrefix}}9{{zeroToEight}}## ####',
|
||||
'{{internationalCodePrefix}} 9{{zeroToEight}}## ####',
|
||||
'9{{zeroToEight}}## ####',
|
||||
'{{internationalCodePrefix}}8{{oneToNine}}## ####',
|
||||
'{{internationalCodePrefix}} 8{{oneToNine}}## ####',
|
||||
'8{{oneToNine}}## ####',
|
||||
'{{internationalCodePrefix}}7{{oneToNine}}## ####',
|
||||
'{{internationalCodePrefix}} 7{{oneToNine}}## ####',
|
||||
'7{{oneToNine}}## ####',
|
||||
'{{internationalCodePrefix}}8{{oneToEight}}## ####',
|
||||
'{{internationalCodePrefix}} 8{{oneToEight}}## ####',
|
||||
'8{{oneToEight}}## ####',
|
||||
);
|
||||
|
||||
protected static $fixedLineNumberFormats = array(
|
||||
|
|
@ -103,8 +100,8 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|||
return static::randomElement(static::$zeroToEight);
|
||||
}
|
||||
|
||||
public function oneToNine()
|
||||
public function oneToEight()
|
||||
{
|
||||
return static::randomElement(static::$oneToNine);
|
||||
return static::randomElement(static::$oneToEight);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -97,7 +97,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
namespace Faker\Provider\en_US;
|
||||
|
||||
|
||||
class Payment extends \Faker\Provider\Payment
|
||||
{
|
||||
public function bankAccountNumber()
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -61,6 +61,6 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -75,6 +75,6 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -15,6 +15,9 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|||
'9########',
|
||||
'9##-##-####',
|
||||
'9##-######',
|
||||
);
|
||||
|
||||
protected static $mobileFormats = array(
|
||||
'+34 6## ## ####',
|
||||
'+34 6## ######',
|
||||
'+34 6########',
|
||||
|
|
@ -26,4 +29,19 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|||
'6##-##-####',
|
||||
'6##-######',
|
||||
);
|
||||
|
||||
protected static $tollFreeFormats = array(
|
||||
'900 ### ###',
|
||||
'800 ### ###',
|
||||
);
|
||||
|
||||
public static function mobileNumber()
|
||||
{
|
||||
return static::numerify(static::randomElement(static::$mobileFormats));
|
||||
}
|
||||
|
||||
public static function tollFreeNumber()
|
||||
{
|
||||
return static::numerify(static::randomElement(static::$tollFreeFormats));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -61,6 +61,6 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,4 +134,68 @@ class Person extends \Faker\Provider\Person
|
|||
|
||||
protected static $titleMale = array('آقای', 'استاد', 'دکتر', 'مهندس');
|
||||
protected static $titleFemale = array('خانم', 'استاد', 'دکتر', 'مهندس');
|
||||
|
||||
/**
|
||||
* This method returns a valid Iranian nationalCode
|
||||
* @example '8075859741'
|
||||
* @link https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%AA_%D8%B4%D9%86%D8%A7%D8%B3%D8%A7%DB%8C%DB%8C_%D9%85%D9%84%DB%8C#%D8%AD%D8%B3%D8%A7%D8%A8_%DA%A9%D8%B1%D8%AF%D9%86_%DA%A9%D8%AF_%DA%A9%D9%86%D8%AA%D8%B1%D9%84
|
||||
* @return string
|
||||
*/
|
||||
public static function nationalCode()
|
||||
{
|
||||
$area = self::createAreaCode();
|
||||
$core = self::createCoreCode();
|
||||
$control = self::createControlCode($area, $core);
|
||||
|
||||
return sprintf("%03d%06d%01d", $area, $core, $control);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method generates a 3-digit valid area code to be used in nationalCode
|
||||
* @return int|string
|
||||
*/
|
||||
private static function createAreaCode()
|
||||
{
|
||||
$area = "000";
|
||||
|
||||
while ($area == "000") {
|
||||
$area = static::numerify("###");
|
||||
}
|
||||
|
||||
return $area;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method randomly generates a 6-digit core code for nationalCode
|
||||
* @return string
|
||||
*/
|
||||
private static function createCoreCode()
|
||||
{
|
||||
return static::numerify("######");
|
||||
}
|
||||
|
||||
/**
|
||||
* This method uses the Iranian nationalCode validation algorithm to generate a valid 10-digit code
|
||||
* @param $area
|
||||
* @param $core
|
||||
* @link https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%AA_%D8%B4%D9%86%D8%A7%D8%B3%D8%A7%DB%8C%DB%8C_%D9%85%D9%84%DB%8C#%D8%AD%D8%B3%D8%A7%D8%A8_%DA%A9%D8%B1%D8%AF%D9%86_%DA%A9%D8%AF_%DA%A9%D9%86%D8%AA%D8%B1%D9%84
|
||||
* @return int
|
||||
*/
|
||||
private static function createControlCode($area, $core)
|
||||
{
|
||||
$subNationalCodeString = $area . $core;
|
||||
|
||||
$sum = 0;
|
||||
$count = 0;
|
||||
|
||||
for ($i = 10; $i > 1; $i--) {
|
||||
$sum += $subNationalCodeString[$count] * ($i);
|
||||
$count++;
|
||||
}
|
||||
|
||||
if (($sum % 11) < 2) {
|
||||
return $sum % 11;
|
||||
}
|
||||
return 11 - ($sum % 11);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,40 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|||
/**
|
||||
* @link https://fa.wikipedia.org/wiki/%D8%B4%D9%85%D8%A7%D8%B1%D9%87%E2%80%8C%D9%87%D8%A7%DB%8C_%D8%AA%D9%84%D9%81%D9%86_%D8%AF%D8%B1_%D8%A7%DB%8C%D8%B1%D8%A7%D9%86#.D8.AA.D9.84.D9.81.D9.86.E2.80.8C.D9.87.D8.A7.DB.8C_.D9.87.D9.85.D8.B1.D8.A7.D9.87
|
||||
*/
|
||||
protected static $formats = array(
|
||||
'021########',
|
||||
'026########',
|
||||
'031########',
|
||||
protected static $formats = array( // land line formts seprated by province
|
||||
"011########", //Mazandaran
|
||||
"013########", //Gilan
|
||||
"017########", //Golestan
|
||||
"021########", //Tehran
|
||||
"023########", //Semnan
|
||||
"024########", //Zanjan
|
||||
"025########", //Qom
|
||||
"026########", //Alborz
|
||||
"028########", //Qazvin
|
||||
"031########", //Isfahan
|
||||
"034########", //Kerman
|
||||
"035########", //Yazd
|
||||
"038########", //Chaharmahal and Bakhtiari
|
||||
"041########", //East Azerbaijan
|
||||
"044########", //West Azerbaijan
|
||||
"045########", //Ardabil
|
||||
"051########", //Razavi Khorasan
|
||||
"054########", //Sistan and Baluchestan
|
||||
"056########", //South Khorasan
|
||||
"058########", //North Khorasan
|
||||
"061########", //Khuzestan
|
||||
"066########", //Lorestan
|
||||
"071########", //Fars
|
||||
"074########", //Kohgiluyeh and Boyer-Ahmad
|
||||
"076########", //Hormozgan
|
||||
"077########", //Bushehr
|
||||
"081########", //Hamadan
|
||||
"083########", //Kermanshah
|
||||
"084########", //Ilam
|
||||
"086########", //Markazi
|
||||
"087########", //Kurdistan
|
||||
);
|
||||
|
||||
protected static $mobileNumberPrefixes = array(
|
||||
'0910#######',//mci
|
||||
'0911#######',
|
||||
|
|
@ -37,7 +66,7 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|||
'0920#######',
|
||||
'0921#######',
|
||||
'0937#######',
|
||||
'0937#######',
|
||||
'0990#######', // MCI
|
||||
);
|
||||
public static function mobileNumber()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,6 +59,6 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Payment extends \Faker\Provider\Payment
|
|||
*/
|
||||
public static function vat($spacedNationalPrefix = true)
|
||||
{
|
||||
$prefix = ($spacedNationalPrefix) ? "BE " : "BE";
|
||||
$prefix = $spacedNationalPrefix ? "BE " : "BE";
|
||||
|
||||
return sprintf("%s0%d", $prefix, self::randomNumber(9, true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,4 +87,29 @@ class Person extends \Faker\Provider\fr_FR\Person
|
|||
'Waeber', 'Weber', 'Wenger', 'Widmer', 'Wyss',
|
||||
'Zbinden', 'Zimmermann',
|
||||
);
|
||||
|
||||
/**
|
||||
* Generates a valid random AVS13 (swiss social security) number
|
||||
*
|
||||
* This function will generate a valid random AVS13 number and return it
|
||||
* as a formatted string.
|
||||
*
|
||||
* @see https://www.zas.admin.ch/zas/fr/home/partenaires-et-institutions-/navs13.html
|
||||
* @return string
|
||||
*/
|
||||
public static function avs13()
|
||||
{
|
||||
$p = array(
|
||||
756,
|
||||
self::numerify('####'),
|
||||
self::numerify('####'),
|
||||
self::numerify('#'),
|
||||
);
|
||||
|
||||
$checksum = \Faker\Calculator\Ean::checksum(implode($p));
|
||||
|
||||
$avs = sprintf("%s.%s.%s.%s%s", $p[0], $p[1], $p[2], $p[3], $checksum);
|
||||
|
||||
return $avs;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -49,6 +49,6 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ class Internet extends \Faker\Provider\Internet
|
|||
protected static $tld = array(
|
||||
'com', 'net', 'org', 'asia', 'tv', 'biz', 'info', 'in', 'name', 'co',
|
||||
'ac.id', 'sch.id', 'go.id', 'mil.id', 'co.id', 'or.id', 'web.id',
|
||||
'my.id', 'biz.id', 'desa.id',
|
||||
'my.id', 'biz.id', 'desa.id', 'id',
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,6 +194,44 @@ class Person extends \Faker\Provider\Person
|
|||
protected static $titleFemale = array('dr.', 'drg.', 'Dr.', 'Hj.');
|
||||
|
||||
/**
|
||||
* @link http://informasipedia.com/wilayah-indonesia/daftar-kabupaten-kota-di-indonesia/
|
||||
*/
|
||||
protected static $birthPlaceCode = array(
|
||||
'1101', '1102', '1103', '1104', '1105', '1106', '1107', '1108', '1109', '1110', '1111', '1112', '1113', '1114', '1115', '1116',
|
||||
'1117', '1118', '1171', '1172', '1173', '1174', '1175', '1201', '1202', '1203', '1204', '1205', '1206', '1207', '1208', '1209',
|
||||
'1210', '1211', '1212', '1213', '1214', '1215', '1216', '1217', '1218', '1219', '1220', '1221', '1222', '1223', '1224', '1225',
|
||||
'1271', '1272', '1273', '1274', '1275', '1276', '1277', '1278', '1301', '1302', '1303', '1304', '1305', '1306', '1307', '1308',
|
||||
'1309', '1310', '1311', '1312', '1371', '1372', '1373', '1374', '1375', '1376', '1377', '1401', '1402', '1403', '1404', '1405',
|
||||
'1406', '1407', '1408', '1409', '1410', '1471', '1472', '1501', '1502', '1503', '1504', '1505', '1506', '1507', '1508', '1509',
|
||||
'1571', '1572', '1601', '1602', '1603', '1604', '1605', '1606', '1607', '1608', '1609', '1610', '1611', '1612', '1613', '1671',
|
||||
'1672', '1673', '1674', '1701', '1702', '1703', '1704', '1705', '1706', '1707', '1708', '1709', '1771', '1801', '1802', '1803',
|
||||
'1804', '1805', '1806', '1807', '1808', '1809', '1810', '1811', '1812', '1813', '1871', '1872', '1901', '1902', '1903', '1904',
|
||||
'1905', '1906', '1971', '2101', '2102', '2103', '2104', '2105', '2171', '2172', '3101', '3171', '3172', '3173', '3174', '3175',
|
||||
'3201', '3202', '3203', '3204', '3205', '3206', '3207', '3208', '3209', '3210', '3211', '3212', '3213', '3214', '3215', '3216',
|
||||
'3217', '3218', '3271', '3272', '3273', '3274', '3275', '3276', '3277', '3278', '3279', '3301', '3302', '3303', '3304', '3305',
|
||||
'3306', '3307', '3308', '3309', '3310', '3311', '3312', '3313', '3314', '3315', '3316', '3317', '3318', '3319', '3320', '3321',
|
||||
'3322', '3323', '3324', '3325', '3326', '3327', '3328', '3329', '3371', '3372', '3373', '3374', '3375', '3376', '3401', '3402',
|
||||
'3403', '3404', '3471', '3501', '3502', '3503', '3504', '3505', '3506', '3507', '3508', '3509', '3510', '3511', '3512', '3513',
|
||||
'3514', '3515', '3516', '3517', '3518', '3519', '3520', '3521', '3522', '3523', '3524', '3525', '3526', '3527', '3528', '3529',
|
||||
'3571', '3572', '3573', '3574', '3575', '3576', '3577', '3578', '3579', '3601', '3602', '3603', '3604', '3671', '3672', '3673',
|
||||
'3674', '5101', '5102', '5103', '5104', '5105', '5106', '5107', '5108', '5171', '5201', '5202', '5203', '5204', '5205', '5206',
|
||||
'5207', '5208', '5271', '5272', '5301', '5302', '5303', '5304', '5305', '5306', '5307', '5308', '5309', '5310', '5311', '5312',
|
||||
'5313', '5314', '5315', '5316', '5317', '5318', '5319', '5320', '5321', '5371', '6101', '6102', '6103', '6104', '6105', '6106',
|
||||
'6107', '6108', '6109', '6110', '6111', '6112', '6171', '6172', '6201', '6202', '6203', '6204', '6205', '6206', '6207', '6208',
|
||||
'6209', '6210', '6211', '6212', '6213', '6271', '6301', '6302', '6303', '6304', '6305', '6306', '6307', '6308', '6309', '6310',
|
||||
'6311', '6371', '6401', '6402', '6403', '6407', '6408', '6409', '6411', '6471', '6472', '6474', '6501', '6502', '6503', '6504',
|
||||
'6571', '7101', '7102', '7103', '7104', '7105', '7106', '7107', '7108', '7109', '7110', '7111', '7171', '7201', '7202', '7203',
|
||||
'7204', '7205', '7206', '7207', '7208', '7209', '7210', '7211', '7212', '7271', '7301', '7302', '7303', '7304', '7305', '7306',
|
||||
'7307', '7308', '7309', '7310', '7311', '7312', '7313', '7314', '7315', '7316', '7317', '7318', '7322', '7324', '7326', '7371',
|
||||
'7372', '7373', '7401', '7402', '7403', '7404', '7405', '7406', '7407', '7408', '7409', '7410', '7411', '7412', '7413', '7414',
|
||||
'7415', '7471', '7472', '7501', '7502', '7503', '7504', '7505', '7571', '7601', '7602', '7603', '7604', '7605', '7606', '8101',
|
||||
'8102', '8103', '8104', '8105', '8106', '8107', '8108', '8109', '8171', '8172', '8201', '8202', '8203', '8204', '8205', '8206',
|
||||
'8207', '8208', '8271', '8272', '9101', '9102', '9103', '9104', '9105', '9106', '9107', '9108', '9109', '9110', '9111', '9112',
|
||||
'9113', '9114', '9115', '9116', '9117', '9118', '9119', '9120', '9121', '9122', '9123', '9124', '9125', '9126', '9127', '9128',
|
||||
'9171', '9201', '9202', '9203', '9204', '9205', '9206', '9207', '9208', '9209', '9210', '9211', '9212', '9271',
|
||||
);
|
||||
|
||||
/**
|
||||
* For academic title
|
||||
* @link http://id.wikipedia.org/wiki/Gelar_akademik
|
||||
*/
|
||||
|
|
@ -266,7 +304,8 @@ class Person extends \Faker\Provider\Person
|
|||
public function nik($gender = null, $birthDate = null)
|
||||
{
|
||||
# generate first numbers (region data)
|
||||
$nik = $this->generator->numerify('######');
|
||||
$nik = $this->birthPlaceCode();
|
||||
$nik .= $this->generator->numerify('##');
|
||||
|
||||
if (!$birthDate) {
|
||||
$birthDate = $this->generator->dateTimeBetween();
|
||||
|
|
@ -286,8 +325,19 @@ class Person extends \Faker\Provider\Person
|
|||
$nik .= $birthDate->format('my');
|
||||
|
||||
# add last random digits
|
||||
$nik.= $this->generator->numerify('####');
|
||||
$nik .= $this->generator->numerify('####');
|
||||
|
||||
return $nik;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates birth place code for NIK
|
||||
*
|
||||
* @link https://id.wikipedia.org/wiki/Nomor_Induk_Kependudukan
|
||||
* @link http://informasipedia.com/wilayah-indonesia/daftar-kabupaten-kota-di-indonesia/
|
||||
*/
|
||||
protected function birthPlaceCode()
|
||||
{
|
||||
return static::randomElement(static::$birthPlaceCode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,4 +85,17 @@ class Person extends \Faker\Provider\it_IT\Person
|
|||
'Weber', 'Widmer',
|
||||
'Zanetti', 'Zanini', 'Zimmermann',
|
||||
);
|
||||
|
||||
/**
|
||||
* Generates a valid random AVS13 (swiss social security) number
|
||||
*
|
||||
* This function acts as an alias for the function defined in the fr_CH provider.
|
||||
*
|
||||
* @see \Faker\Provider\fr_CH\Person::avs13()
|
||||
* @return string
|
||||
*/
|
||||
public static function avs13()
|
||||
{
|
||||
return \Faker\Provider\fr_CH\Person::avs13();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +61,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Address extends \Faker\Provider\Address
|
|||
'デンマーク', 'ジブチ共和国', 'ドミニカ国', 'ドミニカ共和国',
|
||||
'エクアドル', 'エジプト', 'エルサルバドル', '赤道ギニア共和国', 'エリトリア', 'エストニア', 'エチオピア',
|
||||
'フェロー諸島', 'フォークランド諸島', 'フィジー共和国', 'フィンランド', 'フランス', 'フランス領ギアナ', 'フランス領ポリネシア', 'フランス領極南諸島',
|
||||
'ガボン', 'ガンビア', 'グルジア', 'ドイツ', 'ガーナ', 'ジブラルタル', 'ギリシャ', 'グリーンランド', 'グレナダ', 'グアドループ', 'グアム', 'グアテマラ', 'ガーンジー', 'ギニア', 'ギニアビサウ', 'ガイアナ',
|
||||
'ガボン', 'ガンビア', 'ジョージア', 'ドイツ', 'ガーナ', 'ジブラルタル', 'ギリシャ', 'グリーンランド', 'グレナダ', 'グアドループ', 'グアム', 'グアテマラ', 'ガーンジー', 'ギニア', 'ギニアビサウ', 'ガイアナ',
|
||||
'ハイチ', 'ハード島とマクドナルド諸島', 'バチカン市国', 'ホンジュラス', '香港', 'ハンガリー',
|
||||
'アイスランド', 'インド', 'インドネシア', 'イラン', 'イラク', 'アイルランド共和国', 'マン島', 'イスラエル', 'イタリア',
|
||||
'ジャマイカ', '日本', 'ジャージー島', 'ヨルダン',
|
||||
|
|
|
|||
|
|
@ -598,7 +598,7 @@ EOT;
|
|||
protected static function explode($text)
|
||||
{
|
||||
$chars = array();
|
||||
foreach (preg_split('//u', preg_replace('/\s+/', '', $text)) as $char) {
|
||||
foreach (preg_split('//u', preg_replace('/\s+/u', '', $text)) as $char) {
|
||||
if ($char !== '') {
|
||||
$chars[] = $char;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ class Person extends \Faker\Provider\Person
|
|||
'{{firstNameFemale}} {{lastNameFemale}}',
|
||||
);
|
||||
|
||||
protected static $lastNameFormat = array(
|
||||
'{{firstNameMale}}',
|
||||
'{{firstNameFemale}}',
|
||||
);
|
||||
|
||||
protected static $titleMale = array('p.', 'ponas');
|
||||
|
||||
protected static $titleFemale = array('p.', 'ponia', 'panelė');
|
||||
|
|
@ -247,6 +252,22 @@ class Person extends \Faker\Provider\Person
|
|||
'Petrauskaitė', 'Vasiliauskaitė', 'Butkutė', 'Pociūtė', 'Lukoševičiūtė', 'Balčiūnaitė', 'Kavaliauskaitė'
|
||||
);
|
||||
|
||||
/**
|
||||
* @param string|null $gender 'male', 'female' or null for any
|
||||
* @example 'Doe'
|
||||
* @return string
|
||||
*/
|
||||
public function lastName($gender = null)
|
||||
{
|
||||
if ($gender === static::GENDER_MALE) {
|
||||
return static::lastNameMale();
|
||||
} elseif ($gender === static::GENDER_FEMALE) {
|
||||
return static::lastNameFemale();
|
||||
}
|
||||
|
||||
return $this->generator->parse(static::randomElement(static::$lastNameFormat));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return male last name
|
||||
* @return string
|
||||
|
|
@ -302,11 +323,11 @@ class Person extends \Faker\Provider\Person
|
|||
$birthdate = \Faker\Provider\DateTime::dateTimeThisCentury();
|
||||
}
|
||||
|
||||
$genderNumber = ($gender == 'male') ? (int) 1 : (int) 0;
|
||||
$genderNumber = ($gender == 'male') ? 1 : 0;
|
||||
$firstNumber = (int) floor($birthdate->format('Y') / 100) * 2 - 34 - $genderNumber;
|
||||
|
||||
$datePart = $birthdate->format('ymd');
|
||||
$randomDigits = (string) ( ! $randomNumber || strlen($randomNumber < 3)) ? static::numerify('###') : substr($randomNumber, 0, 3);
|
||||
$randomDigits = (string) ( ! $randomNumber || strlen($randomNumber) < 3) ? static::numerify('###') : substr($randomNumber, 0, 3);
|
||||
$partOfPerosnalCode = $firstNumber . $datePart . $randomDigits;
|
||||
|
||||
$sum = self::calculateSum($partOfPerosnalCode, 1);
|
||||
|
|
@ -318,7 +339,7 @@ class Person extends \Faker\Provider\Person
|
|||
}
|
||||
|
||||
$sum = self::calculateSum($partOfPerosnalCode, 2);
|
||||
$liekana = (int) $sum % 11;
|
||||
$liekana = $sum % 11;
|
||||
|
||||
$lastNumber = ($liekana !== 10) ? $liekana : 0;
|
||||
return $firstNumber . $datePart . $randomDigits . $lastNumber;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class Person extends \Faker\Provider\Person
|
|||
|
||||
/**
|
||||
* Generate an identification number.
|
||||
*
|
||||
*
|
||||
* @example ИЙ92011412
|
||||
*/
|
||||
public function idNumber()
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class Person extends \Faker\Provider\Person
|
|||
*/
|
||||
$randomDigits = (string)static::numerify('##');
|
||||
|
||||
switch($gender) {
|
||||
switch ($gender) {
|
||||
case static::GENDER_MALE:
|
||||
$genderDigit = static::randomElement(array(1,3,5,7,9));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -19,4 +19,23 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|||
'9#######',
|
||||
'4#######',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array Norweign mobile number formats
|
||||
*/
|
||||
protected static $mobileFormats = array(
|
||||
'+474#######',
|
||||
'+479#######',
|
||||
'9## ## ###',
|
||||
'4## ## ###',
|
||||
'9#######',
|
||||
'4#######',
|
||||
);
|
||||
|
||||
public function mobileNumber()
|
||||
{
|
||||
$format = static::randomElement(static::$mobileFormats);
|
||||
|
||||
return self::numerify($this->generator->parse($format));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ class Person extends \Faker\Provider\Person
|
|||
'Kabindra', 'Kailash', 'Kalyan', 'Kamal', 'Kamod', 'Kapil', 'Karan', 'Karna', 'Khagendra', 'Kishor', 'Kris', 'Krishna', 'Krisus', 'Kuber',
|
||||
'Lakshman', 'Lalit', 'Lava', 'Lochan', 'Lokesh',
|
||||
'Madhav', 'Madhukar', 'Madhur', 'Mandeep', 'Manish', 'Manjul', 'Manoj', 'Milan', 'Mohit', 'Mridul',
|
||||
'Nabin', 'Nakul', 'Narayan', 'Narendra', 'Naresh', 'Neil', 'Nerain', 'Nirajan', 'Nirajan', 'Nirmal', 'Nirupam', 'Nischal', 'Nishad', 'Nishant', 'Nutan',
|
||||
'Nabin', 'Nakul', 'Narayan', 'Narendra', 'Naresh', 'Neil', 'Nerain', 'Nirajan', 'Nirmal', 'Nirupam', 'Nischal', 'Nishad', 'Nishant', 'Nutan',
|
||||
'Om',
|
||||
'Paras', 'Parikshit', 'Parimal', 'Pawan', 'Piyush', 'Prabal', 'Prabesh', 'Prabhat', 'Prabin', 'Prajwal', 'Prakash', 'Pramesh', 'Pramod', 'Pranaya', 'Pranil', 'Prasanna', 'Prashant', 'Prasun', 'Pratap', 'Pratik', 'Prayag', 'Prianshu', 'Prithivi', 'Purna', 'Pushkar',
|
||||
'Raghab', 'Rahul', 'Rajan', 'Rajesh', 'Rakesh', 'Ramesh', 'Ranjan', 'Ranjit', 'Ricky', 'Rijan', 'Rishab', 'Rishikesh', 'Rohan', 'Rohit', 'Roshan',
|
||||
'Sabin', 'Sachit', 'Safal', 'Sahaj', 'Sahan', 'Sajal', 'Sakar', 'Samir', 'Sanchit', 'Sandesh', 'Sanjay', 'Sanjeev', 'Sankalpa', 'Santosh', 'Sarad', 'Saroj', 'Sashi', 'Saumya', 'Sevak', 'Shailesh', 'Shakti', 'Shamundra', 'Shantanu', 'Shashank', 'Shashwat', 'Shekar', 'Shyam', 'Siddhartha', 'Sitaram', 'Sohan', 'Sohil', 'Soviet', 'Spandan', 'Subal', 'Subham', 'Subodh', 'Sudan', 'Sudhir', 'Sudin', 'Sudip', 'Sujan', 'Sujit', 'Sukanta', 'Sumel', 'Sunil', 'Suraj', 'Suraj', 'Surendra', 'Surya', 'Sushant', 'Sushil', 'Suyash', 'Suyog', 'Swagat', 'Swapnil', 'Swarup',
|
||||
'Sabin', 'Sachit', 'Safal', 'Sahaj', 'Sahan', 'Sajal', 'Sakar', 'Samir', 'Sanchit', 'Sandesh', 'Sanjay', 'Sanjeev', 'Sankalpa', 'Santosh', 'Sarad', 'Saroj', 'Sashi', 'Saumya', 'Sevak', 'Shailesh', 'Shakti', 'Shamundra', 'Shantanu', 'Shashank', 'Shashwat', 'Shekar', 'Shyam', 'Siddhartha', 'Sitaram', 'Sohan', 'Sohil', 'Soviet', 'Spandan', 'Subal', 'Subham', 'Subodh', 'Sudan', 'Sudhir', 'Sudin', 'Sudip', 'Sujan', 'Sujit', 'Sukanta', 'Sumel', 'Sunil', 'Suraj', 'Surendra', 'Surya', 'Sushant', 'Sushil', 'Suyash', 'Suyog', 'Swagat', 'Swapnil', 'Swarup',
|
||||
'Tej', 'Tilak', 'Tirtha', 'Trailokya', 'Trilochan',
|
||||
'Udit', 'Ujjwal', 'Umesh', 'Uttam',
|
||||
'Yogendra', 'Yogesh', 'Yuvaraj',
|
||||
|
|
@ -80,7 +80,7 @@ class Person extends \Faker\Provider\Person
|
|||
protected static $lastName = array(
|
||||
'Acharya', 'Adhikari', 'Agarwal', 'Amatya', 'Aryal',
|
||||
'Baidya', 'Bajracharya', 'Balami', 'Banepali', 'Baniya', 'Banjade', 'Baral', 'Basnet', 'Bastakoti', 'Bastola', 'Basyal', 'Belbase', 'Bhandari', 'Bhatta', 'Bhattarai', 'Bhusal', 'Bijukchhe', 'Bisht', 'Bohara', 'Budathoki', 'Byanjankar',
|
||||
'Chalise', 'Chamling', 'Chapagain', 'Chaudhary', 'Chhetri', 'Chhetri',
|
||||
'Chalise', 'Chamling', 'Chapagain', 'Chaudhary', 'Chhetri',
|
||||
'Dahal', 'Dangol', 'Dawadi', 'Devkota', 'Dhakal', 'Dhamla', 'Dhaubhadel', 'Dhungel',
|
||||
'Gauchan', 'Gautam', 'Ghale', 'Ghimire', 'Giri', 'Golchha', 'Gurung', 'Gyalzen', 'Gyawali',
|
||||
'Hamal', 'Himanshu', 'Humagain',
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Payment extends \Faker\Provider\Payment
|
|||
*/
|
||||
public static function vat($spacedNationalPrefix = true)
|
||||
{
|
||||
$prefix = ($spacedNationalPrefix) ? "BE " : "BE";
|
||||
$prefix = $spacedNationalPrefix ? "BE " : "BE";
|
||||
|
||||
return sprintf("%s0%d", $prefix, self::randomNumber(9, true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,33 +4,109 @@ namespace Faker\Provider\nl_NL;
|
|||
|
||||
class Company extends \Faker\Provider\Company
|
||||
{
|
||||
protected static $formats = array(
|
||||
'{{lastName}} {{companySuffix}}',
|
||||
'{{lastName}} {{lastName}} {{companySuffix}}',
|
||||
'{{lastName}}',
|
||||
'{{lastName}}',
|
||||
/**
|
||||
* @see https://nl.wikipedia.org/wiki/Lijst_van_beroepen
|
||||
*/
|
||||
protected static $jobTitleFormat = array(
|
||||
'Aankondiger', 'Acceptant', 'Accountant', 'Accountmanager', 'Acrobaat', 'Acteur', 'Activiteitenbegeleider', 'Actuaris', 'Acupuncturist', 'Adjudant', 'Administrateur', 'Advertentiezetter', 'Adviseur', 'Advocaat', 'Agent', 'Agrariër', 'Akoepedist', 'Akoesticus', 'Alchemist', 'Allergoloog', 'Altist', 'Amanuensis', 'Ambtenaar', 'Ambulancebegeleider', 'Ambulancechauffeur', 'Ambulanceverpleegkundige', 'Analist', 'Anatoom', 'Andragoog', 'Androloog', 'Anesthesist', 'Anesthesiemedewerker', 'Animeermeisje', 'Antiquaar', 'Antiquair', 'Apotheker', 'Apothekersassistent', 'Applicatieontwikkelaar', 'Arbeidsanalist', 'Arbeidsbemiddelaar', 'Arbeidsdeskundige', 'Arbeidsfysioloog', 'Arbeidsgeneesheer', 'Arbeidshygiënist', 'Archeoloog', 'Architect', 'Archivaris', 'Archivist', 'Arrangeur', 'Artdirector', 'Artiest', 'Arts', 'Assuradeur', 'Astrofysicus', 'Astroloog', 'Astronaut', 'Astronoom', 'Audioloog', 'Audiometrist', 'Audiotherapeut', 'Auditor', 'Autohandelaar', 'Automonteur', 'Autoplaatwerker', 'Autospuiter',
|
||||
'Bacterioloog', 'Badmeester', 'Baggermachinist', 'Baggermolenarbeider', 'Baker', 'Bakker', 'Baliemedewerker', 'Balletdanser', 'Ballroomdanser', 'Bandagist', 'Bandenmonteur', 'Bankbediende', 'Bankdirecteur', 'Banketbakker', 'Bankmakelaar', 'Bankwerker', 'Barbediende', 'Barhouder', 'Barman', 'Basketballer', 'Bassist', 'Beademingsassistent', 'Bedienaar', 'Bediener', 'Bedrijfsbrandweer', 'Bedrijfseconoom', 'Bedrijfshoofd', 'Bedrijfsjurist', 'Bedrijfskassier', 'Bedrijfskundige', 'Bedrijfsleermeester', 'Bedrijfsleider', 'Bedrijfsorganisatiedeskundige', 'Bedrijfspolitieagent', 'Bedrijfsrecherche', 'Bedrijfsverpleegkundige', 'Beeldapparatuurbediener', 'Beeldhouwer', 'Beenhouwer', 'Begeleider', 'Begrafenispersoneel', 'Begrotingscalculator', 'Behanger', 'Beheerder', 'Beiaardier', 'Bejaardenverzorgende', 'Belastingambtenaar', 'Belastingconsulent', 'Beleidsambtenaar', 'Beleidsmedewerker', 'Belichter', 'Bergingsduiker', 'Beroepskeuzeadviseur', 'Beroepsmilitair', 'Beroepssporter', 'Bestekschrijver', 'Besteksorteerder', 'Bestekzoeker', 'Bestuurder', 'Bestuurskundige', 'Betonmolenbaas', 'Betontimmerman', 'Betonstaalvlechter', 'Betonwerker', 'Beul', 'Beveiligingsapparatuur', 'Beveiligingsbeambte', 'Bewaarder', 'Bewaker', 'Bewegingstherapeut', 'Bezorger', 'Bibliothecaris', 'Bibliotheekassistent', 'Bierbrouwer', 'Bijenkorfvlechter', 'Bijenkweker', 'Bijkantoorhouder', 'Binderijpersoneel', 'Binnenhuisarchitect', 'Biochemicus', 'Biograaf', 'Bioloog', 'Bioscoopoperateur', 'Bitumineerder', 'Bloemist', 'Bloemkweker', 'Bloemschikker', 'Bloemsierkunstenaar', 'Bode', 'Boekbinder', 'Boekhouder', 'Boekillustrator', 'Boer', 'Bontkleermaker', 'Bontsnijder', 'Bookmaker', 'Boomchirurg', 'Boomkweker', 'Boomverzorger', 'Boordwerktuigkundige', 'Boormachinist', 'Boorpersoneel', 'Bootsman', 'Bosbaas', 'Bosbouwkundige', 'Boswachter', 'Botenbouwer', 'Bouwcalculator', 'Bouwhistoricus', 'Bouwkundig tekenaar', 'Bouwliftbediener', 'Bouwpromotor', 'Bouwopzichter', 'Bouwvakker', 'Bouwvaktimmerman', 'Brandmeester', 'Brandveiligheidsdeskundige', 'Brandwacht', 'Brandweerman', 'Brandweercommandant', 'Brandweeronderofficier', 'Breimachinesteller', 'Bromfietshersteller', 'Bronboorder', 'Buffetbediende', 'Buikspreker', 'Buitenbandenvulkaniseur', 'Buitendienstmedewerker', 'Burgemeester', 'Buschauffeur', 'Budgetcoach', 'Butler',
|
||||
'Cabaretier', 'Caféhouder', 'Cafetariamedewerker', 'Caissière', 'Calculator', 'Callgirl', 'Cameraman', 'Cardioloog', 'Cargadoor', 'Carrosseriebouwer', 'Cartograaf', 'Cellist', 'Chauffeur', 'Chef', 'Chemicus', 'Chiropodist', 'Chirurg', 'Chocolademaker', 'Chocolatier', 'Choreograaf', 'Cilindermaker', 'Cineast', 'Cipier', 'Circusartiest', 'Circusdirecteur', 'Civiel ingenieur', 'Classicus', 'Clown', 'Coach', 'Codeur', 'Collationist', 'Colporteur', 'Columnist', 'Combinatiefunctionaris', 'Commentator', 'Commissaris', 'Commissionair', 'Completeerder', 'Compliance officer', 'Componist', 'Computeroperator', 'Computerprogrammeur', 'Conciërge', 'Conducteur', 'Conservator', 'Constructeur', 'Constructiebankwerker', 'Constructiesamenbouwer', 'Constructieschilder', 'Consulent', 'Contactlensspecialist', 'Controleur', 'Controller', 'Coördinator', 'Copywriter', 'Counselor', 'Corrector', 'Correpetitor', 'Correspondent', 'Creatief therapeut', 'Crècheleidster', 'Criminoloog', 'Criticus', 'Croupeur', 'Croupier', 'Cultuurtechnicus', 'Curator', 'Cursuscoördinator', 'Cursusleider',
|
||||
'Dakdekker', 'Dakpannenvormer', 'Danser', 'Dansleraar', 'Database administrator', 'Debitant', 'Decaan', 'Declarant', 'Decoratieschilder', 'Decorschilder', 'Degelpersdrukker', 'Dekkledenmaker', 'Dekpersoneel', 'Delfstoffenbewerker', 'Demonstrateur', 'Dermatoloog', 'Deskundige', 'Detailhandelaar', 'Detective', 'Deurenzetter', 'Deurwaarder', 'Dichter', 'Dieetkok', 'Dienstbode', 'Dienstleider', 'Diepdrukgraveur', 'Dierenarts', 'Dierenartsassistent', 'Dierenasielhouder', 'Dierentrainer', 'Dierenverzorger', 'Diëtist', 'Diplomaat', 'Directeur', 'Directieassistent', 'Directiesecretaresse', 'Dirigent', 'Diskjockey', 'Districtschef', 'Districtsverpleegkundige', 'Docent', 'Documentalist', 'Documentencontroleur', 'Dokmeester', 'Doktersassistent', 'Dominee', 'Doodgraver', 'Douaneambtenaar', 'Dozenmaker', 'Draaier', 'Dramadocent', 'Dramatherapeut', 'Drogist', 'Drukker', 'Drukkerijbinder', 'Drukwerkvoorbereiders', 'Drummer', 'Duiker',
|
||||
'Econoom', 'Ecotechnisch manager', 'Edelmetaalbewerker', 'Edelsmid', 'Editor', 'EDP-auditor', 'Egyptoloog', 'Eindredacteur', 'Elektricien', 'Elektromonteur', 'Elektronicamonteur', 'Elektronicus', 'Elektrotechnicus', 'Encyclopedist', 'Enquêteur', 'Ergonoom', 'Ergotherapeut', 'Ertskundige', 'Essayeur', 'Essayist', 'Etaleur', 'Etnograaf', 'Etnoloog', 'Etymoloog', 'Evangelist', 'Examinator', 'Expediteur', 'Explantatiemedewerker',
|
||||
'Fabrikant', 'Facilitair Manager', 'Facturist', 'Farmacoloog', 'Fietsenmaker', 'Fijnbankwerker', 'Filiaalhouder', 'Filmer', 'Filmregisseur', 'Filosoof', 'Filterreiniger', 'Financieel analist', 'Fluitenbouwer', 'Fotograaf', 'Fotograveur', 'Fotolaborant', 'Fotolaboratoriumbediende', 'Fotolithograaf', 'Fotoredacteur', 'Framebouwer', 'Frezer', 'Fruitteler', 'Fysicus', 'Fysioloog', 'Fysiotherapeut',
|
||||
'Galvaniseur', 'Game Designer', 'Garagehouder', 'Garderobejuffrouw', 'Garnalenpeller', 'Gasleidinglegger', 'Gastvrouw', 'Gecommitteerde', 'Gedeputeerde', 'Gemeentesecretaris', 'Geneeskundige', 'Generaal', 'Geodeet', 'Geograaf', 'Geoloog', 'Gerant', 'Gerechtsdeurwaarder', 'Gereedschapsmaker', 'Gereedschapssmid', 'Geschiedkundige', 'Gevangenbewaarder', 'Gezaghebber', 'Gezagvoerder', 'Gezondheidsbegeleider', 'Gezondheidsfysicus', 'Gezondheidstechnicus', 'Gidsenschrijver', 'Gieterijtechnicus', 'Gietmachinebediener', 'Gigolo', 'Gipsverbandmeester', 'Gitarist', 'Glasblazer', 'Glasgraveur', 'Glasslijper', 'Glaszetter', 'Glazenhaler', 'Glazenmaker', 'Glazenwasser', 'Goochelaar', 'Goudsmid', 'Goudzoeker', 'Grafdelver', 'Graficus', 'Grafisch ontwerper', 'Grafoloog', 'Graveur', 'Griendwerker', 'Griffier', 'Grimeur', 'Groenteteler', 'Groepsleider', 'Groepsvervoer', 'Grondsteward', 'Grondstewardess', 'Grondwerker', 'Groothandelaar', 'Gymleraar', 'Gynaecoloog',
|
||||
'Handelaar', 'Handelscorrespondent', 'Handwever', 'Havenarbeider', 'Havenmeester', 'Heemraad', 'Heftruckchauffeur', 'Heibaas', 'Heier', 'Heilpedagoog', 'Heilsoldaat', 'Helpdeskmedewerker', 'Herbergier', 'Hijsmachinist', 'Historicus', 'Hoefsmid', 'Hoekman', 'Hofmeester', 'Homeopaat', 'Hondenfokker', 'Hondentoiletteerder', 'Hondentrimmer', 'Hoofd', 'Hoofdambtenaar', 'Hoofdcontroleur', 'Hoofdredacteur', 'Hoofduitvoerder', 'Hoofdverpleegkundige', 'Hoofdwerktuigkundige', 'Hoogleraar', 'Hoornist', 'Hoorspelregisseur', 'Horlogemaker', 'Hostess', 'Hotelier', 'Hotelmanager', 'Hotelportier', 'Houtbewerker', 'Houtmodelmaker', 'Houtsnijder', 'Houtvester', 'Houtwarensamensteller', 'Hovenier', 'Huidtherapeut', 'Huisarts', 'Huisbaas', 'Huisbewaarder', 'Huishoudhulp', 'Huishoudster', 'Huisschilder', 'Hulparbeider', 'Hulpautomonteur', 'Hulpkok', 'Hulpverkoper', 'Huurmoordenaar', 'Hydroloog',
|
||||
'IJscoman', 'IJzervlechter', 'Illusionist', 'Illustrator', 'Imam', 'Imker', 'Importeur', 'Impresario', 'Industrieel ontwerper', 'Ingenieur', 'Inkoper', 'Inrijger', 'Inseminator', 'Inspecteur', 'Installateur', 'Instructeur', 'Instrumentalist', 'Instrumentmaker', 'Interieurarchitect', 'Interieurverzorger', 'Interne accountant', 'Internist',
|
||||
'Jachtopzichter', 'Jager', 'Jongleur', 'Journalist', 'Justitieel Aanklager', 'Juwelier', 'Judoleraar',
|
||||
'Kaartenzetter', 'Kaasmaker', 'Kabelsplitser', 'Kabelwerker', 'Kanaalmeester', 'Kantonnier', 'Kantoorhulp', 'Kapitein', 'Kapper', 'Kappershulp', 'Kardinaal', 'Karteerder', 'Kartonnagewerker', 'Kassamedewerker', 'Kassier', 'Kelner', 'Keizer', 'Keramist', 'Kermisexploitant', 'Kernmaker', 'Kerstman', 'Ketelmetselaar', 'Keukenassistent', 'Keukenknecht', 'Keurder', 'Keuringsambtenaar', 'Keurmeester', 'Kinderverzorgende', 'Kleermaker', 'Kleidelver', 'Kleinhandelaar', 'Klerk', 'Kleuterleider', 'Klokkenmaker', 'Klompenmaker', 'Kloosterling', 'Kno-arts', 'Koerier', 'Koetsier', 'Kok', 'Komiek', 'Kompel', 'Kooiker', 'Kooiman', 'Koordirigent', 'Koperslager', 'Kostendeskundige', 'Koster', 'Kostprijscalculator', 'Kozijnenmaker', 'Kraamverzorgende', 'Kraamhulp', 'Kraanmachinist', 'Kredietanalist', 'Kredietbeoordelaar', 'Kruidendokter', 'Kruier', 'Kuiper', 'Kunstcriticus', 'Kunstenaar', 'Kunstschilder', 'Kustlichtwachter', 'Kwitantieloper',
|
||||
'Laadschopbestuurder', 'Laborant', 'Laboratoriumbediende', 'Lader', 'Ladingmeester', 'Lakei', 'Landarbeider', 'Landbouwer', 'Landbouwkundige', 'Landbouwmachinebestuurder', 'Landbouwmilieubeheer', 'Landbouwwerktuigenhersteller', 'Landmeetkundige', 'Landmeettechnicus', 'Landmeter', 'Landschapsarchitect', 'Landschapsbeheer', 'Lasinspecteur', 'Lasser', 'Lastechnicus', 'Lector', 'Ledertechnoloog', 'Lederwarenmaker', 'Leerbewerker', 'Leerkracht', 'Leeuwentemmer', 'Legionair', 'Leidekker', 'Leidinggevende', 'Leraar', 'Letterkundige', 'Leurder', 'Lichtdrukker', 'Lichtmatroos', 'Lijstenmaker', 'Linktrainer', 'Literator', 'Literatuurcriticus', 'Literatuuronderzoeker', 'Logopedist', 'Logotherapeut', 'Lokettist', 'Longfunctieassistent', 'Loodgieter', 'Loods', 'Loodschef', 'Loonadministrateur', 'Loopbaancoach', 'Losser', 'Luchtverkeersleider',
|
||||
'Maatnemer', 'Maatschappelijk medewerker', 'Maatschappelijk werker', 'Maatschoenmaker', 'Machine vouwer', 'Machinebankwerker', 'Machinebediende', 'Machinesteller', 'Manegehouder', 'Machinist', 'Magazijnbediende', 'Magazijnbeheerder', 'Magazijnknecht', 'Magnetiseur', 'Makelaar', 'Managementassistent', 'Manager', 'Mandenmaker', 'Mannequin', 'Manueel therapeut', 'Marconist', 'Marinier', 'Maritiem Officier', 'Marechaussee', 'Marketingadviseur', 'Marketingassistent', 'Marktkoopman', 'Masseur', 'Mathematicus', 'Matroos', 'Mattenmaker', 'Medewerker', 'Mediatrainer', 'Meester restauratiestukadoor', 'Meettechnicus', 'Melkboer', 'Metaalbewerker', 'Metaalbrander', 'Metaalbuiger', 'Metaalfrezer', 'Metaalgieter', 'Metaalkundige', 'Meteoroloog', 'Meteropnemer', 'Metselaar', 'Meubelbeeldhouwer', 'Meubelmaker', 'Meubelstoffeerder', 'Meubelstoffennaaister', 'Meubeltekenaar', 'Mijnbouwkundige', 'Middenstander', 'Mijnwerker', 'Milieudeskundige', 'Milieuhygiënist', 'Militair', 'Mimespeler', 'Min', 'Mineralenbewerker', 'Minister', 'Minister-president', 'Model', 'Modelmaker', 'Modelnaaister', 'Molenaar', 'Modeontwerper', 'Mondhygiënist', 'Monnik', 'Monteur', 'Mosselman', 'Motordemonteur', 'Motordrijver', 'Motormonteur', 'Mouldroomtechnicus', 'Munter', 'Muntmeester', 'Museumconservator', 'Museumgids', 'Museumhouder', 'Museummedewerker', 'Musicus', 'Muziekinstrumentenmaker', 'Muziekprogrammeur',
|
||||
'Naaister', 'Nachtwaker', 'Nagelstyliste', 'Nasynchronisatieregisseur', 'Natuurkundeleraar', 'Natuurkundige', 'Natuurwetenschapper', 'Navigator', 'Neonatoloog', 'Nettenboeter', 'Netwerkbeheerder', 'Neurochirurg', 'Neuroloog', 'Neurofysioloog', 'Nieuwslezer', 'Nijverheidsconsulent', 'Nko-arts', 'Nopster', 'Notaris', 'Nucleair geneeskundige',
|
||||
'Ober', 'Oberkelner', 'Objectleider', 'Oceanoloog', 'Octrooigemachtigde', 'Officier', 'Officier van justitie', 'Olieslager', 'Omroeper', 'Omsteller', 'Oncoloog', 'Onderhoudsloodgieter', 'Onderhoudsman', 'Onderhoudsmedewerker', 'Onderhoudsmonteur', 'Ondernemer', 'Onderofficier', 'Ondersteunende', 'Onderwaterwerker', 'Onderwijsassistent', 'Onderwijstechnicus', 'Onderwijzer', 'Onderzoeker', 'Onderzoeker in opleiding', 'Ontdekkingsreiziger', 'Ontmijner', 'Ontvlekker', 'Ontwerper', 'Oogarts', 'Operateur', 'Operatieassistent', 'Operational auditor', 'Operator', 'Opkoper', 'Opperman', 'Opsporingsambtenaar', 'Opsporingsingenieur', 'Opticien', 'Optometrist', 'Opvoedingsconsulent', 'Opvoedingsvoorlichter', 'Opzichter', 'Organist', 'Organizer', 'Ornitholoog', 'Orthodontist', 'Orthopedagoog', 'Orthopeed', 'Orthoptist', 'ORL-arts', 'Osteopaat', 'Ouvreuse', 'Ovenman',
|
||||
'Paardenfokker', 'Pakhuischef', 'Paleontoloog', 'Palfrenier', 'Pandjesbaas', 'Papierschepper', 'Papiervernisser', 'Parkeerwachter', 'Parketvloerenlegger', 'Parketwacht', 'Pastoor', 'Paswerker', 'Patholoog', 'Patholoog-anatoom', 'Patissier', 'Patroonmaker', 'Patroontekenaar', 'Pedagoog', 'Pedicure', 'Perronopzichter', 'Perser', 'Personeelsfunctionaris', 'Peuterwerker', 'Pianist', 'Pianostemmer', 'Piccolo', 'Pijpfitter', 'Pikeur', 'Piloot', 'Plaatwerker', 'Planner', 'Plantenteeltdeskundige', 'Plantsoenmedewerker', 'Plasticvormer', 'Pleitbezorger', 'Poelier', 'Poepruimer', 'Poetser', 'Podiatrist', 'Podoloog', 'Poffertjesbakker', 'Polisopmaker', 'Politicus', 'Politieagent', 'Politiecommissaris', 'Politie-inspecteur', 'Politiek analist', 'Pontschipper', 'Pooier', 'Porder', 'Portier', 'Portretfotograaf', 'Postbediende', 'Postbesteller', 'Postbode', 'Postcommandant', 'Postexpediteur', 'Postsorteerder', 'Pottenbakker', 'Predikant', 'Premier', 'Presentator', 'President', 'Priester', 'Probleemanalist', 'Procesmanager', 'Procesoperator', 'Procureur', 'Procureur des Konings', 'Producer', 'Productenmaker', 'Productensorteerder', 'Productiebegeleider', 'Productieleider', 'Productiemedewerker', 'Productieplanner', 'Professor', 'Professioneel worstelaar', 'Programmamaker', 'Programmeur', 'Projectadviseur', 'Projectleider', 'Projectmanager', 'Projectontwikkelaar', 'Promovendus', 'Prostitué', 'Prostituee', 'Pruikenmaker', 'Psychiater', 'Psychologisch assistent', 'Psycholoog', 'Psychotherapeut', 'Psychomotorisch kindertherapeut', 'Purser', 'Putjesschepper',
|
||||
'Quarantaine-beambte', 'Quizmaster', 'Quantity surveyor',
|
||||
'Raadsman', 'Radarwaarnemer', 'Radiotherapeutisch laborant', 'Radiograaf', 'Radiolaborant', 'Radiotechnicus', 'Radiotelegrafist', 'Rangeerder', 'Recensent', 'Receptionist', 'Recherchekundige', 'Rechercheur', 'Rechtbanktekenaar', 'Rechter', 'Reclame-ontwerper', 'Reclameacquisiteur', 'Reclamedeskundige', 'Reclametekenaar', 'Redacteur', 'Redactiechef', 'Regisseur', 'Registeraccountant', 'Reiniger', 'Reinigingsdienstarbeider', 'Reisleider', 'Reisprogrammeur', 'Reisverkoper', 'Rekenaar', 'Rekwisietenmaker', 'Rentmeester', 'Reparateur', 'Ridder', 'Repetitor', 'Reproductietekenaar', 'Restauranthouder', 'Rietmeubelmaker', 'Rietwerker', 'Rijtuigspuiter', 'Rijwielhersteller', 'Rolluikentimmerman', 'Rondvaartgids', 'Röntgenoloog', 'Ruimtevaarder',
|
||||
'Samensteller', 'Saunahouder', 'Scenarioschrijver', 'Schaaldierenkweker', 'Schaaldierenpeller', 'Schaapherder', 'Schadecorrespondent', 'Schadetaxateur', 'Schakelbordwachter', 'Schaker', 'Schapenscheerder', 'Scharensliep', 'Scheepskapitein', 'Scheepskok', 'Scheepspurser', 'Scheepsschilder', 'Scheepstimmerman', 'Scheidsrechter', 'Scheikundige', 'Schillenboer', 'Schipper', 'Schoenfabrieksarbeider', 'Schoenhersteller', 'Schoenmaker', 'Schoolbegeleider', 'Schooldecaan', 'Schooldirecteur', 'Schoolinspecteur', 'Schoonheidsmasseur', 'Schoonheidsspecialiste', 'Schoonmaker', 'Schoorsteenveger', 'Schotter', 'Schrijftolk', 'Schrijver', 'Schuurder', 'Secretaresse', 'Secretariaatsmedewerker', 'Secretaris', 'Seismoloog', 'Seizoenarbeider', 'Seksuoloog', 'Selecteur', 'Sergeant', 'Seroloog', 'Serveerster', 'Setdresser', 'Sigarenmaker', 'Sinoloog', 'Sjorder', 'Sjouwer', 'Slachter', 'Slager', 'Slagwerker', 'Slijter', 'Sloper', 'Sluiswachter', 'Smeerder', 'Smelter', 'Smid', 'Snackbarbediende', 'Snackbarhouder', 'Snijder', 'Sociotherapeut', 'Softwareontwikkelaar', 'Soldaat', 'Soldeerder', 'Sommelier', 'Sondeerder', 'Songwriter', 'Souschef', 'Spoeler', 'Souffleur', 'Specialist', 'Spelersmakelaar', 'Speltherapeut', 'Spindoppenmonteur', 'Spion', 'Sportinstructeur', 'Stadsomroeper', 'Stadstimmerman', 'Stanser', 'Stationschef', 'Statisticus', 'Stedenbouwkundige', 'Steenbewerker', 'Steenfabrikant', 'Steenhouwer', 'Steenzetter', 'Steigerbouwer', 'Steigermaker', 'Stenotypist', 'Stereotypeur', 'Sterilisatieassistent', 'Stewardess', 'Stoelenmatter', 'Stoffeerder', 'Storingsmonteur', 'Straatverkoper', 'Strandjutter', 'Stratenmaker', 'Stripper', 'Stucwerker', 'Stukadoor', 'Stuurman', 'Stuwadoor', 'Stylist', 'Stypengalvaniseur', 'Surinamist', 'Systeemanalist', 'Systeembeheerder', 'Systeemontwerper', 'Systeemprogrammeur',
|
||||
'Takelaar', 'Tandarts', 'Tandartsassistente', 'Tandtechnicus', 'Tapper', 'Taxichauffeur', 'Taxidermist', 'Technicus', 'Technisch Oogheelkundig Assistent', 'Technisch tekenaar', 'Tegelzetter', 'Tekenaar', 'Tekstschrijver', 'Telecommunicatiemonteur', 'Telefoniste', 'Telegrafist', 'Televisieregisseur', 'Televisietechnicus', 'Telexist', 'Tennisser', 'Terrazzovloerenlegger', 'Terreinchef', 'Tester', 'Textieldrukker', 'Textiellaborant', 'Textielopmaker', 'Textielproductenmaker', 'Theateragent', 'Theatertechnicus', 'Therapeut', 'Timmerman', 'Tingieter', 'Toetsenist', 'Tolk', 'Toneelfigurant', 'Toneelmeester', 'Toneelregisseur', 'Toneelschrijver', 'Toneelspeler', 'Torenkraanmonteur', 'Totalisatormedewerker', 'Touringcarchauffeur', 'Touwslager', 'Traceur', 'Trainingsacteur', 'Traiteur', 'Trambestuurder', 'Transportplanner', 'Treinbestuurder', 'Treinconducteur', 'Treindienstleider', 'Treinduwer', 'Treinmachinist', 'Trekkerchauffeur', 'Tuiger', 'Tuinarchitect', 'Tuinder', 'Tuinman', 'Typiste',
|
||||
'Uitgever', 'Uitsmijter', 'Uitvaartbegeleider', 'Uitvinder', 'Uitvoerder', 'Uroloog', 'Uurwerkmaker',
|
||||
'Vakkenvuller', 'Valet', 'Veearts', 'Veehouder', 'Veeverloskundige', 'Veiligheidsbeambte', 'Veilinghouder', 'Verfspuiter', 'Vergaderstenograaf', 'Verhuizer', 'Verhuurder', 'Verkeersdienstsimulator', 'Verkeersinspecteur', 'Verkeerskundige', 'Verkeersleider', 'Verkeersonderzoeker', 'Verkeersplanoloog', 'Verkoopchef', 'Verkoopstyliste', 'Verkoper', 'Verloskundige', 'Verpleeghulp', 'Verpleegkundige', 'Verslaggever', 'Verspaner', 'Vertaler', 'Vertegenwoordiger', 'Vervoer', 'Vervoersinspecteur', 'Verwarmingsinstallateur', 'Verwarmingsmonteur', 'Verzekeringsagent', 'Verzekeringsdeskundige', 'Verzekeringsinspecteur', 'Verzorgende', 'Vicaris', 'Videoclipregisseur', 'Videojockey', 'Vioolbouwer', 'Violist', 'Vinoloog', 'Viroloog', 'Visagiste', 'Visfileerder', 'Visser', 'Vj', 'Vleeswarenmaker', 'Vlieger', 'Vliegtuigplaatwerker', 'Vliegtuigtimmerman', 'Vloerlegger', 'Voedingsmiddelentechnoloog', 'Voedingsvoorlichter', 'Voeger', 'Voertuigbekleder', 'Voetballer', 'Volder of Voller', 'Voorganger', 'Voorlichter', 'Voorlichtingsfunctionaris', 'Voorraadadministrateur', 'Voorzitter', 'Vormende', 'Vormenmaker', 'Vormer', 'Vormgever', 'Vrachtwagenchauffeur', 'Vuilnisman', 'Vulkanoloog', 'Vuurspuwer', 'Vuurtorenwachter', 'Vroedvrouw',
|
||||
'Waard', 'Waardijn', 'Waarzegger', 'Wachtcommandant', 'Wachter', 'Wachtmeester', 'Wagenmaker', 'Wasser', 'Wasserettehouder', 'Waterbouwkundige', 'Webdesigner', 'Weefmachinesteller', 'Weerkundige', 'Weerpresentator', 'Wegenbouwarbeider', 'Wegenbouwmachinist', 'Wegmarkeerder', 'Werkleider-dokmeester', 'Werktuigbouwkundige', 'Werktuigkundige', 'Werkvoorbereider', 'Wethouder', 'Wijkmeester', 'Wijnboer', 'Winkelbediende', 'Winkelier', 'Wiskundige', 'Wisselkassier', 'Wisselmaker', 'Woonbegeleider',
|
||||
'Xylofonist',
|
||||
'Yogaleraar',
|
||||
'Zaakwaarnemer', 'Zakenman', 'Zanger', 'Zeefdrukker', 'Zeeman', 'Zeepzieder', 'Zeilmaker', 'Zelfstandig ondernemer', 'Zetter', 'Ziekenhuisapotheker', 'Ziekenhuishygiënist', 'Ziekenverzorgende', 'Zilversmid', 'Zweminstructeur', 'Zoöloog',
|
||||
);
|
||||
|
||||
protected static $companySuffix = array('VOF', 'CV', 'LLP', 'BV', 'NV', 'IBC', 'CSL', 'EESV', 'SE', 'CV', 'Stichting', '& Zonen', '& Zn');
|
||||
protected static $companySuffix = array(
|
||||
'VOF', 'CV', 'LLP', 'BV', 'NV', 'IBC', 'CSL','EESV', 'SE', 'CV', 'Stichting', '& Zonen', '& Zn'
|
||||
);
|
||||
|
||||
protected static $product = array(
|
||||
'Keuken', 'Media', 'Meubel', 'Sanitair', 'Elektronica', 'Schoenen',
|
||||
'Zorg', 'Muziek', 'Audio', 'Televisie', 'Pasta', 'Lunch', 'Boeken', 'Cadeau', 'Kunst', 'Tuin', 'Klus',
|
||||
'Video', 'Sieraden', 'Kook', 'Woon', 'Pizza', 'Mode', 'Haar', 'Kleding', 'Antiek', 'Interieur', 'Gadget',
|
||||
'Foto', 'Computer', 'Witgoed', 'Bruingoed', 'Broeken', 'Pakken', 'Maatpak', 'Fietsen', 'Speelgoed',
|
||||
'Barbecue', 'Sport', 'Fitness', 'Brillen', 'Bakkers', 'Drank', 'Zuivel', 'Pret', 'Vis', 'Wijn', 'Salade',
|
||||
'Terras', 'Borrel', 'Dieren', 'Aquaria', 'Verf', 'Behang', 'Tegel', 'Badkamer', 'Decoratie'
|
||||
);
|
||||
|
||||
protected static $type = array(
|
||||
'Markt', 'Kampioen', 'Expert', 'Concurrent', 'Shop', 'Expert', 'Magazijn',
|
||||
'Dump', 'Store', 'Studio', 'Boulevard', 'Fabriek', 'Groep', 'Huis', 'Salon', 'Vakhuis', 'Winkel', 'Gigant',
|
||||
'Reus', 'Plaza', 'Park', 'Tuin'
|
||||
);
|
||||
|
||||
protected static $store = array(
|
||||
'Boekhandel', 'Super', 'Tabakzaak', 'Schoenmaker', 'Kaashandel', 'Slagerij',
|
||||
'Smederij', 'Bakkerij', 'Bierbrouwer', 'Kapperszaak', 'Groenteboer', 'Bioboer', 'Fietsenmaker', 'Opticien',
|
||||
'Café', 'Garage'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @example 'Fietsenmaker Zijlemans'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function company()
|
||||
{
|
||||
$determinator = static::numberBetween(0, 2);
|
||||
switch ($determinator) {
|
||||
case 0:
|
||||
$companyName = static::randomElement(static::$product) . ' ' . static::randomElement(static::$type);
|
||||
break;
|
||||
case 1:
|
||||
$companyName = static::randomElement(static::$product) . strtolower(static::randomElement(static::$type));
|
||||
break;
|
||||
case 2:
|
||||
$companyName = static::randomElement(static::$store) . ' ' . $this->generator->lastName;
|
||||
break;
|
||||
}
|
||||
|
||||
if (0 !== static::numberBetween(0, 1)) {
|
||||
return $companyName . ' ' . static::randomElement(static::$companySuffix);
|
||||
}
|
||||
|
||||
return $companyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Belasting Toegevoegde Waarde (BTW) = VAT
|
||||
*
|
||||
* @example 'NL123456789B01'
|
||||
*
|
||||
* @see (dutch) http://www.belastingdienst.nl/wps/wcm/connect/bldcontentnl/belastingdienst/zakelijk/btw/administratie_bijhouden/btw_nummers_controleren/uw_btw_nummer
|
||||
*
|
||||
* @see http://www.belastingdienst.nl/wps/wcm/connect/bldcontentnl/belastingdienst/zakelijk/btw/administratie_bijhouden/btw_nummers_controleren/uw_btw_nummer
|
||||
*
|
||||
* @return string VAT Number
|
||||
*/
|
||||
public static function vat()
|
||||
{
|
||||
return sprintf("%s%d%s%d", 'NL', self::randomNumber(9, true), 'B', self::randomNumber(2, true));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias dutch vat number format
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function btw()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Person extends \Faker\Provider\Person
|
|||
'mr.', 'dr.', 'ir.', 'drs', 'bacc.', 'kand.', 'dr.h.c.', 'prof.', 'ds.', 'ing.', 'bc.'
|
||||
);
|
||||
|
||||
private static $suffix = array(
|
||||
protected static $suffix = array(
|
||||
'BA', 'Bsc', 'LLB', 'LLM', 'MA', 'Msc', 'MPhil', 'D', 'PhD', 'AD', 'B', 'M'
|
||||
);
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ class Person extends \Faker\Provider\Person
|
|||
'Huijzing', 'Huisman', 'Huls', 'Hulshouts', 'Hulskes', 'Hulst', 'van Hulten', 'Huurdeman', 'van het Heerenveen',
|
||||
'Jaceps', 'Jacobi', 'Jacobs', 'Jacquot', 'de Jager', 'Jans', 'Jansdr', 'Janse', 'Jansen', 'Jansen', 'Jansse',
|
||||
'Janssen', 'Janssens', 'Jasper dr', 'Jdotte', 'Jeggij', 'Jekel', 'Jerusalem', 'Jochems',
|
||||
'Jones', 'de Jong', 'Jonkman', 'Joosten', 'Jorlink', 'Jorrisen', 'van Jumiège', 'Jurrijens', 'Köster',
|
||||
'Jones', 'de Jong', 'Jonkman', 'Joosten', 'Jorlink', 'Jorissen', 'van Jumiège', 'Jurrijens', 'Köster',
|
||||
'van der Kaay', 'de Kale', 'Kallen', 'Kalman', 'Kamp', 'Kamper', 'Karels', 'Kas', 'van Kasteelen', 'Kathagen',
|
||||
'Keijser', 'de Keijser', 'Keijzer', 'de Keijzer', 'Keltenie', 'van Kempen', 'Kerkhof', 'Ketel', 'Ketting',
|
||||
'der Kijnder', 'van der Kint', 'Kirpenstein', 'Kisman', 'van Klaarwater', 'van de Klashorst', 'Kleibrink',
|
||||
|
|
@ -288,7 +288,7 @@ class Person extends \Faker\Provider\Person
|
|||
*/
|
||||
public static function titleMale()
|
||||
{
|
||||
return static::title();
|
||||
return static::randomElement(static::$title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -296,7 +296,7 @@ class Person extends \Faker\Provider\Person
|
|||
*/
|
||||
public static function titleFemale()
|
||||
{
|
||||
return static::title();
|
||||
return static::randomElement(static::$title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -342,7 +342,6 @@ class Person extends \Faker\Provider\Person
|
|||
} else {
|
||||
$nr[0] = 1;
|
||||
$nr[1]++;
|
||||
|
||||
}
|
||||
}
|
||||
return implode('', array_reverse($nr));
|
||||
|
|
|
|||
|
|
@ -69,4 +69,78 @@ class Payment extends \Faker\Provider\Payment
|
|||
{
|
||||
return static::iban($countryCode, $prefix, $length);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see list of Brazilians banks (2018-02-15), source: https://pt.wikipedia.org/wiki/Lista_de_bancos_do_Brasil
|
||||
*/
|
||||
protected static $banks = array(
|
||||
'BADESUL Desenvolvimento S.A. – Agência de Fomento/RS',
|
||||
'Banco Central do Brasil',
|
||||
'Banco da Amazônia',
|
||||
'Banco de Brasília',
|
||||
'Banco de Desenvolvimento de Minas Gerais',
|
||||
'Banco de Desenvolvimento do Espírito Santo',
|
||||
'Banco de Desenvolvimento do Paraná',
|
||||
'Banco do Brasil',
|
||||
'Banco do Estado de Sergipe Banese Estadual',
|
||||
'Banco do Estado do Espírito Santo Banestes',
|
||||
'Banco do Estado do Pará',
|
||||
'Banco do Estado do Rio Grande do Sul',
|
||||
'Banco do Nordeste do Brasil',
|
||||
'Banco Nacional de Desenvolvimento Econômico e Social',
|
||||
'Banco Regional de Desenvolvimento do Extremo Sul',
|
||||
'Caixa Econômica Federal',
|
||||
'Banco ABN Amro S.A.',
|
||||
'Banco Alfa',
|
||||
'Banco Banif',
|
||||
'Banco BBM',
|
||||
'Banco BMG',
|
||||
'Banco Bonsucesso',
|
||||
'Banco BTG Pactual',
|
||||
'Banco Cacique',
|
||||
'Banco Caixa Geral - Brasil',
|
||||
'Banco Citibank',
|
||||
'Banco Credibel',
|
||||
'Banco Credit Suisse',
|
||||
'Góis Monteiro & Co',
|
||||
'Banco Fator',
|
||||
'Banco Fibra',
|
||||
'Agibank',
|
||||
'Banco Guanabara',
|
||||
'Banco Industrial do Brasil',
|
||||
'Banco Industrial e Comercial',
|
||||
'Banco Indusval',
|
||||
'Banco Inter',
|
||||
'Banco Itaú BBA',
|
||||
'Banco ItaúBank',
|
||||
'Banco Itaucred Financiamentos',
|
||||
'Banco Mercantil do Brasil',
|
||||
'Banco Modal Modal',
|
||||
'Banco Morada',
|
||||
'Banco Pan',
|
||||
'Banco Paulista',
|
||||
'Banco Pine',
|
||||
'Banco Renner',
|
||||
'Banco Ribeirão Preto',
|
||||
'Banco Safra',
|
||||
'Banco Santander',
|
||||
'Banco Sofisa',
|
||||
'Banco Topázio',
|
||||
'Banco Votorantim',
|
||||
'Bradesco Bradesco',
|
||||
'Itaú Unibanco',
|
||||
'Banco Original',
|
||||
'Banco Neon',
|
||||
'Nu Pagamentos S.A',
|
||||
'XP Investimentos Corretora de Câmbio Títulos e Valores Mobiliários S.A',
|
||||
);
|
||||
|
||||
/**
|
||||
* @example 'Banco Neon'
|
||||
*/
|
||||
public static function bank()
|
||||
{
|
||||
return static::randomElement(static::$banks);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Faker\Provider\pt_PT;
|
|||
|
||||
class Address extends \Faker\Provider\Address
|
||||
{
|
||||
protected static $streetPrefix = array('Av.', 'Avenida', 'R.', 'Rua', 'Travessa', 'Largo');
|
||||
protected static $streetPrefix = array('Av.', 'Avenida', 'R.', 'Rua', 'Tv.', 'Travessa', 'Lg.', 'Largo');
|
||||
|
||||
protected static $streetNameFormats = array(
|
||||
'{{streetPrefix}} {{lastName}}',
|
||||
|
|
|
|||
|
|
@ -46,9 +46,8 @@ class PhoneNumber extends \Faker\Provider\PhoneNumber
|
|||
public function phoneNumber()
|
||||
{
|
||||
$type = static::randomElement(array_keys(static::$normalFormats));
|
||||
$number = static::numerify(static::randomElement(static::$normalFormats[$type]));
|
||||
|
||||
return $number;
|
||||
return static::numerify(static::randomElement(static::$normalFormats[$type]));
|
||||
}
|
||||
|
||||
public static function tollFreePhoneNumber()
|
||||
|
|
|
|||
|
|
@ -30,6 +30,18 @@ class Company extends \Faker\Provider\Company
|
|||
'Реч', 'Флот', 'Cиб', 'Каз', 'Инж', 'Вод', 'Пив', 'Хмель', 'Мяс', 'Томск', 'Омск', 'Север', 'Лен'
|
||||
);
|
||||
|
||||
protected static $catchPhraseWords = array(
|
||||
array(
|
||||
'Адаптивная', 'Дополнительно', 'Улучшить', 'Ассимилировали', 'Автоматическая', 'Сбалансированный', 'Бизнес-ориентированных', 'Централизации', 'Клонировать', 'Совместимость', 'Настраивается', 'Кросс-группа', 'Кросс-платформы', 'Клиентоориентированного', 'Децентрализации', 'Де-инженерии', 'Передал', 'Оцифровки', 'Распространяться', 'Разное', 'Габаритами', 'Расширения', 'Предприятия', 'Эргономичность', 'Эксклюзив', 'Расширенный', 'Очного', 'Целенаправленный', 'Фронтовые', 'Полностью настраиваемый', 'Функции', 'Основной', 'Будущее', 'Низовые', 'Горизонтальной', 'Реализовано', 'Инновационных', 'Интегрированный', 'Интуитивно', 'Обратная', 'Управлять', 'Обязательно', 'Наблюдение', 'Многоканальной', 'Многосторонний', 'Многослойная', 'Многоуровневые', 'Сеть', 'Объектно-ориентированный', 'Открытая архитектура', 'Открытое', 'Оперативная', 'Оптимизация', 'Дополнительно', 'Органический', 'Организованная', 'Стойкость', 'Постоянный', 'Постепенно', 'Полярности', 'Превентивный', 'Инициативный', 'Прибыльных', 'Глубокий', 'Программируемый', 'Прогрессивный', 'Ключ', 'Ориентированные на качество', 'Реактивная', 'Реорганизации', 'Повторно контекст', 'Модернизированной', 'Снижается', 'Копирования', 'Размер', 'Надежный', 'Бесшовные', 'Обеспеченный', 'Собственной активации', 'Запрашиваемого', 'Автономный', 'Упорядочить', 'Переключение', 'Синхронизированы', 'Синергетический', 'Согласования', 'Командный', 'Общий', 'Тройной буферизацией', 'Универсальный', 'Размера', 'Комплектация', 'Пользователя', 'Удобный', 'Универсальный', 'Виртуальный', 'Фантазер',
|
||||
),
|
||||
array(
|
||||
'24часа', '24/7', '3-го поколения', '4-го поколения', '5-го поколения', '6-го поколения', 'активация', 'анализ', 'ассиметричный', 'асинхронный', 'ориентированныйнаориентацию', 'фон', 'мониторинг пропускной способности', 'двунаправленный', 'раздвоенный', 'итоговый', 'ясное мышление', 'управляемый клиентом', 'клиент-сервер', 'связный', 'составной', 'контекстно-зависимый', 'контентно-ориентированный', 'выделенный', 'управляемый спросом', 'дидактический', 'направленный', 'дискретный', 'динамический', 'экоцентричный', 'уполномочивающий', 'охватывающий', 'четный', 'исполнительный', 'явный', 'отказоустойчивый', 'передний план', 'свежее мышление', 'полный диапазон', 'глобальный', 'включенный в сетку', 'эвристический', 'высокоуровневый', 'целостный', 'однородный', 'человеческий ресурс', 'гибридный', 'эффективный', 'инкрементальный', 'нематериальный', 'интерактивный', 'промежуточный', 'ведущий', 'локальный', 'логистический', 'развернутый', 'методический', 'критический', 'мобильный', 'модульный', 'мотивирующий', 'мультимедиа', 'мультисостояние', 'многозадачность', 'национальный', 'основанныйнапотребностях', 'нейтральный', 'следующее поколение', 'энергонезависимый', 'объектно-ориентированный', 'оптимальный', 'оптимизирующий', 'радикальный', 'в реальном времени', 'взаимный', 'региональный', 'отзывчивый', 'масштабируемый', 'вторичный', 'ориентированный на решение', 'стабильный', 'статический', 'систематический', 'системный', 'материальный', 'третичный', 'переходный', 'равномерный', 'восходящий тренд', 'ориентированный на пользователя', 'добавленная стоимость', 'веб-поддержка', 'хорошо модулированный', 'нулевое администрирование', 'нулевой дефект', 'нулевая терпимость',
|
||||
),
|
||||
array(
|
||||
'способности', 'открыть', 'адаптер', 'алгоритм', 'альянс', 'анализатор', 'приложения', 'подходить', 'архитектура', 'архив', 'время', 'отношение', 'тест', 'блокчейн', 'возможность', 'емкость', 'вызов', 'цепи', 'сотрудничество', 'сложность', 'понятие', 'конгломерат', 'случай', 'ядро', 'база данных', 'хранилищ данных', 'определение', 'эмуляция', 'кодировка', 'шифрования', 'экстранет', 'прошивки', 'гибкости', 'фокус-групповых', 'прогноз', 'раму', 'основы', 'функция', 'функциональные возможности', 'групповой', 'оборудование', 'число', 'иерархия', 'хаб', 'реализация', 'инфопосредников', 'инфраструктура', 'инициатива', 'монтаж', 'интерфейс', 'интранет', 'базы знаний', 'плечо', 'матрицы', 'матрица', 'методика', 'промежуточного', 'миграции', 'модель', 'модератор', 'контроль', 'мораторий', 'нейронные сети', 'согласование', 'парадигмы', 'параллельность', 'политика', 'портал', 'товара', 'производительности', 'проект', 'прогноз', 'протокол', 'сервис-бюро', 'программное обеспечение', 'решение', 'стандартизации', 'стратегия', 'структура', 'успех', 'надстройка', 'поддержка', 'синергия', 'команду', 'производительности', 'время', 'набор', 'загрузки', 'сайт', 'работников',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* @link https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%8F:%D0%9F%D1%80%D0%BE%D1%84%D0%B5%D1%81%D1%81%D0%B8%D0%B8
|
||||
* @note Randomly took from this list - some jobs titles for each letter
|
||||
|
|
@ -46,6 +58,19 @@ class Company extends \Faker\Provider\Company
|
|||
'Экономист', 'Электромонтёр'
|
||||
);
|
||||
|
||||
/**
|
||||
* @example 'Robust full-range hub'
|
||||
*/
|
||||
public function catchPhrase()
|
||||
{
|
||||
$result = array();
|
||||
foreach (static::$catchPhraseWords as &$word) {
|
||||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @example 'ООО АсбестЦементМонтаж'
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@ class Person extends \Faker\Provider\Person
|
|||
'Меркушев', 'Лыткин', 'Туров',
|
||||
);
|
||||
|
||||
protected static $lastNameSuffix = array('a', '');
|
||||
|
||||
/**
|
||||
* Return male middle name
|
||||
*
|
||||
|
|
@ -154,4 +156,24 @@ class Person extends \Faker\Provider\Person
|
|||
static::GENDER_FEMALE,
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return last name for the specified gender.
|
||||
*
|
||||
* @param string|null $gender A gender of the last name should be generated
|
||||
* for. If the argument is skipped a random gender will be used.
|
||||
* @return string Last name
|
||||
*/
|
||||
public function lastName($gender = null)
|
||||
{
|
||||
$lastName = static::randomElement(static::$lastName);
|
||||
|
||||
if (static::GENDER_FEMALE === $gender) {
|
||||
return $lastName . 'a';
|
||||
} elseif (static::GENDER_MALE === $gender) {
|
||||
return $lastName;
|
||||
}
|
||||
|
||||
return $lastName . static::randomElement(static::$lastNameSuffix);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,6 +59,6 @@ class Company extends \Faker\Provider\Company
|
|||
$result[] = static::randomElement($word);
|
||||
}
|
||||
|
||||
return join($result, ' ');
|
||||
return join(' ', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ class Person extends \Faker\Provider\Person
|
|||
'Cyprich', 'Cíger', 'Dacej', 'Danko', 'Debnár', 'Dej', 'Dekýš', 'Doležal', 'Dostál', 'Dočolomanský', 'Drajna', 'Droppa', 'Dubovský',
|
||||
'Dudek', 'Dula', 'Dulla', 'Dusík', 'Dvonč', 'Dzurjanin', 'Dávid', 'Fabian', 'Fabián', 'Fajnor', 'Farkašovský', 'Feldek', 'Fico', 'Filc',
|
||||
'Filip', 'Finka', 'Ftorek', 'Galis', 'Gallo', 'Gašpar', 'Gašparovič', 'Gocník', 'Golonka', 'Greguš', 'Grznár', 'Hablák', 'Habšuda',
|
||||
'Haluška', 'Halák', 'Hanko', 'Hanzal', 'Hanzel', 'Hanzel', 'Haščák', 'Heretik', 'Hečko', 'Hečková', 'Hlaváček', 'Hlinka', 'Hochschorner',
|
||||
'Haluška', 'Halák', 'Hanko', 'Hanzal', 'Hanzel', 'Hanzel', 'Haščák', 'Heretik', 'Hečko', 'Hlaváček', 'Hlinka', 'Hochschorner',
|
||||
'Holub', 'Holuby', 'Horváth', 'Hossa', 'Hraško', 'Hric', 'Hrmo', 'Hrušovský', 'Huba', 'Hudáček', 'Hála', 'Ihnačák', 'Janoška', 'Jantošovič',
|
||||
'Janík', 'Jonata', 'Jurina', 'Jurinová', 'Jurík', 'Jáni', 'Jánošík', 'Kaliský', 'Karul', 'Karvaš', 'Keníž', 'Klapka', 'Klaus', 'Kolník',
|
||||
'Janík', 'Jonata', 'Jurina', 'Jurík', 'Jáni', 'Jánošík', 'Kaliský', 'Karul', 'Karvaš', 'Keníž', 'Klapka', 'Klaus', 'Kolník',
|
||||
'Konstantinidis', 'Korec', 'Kostrec', 'Kováč', 'Kováčik', 'Koza', 'Kubík', 'Kučera', 'Labuda', 'Langoš', 'Lepšík', 'Lexa', 'Lintner',
|
||||
'Lubina', 'Lukáč', 'Lupták', 'Líška', 'Majeský', 'Malachovský', 'Malíšek', 'Marián', 'Masaryk', 'Maslo', 'Matiaško', 'Medveď', 'Menyhért',
|
||||
'Mečiar', 'Mečíř', 'Mikloško', 'Mikulík', 'Mikuš', 'Mikúš', 'Mišík', 'Mojžiš', 'Mokroš', 'Molnár', 'Moravčík', 'Musil', 'Mydlo', 'Nagy',
|
||||
|
|
|
|||
|
|
@ -234,14 +234,14 @@ class Address extends \Faker\Provider\Address
|
|||
protected static $city = array(
|
||||
'Вінниця',
|
||||
'Луцьк',
|
||||
'Дніпропетровськ',
|
||||
'Дніпро',
|
||||
'Донецьк',
|
||||
'Житомир',
|
||||
'Ужгород',
|
||||
'Запоріжжя',
|
||||
'Івано-Франківськ',
|
||||
'Київ',
|
||||
'Кіровоград',
|
||||
'Кропивницький',
|
||||
'Луганськ',
|
||||
'Львів',
|
||||
'Миколаїв',
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ class Person extends \Faker\Provider\Person
|
|||
protected static $firstNameMale = array(
|
||||
'Євген', 'Адам', 'Олександр', 'Олексій', 'Анатолій', 'Андрій', 'Антон', 'Артем', 'Артур', 'Борис', 'Вадим', 'Валентин', 'Валерій',
|
||||
'Василь', 'Віталій', 'Володимир', 'Владислав', 'Геннадій', 'Георгій', 'Григорій', 'Данил', 'Данило', 'Денис', 'Дмитро',
|
||||
'Євген', 'Іван', 'Ігор', 'Йосип', 'Кирил', 'Костянтин', 'Лев', 'Леонід', 'Максим', 'Мирослав', 'Михайло', 'Назар',
|
||||
'Євгеній', 'Іван', 'Ігор', 'Йосип', 'Кирил', 'Костянтин', 'Лев', 'Леонід', 'Максим', 'Мирослав', 'Михайло', 'Назар',
|
||||
'Микита', 'Микола', 'Олег', 'Павло', 'Роман', 'Руслан', 'Сергій', 'Станіслав', 'Тарас', 'Тимофій', 'Федір',
|
||||
'Юрій', 'Ярослав', 'Богдан', 'Болеслав', 'B\'ячеслав',' Bалерій',' Bсеволод',' Bіктор', 'Ілля'
|
||||
'Юрій', 'Ярослав', 'Богдан', 'Болеслав', 'В\'ячеслав', 'Валерій', 'Всеволод', 'Віктор', 'Ілля'
|
||||
);
|
||||
|
||||
protected static $firstNameFemale = array(
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ class Person extends \Faker\Provider\Person
|
|||
'{{lastName}}{{firstNameFemale}}',
|
||||
);
|
||||
|
||||
protected static $titleMale = array('先生', '医生', '老师', '教授', '律师', '经理');
|
||||
|
||||
protected static $titleFemale = array('女士', '小姐', '夫人', '太太', '医生', '老师', '教授', '律师', '经理');
|
||||
|
||||
/**
|
||||
* According to http://baike.baidu.com/view/6109935.htm,
|
||||
* these are the top 300 lastnames from the 6th Chinese national census of population,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Person extends \Faker\Provider\Person
|
|||
'M' => 21,
|
||||
'N' => 22,
|
||||
'O' => 35,
|
||||
'p' => 23,
|
||||
'P' => 23,
|
||||
'Q' => 24,
|
||||
'T' => 27,
|
||||
'U' => 28,
|
||||
|
|
|
|||
|
|
@ -1,306 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Calculator;
|
||||
|
||||
use Faker\Calculator\Iban;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class IbanTest extends TestCase
|
||||
{
|
||||
|
||||
public function checksumProvider()
|
||||
{
|
||||
return array(
|
||||
array('AL47212110090000000235698741', '47'),
|
||||
array('AD1200012030200359100100', '12'),
|
||||
array('AT611904300234573201', '61'),
|
||||
array('AZ21NABZ00000000137010001944', '21'),
|
||||
array('BH67BMAG00001299123456', '67'),
|
||||
array('BE68539007547034', '68'),
|
||||
array('BA391290079401028494', '39'),
|
||||
array('BR7724891749412660603618210F3', '77'),
|
||||
array('BG80BNBG96611020345678', '80'),
|
||||
array('CR0515202001026284066', '05'),
|
||||
array('HR1210010051863000160', '12'),
|
||||
array('CY17002001280000001200527600', '17'),
|
||||
array('CZ6508000000192000145399', '65'),
|
||||
array('DK5000400440116243', '50'),
|
||||
array('DO28BAGR00000001212453611324', '28'),
|
||||
array('EE382200221020145685', '38'),
|
||||
array('FO6264600001631634', '62'),
|
||||
array('FI2112345600000785', '21'),
|
||||
array('FR1420041010050500013M02606', '14'),
|
||||
array('GE29NB0000000101904917', '29'),
|
||||
array('DE89370400440532013000', '89'),
|
||||
array('GI75NWBK000000007099453', '75'),
|
||||
array('GR1601101250000000012300695', '16'),
|
||||
array('GL8964710001000206', '89'),
|
||||
array('GT82TRAJ01020000001210029690', '82'),
|
||||
array('HU42117730161111101800000000', '42'),
|
||||
array('IS140159260076545510730339', '14'),
|
||||
array('IE29AIBK93115212345678', '29'),
|
||||
array('IL620108000000099999999', '62'),
|
||||
array('IT60X0542811101000000123456', '60'),
|
||||
array('KZ86125KZT5004100100', '86'),
|
||||
array('KW81CBKU0000000000001234560101', '81'),
|
||||
array('LV80BANK0000435195001', '80'),
|
||||
array('LB62099900000001001901229114', '62'),
|
||||
array('LI21088100002324013AA', '21'),
|
||||
array('LT121000011101001000', '12'),
|
||||
array('LU280019400644750000', '28'),
|
||||
array('MK07250120000058984', '07'),
|
||||
array('MT84MALT011000012345MTLCAST001S', '84'),
|
||||
array('MR1300020001010000123456753', '13'),
|
||||
array('MU17BOMM0101101030300200000MUR', '17'),
|
||||
array('MD24AG000225100013104168', '24'),
|
||||
array('MC5811222000010123456789030', '58'),
|
||||
array('ME25505000012345678951', '25'),
|
||||
array('NL91ABNA0417164300', '91'),
|
||||
array('NO9386011117947', '93'),
|
||||
array('PK36SCBL0000001123456702', '36'),
|
||||
array('PL61109010140000071219812874', '61'),
|
||||
array('PS92PALS000000000400123456702', '92'),
|
||||
array('PT50000201231234567890154', '50'),
|
||||
array('QA58DOHB00001234567890ABCDEFG', '58'),
|
||||
array('RO49AAAA1B31007593840000', '49'),
|
||||
array('SM86U0322509800000000270100', '86'),
|
||||
array('SA0380000000608010167519', '03'),
|
||||
array('RS35260005601001611379', '35'),
|
||||
array('SK3112000000198742637541', '31'),
|
||||
array('SI56263300012039086', '56'),
|
||||
array('ES9121000418450200051332', '91'),
|
||||
array('SE4550000000058398257466', '45'),
|
||||
array('CH9300762011623852957', '93'),
|
||||
array('TN5910006035183598478831', '59'),
|
||||
array('TR330006100519786457841326', '33'),
|
||||
array('AE070331234567890123456', '07'),
|
||||
array('GB29NWBK60161331926819', '29'),
|
||||
array('VG96VPVG0000012345678901', '96'),
|
||||
array('YY24KIHB12476423125915947930915268', '24'),
|
||||
array('ZZ25VLQT382332233206588011313776421', '25'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider checksumProvider
|
||||
*/
|
||||
public function testChecksum($iban, $checksum)
|
||||
{
|
||||
$this->assertEquals($checksum, Iban::checksum($iban), $iban);
|
||||
}
|
||||
|
||||
public function validatorProvider()
|
||||
{
|
||||
return array(
|
||||
array('AL47212110090000000235698741', true),
|
||||
array('AD1200012030200359100100', true),
|
||||
array('AT611904300234573201', true),
|
||||
array('AZ21NABZ00000000137010001944', true),
|
||||
array('BH67BMAG00001299123456', true),
|
||||
array('BE68539007547034', true),
|
||||
array('BA391290079401028494', true),
|
||||
array('BR7724891749412660603618210F3', true),
|
||||
array('BG80BNBG96611020345678', true),
|
||||
array('CR0515202001026284066', true),
|
||||
array('HR1210010051863000160', true),
|
||||
array('CY17002001280000001200527600', true),
|
||||
array('CZ6508000000192000145399', true),
|
||||
array('DK5000400440116243', true),
|
||||
array('DO28BAGR00000001212453611324', true),
|
||||
array('EE382200221020145685', true),
|
||||
array('FO6264600001631634', true),
|
||||
array('FI2112345600000785', true),
|
||||
array('FR1420041010050500013M02606', true),
|
||||
array('GE29NB0000000101904917', true),
|
||||
array('DE89370400440532013000', true),
|
||||
array('GI75NWBK000000007099453', true),
|
||||
array('GR1601101250000000012300695', true),
|
||||
array('GL8964710001000206', true),
|
||||
array('GT82TRAJ01020000001210029690', true),
|
||||
array('HU42117730161111101800000000', true),
|
||||
array('IS140159260076545510730339', true),
|
||||
array('IE29AIBK93115212345678', true),
|
||||
array('IL620108000000099999999', true),
|
||||
array('IT60X0542811101000000123456', true),
|
||||
array('KZ86125KZT5004100100', true),
|
||||
array('KW81CBKU0000000000001234560101', true),
|
||||
array('LV80BANK0000435195001', true),
|
||||
array('LB62099900000001001901229114', true),
|
||||
array('LI21088100002324013AA', true),
|
||||
array('LT121000011101001000', true),
|
||||
array('LU280019400644750000', true),
|
||||
array('MK07250120000058984', true),
|
||||
array('MT84MALT011000012345MTLCAST001S', true),
|
||||
array('MR1300020001010000123456753', true),
|
||||
array('MU17BOMM0101101030300200000MUR', true),
|
||||
array('MD24AG000225100013104168', true),
|
||||
array('MC5811222000010123456789030', true),
|
||||
array('ME25505000012345678951', true),
|
||||
array('NL91ABNA0417164300', true),
|
||||
array('NO9386011117947', true),
|
||||
array('PK36SCBL0000001123456702', true),
|
||||
array('PL61109010140000071219812874', true),
|
||||
array('PS92PALS000000000400123456702', true),
|
||||
array('PT50000201231234567890154', true),
|
||||
array('QA58DOHB00001234567890ABCDEFG', true),
|
||||
array('RO49AAAA1B31007593840000', true),
|
||||
array('SM86U0322509800000000270100', true),
|
||||
array('SA0380000000608010167519', true),
|
||||
array('RS35260005601001611379', true),
|
||||
array('SK3112000000198742637541', true),
|
||||
array('SI56263300012039086', true),
|
||||
array('ES9121000418450200051332', true),
|
||||
array('SE4550000000058398257466', true),
|
||||
array('CH9300762011623852957', true),
|
||||
array('TN5910006035183598478831', true),
|
||||
array('TR330006100519786457841326', true),
|
||||
array('AE070331234567890123456', true),
|
||||
array('GB29NWBK60161331926819', true),
|
||||
array('VG96VPVG0000012345678901', true),
|
||||
array('YY24KIHB12476423125915947930915268', true),
|
||||
array('ZZ25VLQT382332233206588011313776421', true),
|
||||
|
||||
|
||||
array('AL4721211009000000023569874', false),
|
||||
array('AD120001203020035910010', false),
|
||||
array('AT61190430023457320', false),
|
||||
array('AZ21NABZ0000000013701000194', false),
|
||||
array('BH67BMAG0000129912345', false),
|
||||
array('BE6853900754703', false),
|
||||
array('BA39129007940102849', false),
|
||||
array('BR7724891749412660603618210F', false),
|
||||
array('BG80BNBG9661102034567', false),
|
||||
array('CR051520200102628406', false),
|
||||
array('HR121001005186300016', false),
|
||||
array('CY1700200128000000120052760', false),
|
||||
array('CZ650800000019200014539', false),
|
||||
array('DK500040044011624', false),
|
||||
array('DO28BAGR0000000121245361132', false),
|
||||
array('EE38220022102014568', false),
|
||||
array('FO626460000163163', false),
|
||||
array('FI2112345600000780', false),
|
||||
array('FR1420041010050500013M0260', false),
|
||||
array('GE29NB000000010190491', false),
|
||||
array('DE8937040044053201300', false),
|
||||
array('GI75NWBK00000000709945', false),
|
||||
array('GR160110125000000001230069', false),
|
||||
array('GL896471000100020', false),
|
||||
array('GT82TRAJ0102000000121002969', false),
|
||||
array('HU4211773016111110180000000', false),
|
||||
array('IS14015926007654551073033', false),
|
||||
array('IE29AIBK9311521234567', false),
|
||||
array('IL62010800000009999999', false),
|
||||
array('IT60X054281110100000012345', false),
|
||||
array('KZ86125KZT500410010', false),
|
||||
array('KW81CBKU000000000000123456010', false),
|
||||
array('LV80BANK000043519500', false),
|
||||
array('LB6209990000000100190122911', false),
|
||||
array('LI21088100002324013A', false),
|
||||
array('LT12100001110100100', false),
|
||||
array('LU28001940064475000', false),
|
||||
array('MK0725012000005898', false),
|
||||
array('MT84MALT011000012345MTLCAST001', false),
|
||||
array('MR130002000101000012345675', false),
|
||||
array('MU17BOMM0101101030300200000MU', false),
|
||||
array('MD24AG00022510001310416', false),
|
||||
array('MC58112220000101234567890', false),
|
||||
array('ME2550500001234567895', false),
|
||||
array('NL91ABNA041716430', false),
|
||||
array('NO938601111794', false),
|
||||
array('PK36SCBL000000112345670', false),
|
||||
array('PL6110901014000007121981287', false),
|
||||
array('PS92PALS00000000040012345670', false),
|
||||
array('PT5000020123123456789015', false),
|
||||
array('QA58DOHB00001234567890ABCDEF', false),
|
||||
array('RO49AAAA1B3100759384000', false),
|
||||
array('SM86U032250980000000027010', false),
|
||||
array('SA038000000060801016751', false),
|
||||
array('RS3526000560100161137', false),
|
||||
array('SK311200000019874263754', false),
|
||||
array('SI5626330001203908', false),
|
||||
array('ES912100041845020005133', false),
|
||||
array('SE455000000005839825746', false),
|
||||
array('CH930076201162385295', false),
|
||||
array('TN591000603518359847883', false),
|
||||
array('TR33000610051978645784132', false),
|
||||
array('AE07033123456789012345', false),
|
||||
array('GB29NWBK6016133192681', false),
|
||||
array('VG96VPVG000001234567890', false),
|
||||
array('YY24KIHB1247642312591594793091526', false),
|
||||
array('ZZ25VLQT38233223320658801131377642', false),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validatorProvider
|
||||
*/
|
||||
public function testIsValid($iban, $isValid)
|
||||
{
|
||||
$this->assertEquals($isValid, Iban::isValid($iban), $iban);
|
||||
}
|
||||
|
||||
public function alphaToNumberProvider()
|
||||
{
|
||||
return array(
|
||||
array('A', 10),
|
||||
array('B', 11),
|
||||
array('C', 12),
|
||||
array('D', 13),
|
||||
array('E', 14),
|
||||
array('F', 15),
|
||||
array('G', 16),
|
||||
array('H', 17),
|
||||
array('I', 18),
|
||||
array('J', 19),
|
||||
array('K', 20),
|
||||
array('L', 21),
|
||||
array('M', 22),
|
||||
array('N', 23),
|
||||
array('O', 24),
|
||||
array('P', 25),
|
||||
array('Q', 26),
|
||||
array('R', 27),
|
||||
array('S', 28),
|
||||
array('T', 29),
|
||||
array('U', 30),
|
||||
array('V', 31),
|
||||
array('W', 32),
|
||||
array('X', 33),
|
||||
array('Y', 34),
|
||||
array('Z', 35),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider alphaToNumberProvider
|
||||
*/
|
||||
public function testAlphaToNumber($letter, $number)
|
||||
{
|
||||
$this->assertEquals($number, Iban::alphaToNumber($letter), $letter);
|
||||
}
|
||||
|
||||
public function mod97Provider()
|
||||
{
|
||||
// Large numbers
|
||||
$return = array(
|
||||
array('123456789123456789', 7),
|
||||
array('111222333444555666', 73),
|
||||
array('4242424242424242424242', 19),
|
||||
array('271828182845904523536028', 68),
|
||||
);
|
||||
|
||||
// 0-200
|
||||
for ($i = 0; $i < 200; $i++) {
|
||||
$return[] = array((string)$i, $i % 97);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
/**
|
||||
* @dataProvider mod97Provider
|
||||
*/
|
||||
public function testMod97($number, $result)
|
||||
{
|
||||
$this->assertEquals($result, Iban::mod97($number), $number);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Calculator;
|
||||
|
||||
use Faker\Calculator\Luhn;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LuhnTest extends TestCase
|
||||
{
|
||||
|
||||
public function checkDigitProvider()
|
||||
{
|
||||
return array(
|
||||
array('7992739871', '3'),
|
||||
array('3852000002323', '7'),
|
||||
array('37144963539843', '1'),
|
||||
array('561059108101825', '0'),
|
||||
array('601100099013942', '4'),
|
||||
array('510510510510510', '0'),
|
||||
array(7992739871, '3'),
|
||||
array(3852000002323, '7'),
|
||||
array('37144963539843', '1'),
|
||||
array('561059108101825', '0'),
|
||||
array('601100099013942', '4'),
|
||||
array('510510510510510', '0')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider checkDigitProvider
|
||||
*/
|
||||
public function testComputeCheckDigit($partialNumber, $checkDigit)
|
||||
{
|
||||
$this->assertInternalType('string', $checkDigit);
|
||||
$this->assertEquals($checkDigit, Luhn::computeCheckDigit($partialNumber));
|
||||
}
|
||||
|
||||
public function validatorProvider()
|
||||
{
|
||||
return array(
|
||||
array('79927398710', false),
|
||||
array('79927398711', false),
|
||||
array('79927398712', false),
|
||||
array('79927398713', true),
|
||||
array('79927398714', false),
|
||||
array('79927398715', false),
|
||||
array('79927398716', false),
|
||||
array('79927398717', false),
|
||||
array('79927398718', false),
|
||||
array('79927398719', false),
|
||||
array(79927398713, true),
|
||||
array(79927398714, false),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validatorProvider
|
||||
*/
|
||||
public function testIsValid($number, $isValid)
|
||||
{
|
||||
$this->assertEquals($isValid, Luhn::isValid($number));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedExceptionMessage Argument should be an integer.
|
||||
*/
|
||||
public function testGenerateLuhnNumberWithInvalidPrefix()
|
||||
{
|
||||
Luhn::generateLuhnNumber('abc');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test;
|
||||
|
||||
use Faker\DefaultGenerator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DefaultGeneratorTest extends TestCase
|
||||
{
|
||||
public function testGeneratorReturnsNullByDefault()
|
||||
{
|
||||
$generator = new DefaultGenerator;
|
||||
$this->assertNull($generator->value);
|
||||
}
|
||||
|
||||
public function testGeneratorReturnsDefaultValueForAnyPropertyGet()
|
||||
{
|
||||
$generator = new DefaultGenerator(123);
|
||||
$this->assertSame(123, $generator->foo);
|
||||
$this->assertNotNull($generator->bar);
|
||||
}
|
||||
|
||||
public function testGeneratorReturnsDefaultValueForAnyMethodCall()
|
||||
{
|
||||
$generator = new DefaultGenerator(123);
|
||||
$this->assertSame(123, $generator->foobar());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test;
|
||||
|
||||
use Faker\Generator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class GeneratorTest extends TestCase
|
||||
{
|
||||
public function testAddProviderGivesPriorityToNewlyAddedProvider()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$generator->addProvider(new FooProvider());
|
||||
$generator->addProvider(new BarProvider());
|
||||
$this->assertEquals('barfoo', $generator->format('fooFormatter'));
|
||||
}
|
||||
|
||||
public function testGetFormatterReturnsCallable()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$this->assertInternalType('callable', $generator->getFormatter('fooFormatter'));
|
||||
}
|
||||
|
||||
public function testGetFormatterReturnsCorrectFormatter()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$expected = array($provider, 'fooFormatter');
|
||||
$this->assertEquals($expected, $generator->getFormatter('fooFormatter'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testGetFormatterThrowsExceptionOnIncorrectProvider()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$generator->getFormatter('fooFormatter');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testGetFormatterThrowsExceptionOnIncorrectFormatter()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$generator->getFormatter('barFormatter');
|
||||
}
|
||||
|
||||
public function testFormatCallsFormatterOnProvider()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$this->assertEquals('foobar', $generator->format('fooFormatter'));
|
||||
}
|
||||
|
||||
public function testFormatTransfersArgumentsToFormatter()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$this->assertEquals('bazfoo', $generator->format('fooFormatterWithArguments', array('foo')));
|
||||
}
|
||||
|
||||
public function testParseReturnsSameStringWhenItContainsNoCurlyBraces()
|
||||
{
|
||||
$generator = new Generator();
|
||||
$this->assertEquals('fooBar#?', $generator->parse('fooBar#?'));
|
||||
}
|
||||
|
||||
public function testParseReturnsStringWithTokensReplacedByFormatters()
|
||||
{
|
||||
$generator = new Generator();
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$this->assertEquals('This is foobar a text with foobar', $generator->parse('This is {{fooFormatter}} a text with {{ fooFormatter }}'));
|
||||
}
|
||||
|
||||
public function testMagicGetCallsFormat()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$this->assertEquals('foobar', $generator->fooFormatter);
|
||||
}
|
||||
|
||||
public function testMagicCallCallsFormat()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$this->assertEquals('foobar', $generator->fooFormatter());
|
||||
}
|
||||
|
||||
public function testMagicCallCallsFormatWithArguments()
|
||||
{
|
||||
$generator = new Generator;
|
||||
$provider = new FooProvider();
|
||||
$generator->addProvider($provider);
|
||||
$this->assertEquals('bazfoo', $generator->fooFormatterWithArguments('foo'));
|
||||
}
|
||||
|
||||
public function testSeed()
|
||||
{
|
||||
$generator = new Generator;
|
||||
|
||||
$generator->seed(0);
|
||||
$mtRandWithSeedZero = mt_rand();
|
||||
$generator->seed(0);
|
||||
$this->assertEquals($mtRandWithSeedZero, mt_rand(), 'seed(0) should be deterministic.');
|
||||
|
||||
$generator->seed();
|
||||
$mtRandWithoutSeed = mt_rand();
|
||||
$this->assertNotEquals($mtRandWithSeedZero, $mtRandWithoutSeed, 'seed() should be different than seed(0)');
|
||||
$generator->seed();
|
||||
$this->assertNotEquals($mtRandWithoutSeed, mt_rand(), 'seed() should not be deterministic.');
|
||||
|
||||
$generator->seed('10');
|
||||
$this->assertTrue(true, 'seeding with a non int value doesn\'t throw an exception');
|
||||
}
|
||||
}
|
||||
|
||||
class FooProvider
|
||||
{
|
||||
public function fooFormatter()
|
||||
{
|
||||
return 'foobar';
|
||||
}
|
||||
|
||||
public function fooFormatterWithArguments($value = '')
|
||||
{
|
||||
return 'baz' . $value;
|
||||
}
|
||||
}
|
||||
|
||||
class BarProvider
|
||||
{
|
||||
public function fooFormatter()
|
||||
{
|
||||
return 'barfoo';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\Address;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AddressTest extends TestCase
|
||||
{
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Address($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testLatitude()
|
||||
{
|
||||
$latitude = $this->faker->latitude();
|
||||
$this->assertInternalType('float', $latitude);
|
||||
$this->assertGreaterThanOrEqual(-90, $latitude);
|
||||
$this->assertLessThanOrEqual(90, $latitude);
|
||||
}
|
||||
|
||||
public function testLongitude()
|
||||
{
|
||||
$longitude = $this->faker->longitude();
|
||||
$this->assertInternalType('float', $longitude);
|
||||
$this->assertGreaterThanOrEqual(-180, $longitude);
|
||||
$this->assertLessThanOrEqual(180, $longitude);
|
||||
}
|
||||
|
||||
public function testCoordinate()
|
||||
{
|
||||
$coordinate = $this->faker->localCoordinates();
|
||||
$this->assertInternalType('array', $coordinate);
|
||||
$this->assertInternalType('float', $coordinate['latitude']);
|
||||
$this->assertGreaterThanOrEqual(-90, $coordinate['latitude']);
|
||||
$this->assertLessThanOrEqual(90, $coordinate['latitude']);
|
||||
$this->assertInternalType('float', $coordinate['longitude']);
|
||||
$this->assertGreaterThanOrEqual(-180, $coordinate['longitude']);
|
||||
$this->assertLessThanOrEqual(180, $coordinate['longitude']);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\Barcode;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BarcodeTest extends TestCase
|
||||
{
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Barcode($faker));
|
||||
$faker->seed(0);
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testEan8()
|
||||
{
|
||||
$code = $this->faker->ean8();
|
||||
$this->assertRegExp('/^\d{8}$/i', $code);
|
||||
$codeWithoutChecksum = substr($code, 0, -1);
|
||||
$checksum = substr($code, -1);
|
||||
$this->assertEquals(TestableBarcode::eanChecksum($codeWithoutChecksum), $checksum);
|
||||
}
|
||||
|
||||
public function testEan13()
|
||||
{
|
||||
$code = $this->faker->ean13();
|
||||
$this->assertRegExp('/^\d{13}$/i', $code);
|
||||
$codeWithoutChecksum = substr($code, 0, -1);
|
||||
$checksum = substr($code, -1);
|
||||
$this->assertEquals(TestableBarcode::eanChecksum($codeWithoutChecksum), $checksum);
|
||||
}
|
||||
}
|
||||
|
||||
class TestableBarcode extends Barcode
|
||||
{
|
||||
public static function eanChecksum($input)
|
||||
{
|
||||
return parent::eanChecksum($input);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,572 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\Base as BaseProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Traversable;
|
||||
|
||||
class BaseTest extends TestCase
|
||||
{
|
||||
public function testRandomDigitReturnsInteger()
|
||||
{
|
||||
$this->assertInternalType('integer', BaseProvider::randomDigit());
|
||||
}
|
||||
|
||||
public function testRandomDigitReturnsDigit()
|
||||
{
|
||||
$this->assertGreaterThanOrEqual(0, BaseProvider::randomDigit());
|
||||
$this->assertLessThan(10, BaseProvider::randomDigit());
|
||||
}
|
||||
|
||||
public function testRandomDigitNotNullReturnsNotNullDigit()
|
||||
{
|
||||
$this->assertGreaterThan(0, BaseProvider::randomDigitNotNull());
|
||||
$this->assertLessThan(10, BaseProvider::randomDigitNotNull());
|
||||
}
|
||||
|
||||
|
||||
public function testRandomDigitNotReturnsValidDigit()
|
||||
{
|
||||
for ($i = 0; $i <= 9; $i++) {
|
||||
$this->assertGreaterThanOrEqual(0, BaseProvider::randomDigitNot($i));
|
||||
$this->assertLessThan(10, BaseProvider::randomDigitNot($i));
|
||||
$this->assertNotSame(BaseProvider::randomDigitNot($i), $i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testRandomNumberThrowsExceptionWhenCalledWithAMax()
|
||||
{
|
||||
BaseProvider::randomNumber(5, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testRandomNumberThrowsExceptionWhenCalledWithATooHighNumberOfDigits()
|
||||
{
|
||||
BaseProvider::randomNumber(10);
|
||||
}
|
||||
|
||||
public function testRandomNumberReturnsInteger()
|
||||
{
|
||||
$this->assertInternalType('integer', BaseProvider::randomNumber());
|
||||
$this->assertInternalType('integer', BaseProvider::randomNumber(5, false));
|
||||
}
|
||||
|
||||
public function testRandomNumberReturnsDigit()
|
||||
{
|
||||
$this->assertGreaterThanOrEqual(0, BaseProvider::randomNumber(3));
|
||||
$this->assertLessThan(1000, BaseProvider::randomNumber(3));
|
||||
}
|
||||
|
||||
public function testRandomNumberAcceptsStrictParamToEnforceNumberSize()
|
||||
{
|
||||
$this->assertEquals(5, strlen((string) BaseProvider::randomNumber(5, true)));
|
||||
}
|
||||
|
||||
public function testNumberBetween()
|
||||
{
|
||||
$min = 5;
|
||||
$max = 6;
|
||||
|
||||
$this->assertGreaterThanOrEqual($min, BaseProvider::numberBetween($min, $max));
|
||||
$this->assertGreaterThanOrEqual(BaseProvider::numberBetween($min, $max), $max);
|
||||
}
|
||||
|
||||
public function testNumberBetweenAcceptsZeroAsMax()
|
||||
{
|
||||
$this->assertEquals(0, BaseProvider::numberBetween(0, 0));
|
||||
}
|
||||
|
||||
public function testRandomFloat()
|
||||
{
|
||||
$min = 4;
|
||||
$max = 10;
|
||||
$nbMaxDecimals = 8;
|
||||
|
||||
$result = BaseProvider::randomFloat($nbMaxDecimals, $min, $max);
|
||||
|
||||
$parts = explode('.', $result);
|
||||
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertGreaterThanOrEqual($min, $result);
|
||||
$this->assertLessThanOrEqual($max, $result);
|
||||
$this->assertLessThanOrEqual($nbMaxDecimals, strlen($parts[1]));
|
||||
}
|
||||
|
||||
public function testRandomLetterReturnsString()
|
||||
{
|
||||
$this->assertInternalType('string', BaseProvider::randomLetter());
|
||||
}
|
||||
|
||||
public function testRandomLetterReturnsSingleLetter()
|
||||
{
|
||||
$this->assertEquals(1, strlen(BaseProvider::randomLetter()));
|
||||
}
|
||||
|
||||
public function testRandomLetterReturnsLowercaseLetter()
|
||||
{
|
||||
$lowercaseLetters = 'abcdefghijklmnopqrstuvwxyz';
|
||||
$this->assertNotFalse(strpos($lowercaseLetters, BaseProvider::randomLetter()));
|
||||
}
|
||||
|
||||
public function testRandomAsciiReturnsString()
|
||||
{
|
||||
$this->assertInternalType('string', BaseProvider::randomAscii());
|
||||
}
|
||||
|
||||
public function testRandomAsciiReturnsSingleCharacter()
|
||||
{
|
||||
$this->assertEquals(1, strlen(BaseProvider::randomAscii()));
|
||||
}
|
||||
|
||||
public function testRandomAsciiReturnsAsciiCharacter()
|
||||
{
|
||||
$lowercaseLetters = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
|
||||
$this->assertNotFalse(strpos($lowercaseLetters, BaseProvider::randomAscii()));
|
||||
}
|
||||
|
||||
public function testRandomElementReturnsNullWhenArrayEmpty()
|
||||
{
|
||||
$this->assertNull(BaseProvider::randomElement(array()));
|
||||
}
|
||||
|
||||
public function testRandomElementReturnsNullWhenCollectionEmpty()
|
||||
{
|
||||
$this->assertNull(BaseProvider::randomElement(new Collection(array())));
|
||||
}
|
||||
|
||||
public function testRandomElementReturnsElementFromArray()
|
||||
{
|
||||
$elements = array('23', 'e', 32, '#');
|
||||
$this->assertContains(BaseProvider::randomElement($elements), $elements);
|
||||
}
|
||||
|
||||
public function testRandomElementReturnsElementFromAssociativeArray()
|
||||
{
|
||||
$elements = array('tata' => '23', 'toto' => 'e', 'tutu' => 32, 'titi' => '#');
|
||||
$this->assertContains(BaseProvider::randomElement($elements), $elements);
|
||||
}
|
||||
|
||||
public function testRandomElementReturnsElementFromCollection()
|
||||
{
|
||||
$collection = new Collection(array('one', 'two', 'three'));
|
||||
$this->assertContains(BaseProvider::randomElement($collection), $collection);
|
||||
}
|
||||
|
||||
public function testShuffleReturnsStringWhenPassedAStringArgument()
|
||||
{
|
||||
$this->assertInternalType('string', BaseProvider::shuffle('foo'));
|
||||
}
|
||||
|
||||
public function testShuffleReturnsArrayWhenPassedAnArrayArgument()
|
||||
{
|
||||
$this->assertInternalType('array', BaseProvider::shuffle(array(1, 2, 3)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testShuffleThrowsExceptionWhenPassedAnInvalidArgument()
|
||||
{
|
||||
BaseProvider::shuffle(false);
|
||||
}
|
||||
|
||||
public function testShuffleArraySupportsEmptyArrays()
|
||||
{
|
||||
$this->assertEquals(array(), BaseProvider::shuffleArray(array()));
|
||||
}
|
||||
|
||||
public function testShuffleArrayReturnsAnArrayOfTheSameSize()
|
||||
{
|
||||
$array = array(1, 2, 3, 4, 5);
|
||||
$this->assertSameSize($array, BaseProvider::shuffleArray($array));
|
||||
}
|
||||
|
||||
public function testShuffleArrayReturnsAnArrayWithSameElements()
|
||||
{
|
||||
$array = array(2, 4, 6, 8, 10);
|
||||
$shuffleArray = BaseProvider::shuffleArray($array);
|
||||
$this->assertContains(2, $shuffleArray);
|
||||
$this->assertContains(4, $shuffleArray);
|
||||
$this->assertContains(6, $shuffleArray);
|
||||
$this->assertContains(8, $shuffleArray);
|
||||
$this->assertContains(10, $shuffleArray);
|
||||
}
|
||||
|
||||
public function testShuffleArrayReturnsADifferentArrayThanTheOriginal()
|
||||
{
|
||||
$arr = array(1, 2, 3, 4, 5);
|
||||
$shuffledArray = BaseProvider::shuffleArray($arr);
|
||||
$this->assertNotEquals($arr, $shuffledArray);
|
||||
}
|
||||
|
||||
public function testShuffleArrayLeavesTheOriginalArrayUntouched()
|
||||
{
|
||||
$arr = array(1, 2, 3, 4, 5);
|
||||
BaseProvider::shuffleArray($arr);
|
||||
$this->assertEquals($arr, array(1, 2, 3, 4, 5));
|
||||
}
|
||||
|
||||
public function testShuffleStringSupportsEmptyStrings()
|
||||
{
|
||||
$this->assertEquals('', BaseProvider::shuffleString(''));
|
||||
}
|
||||
|
||||
public function testShuffleStringReturnsAnStringOfTheSameSize()
|
||||
{
|
||||
$string = 'abcdef';
|
||||
$this->assertEquals(strlen($string), strlen(BaseProvider::shuffleString($string)));
|
||||
}
|
||||
|
||||
public function testShuffleStringReturnsAnStringWithSameElements()
|
||||
{
|
||||
$string = 'acegi';
|
||||
$shuffleString = BaseProvider::shuffleString($string);
|
||||
$this->assertContains('a', $shuffleString);
|
||||
$this->assertContains('c', $shuffleString);
|
||||
$this->assertContains('e', $shuffleString);
|
||||
$this->assertContains('g', $shuffleString);
|
||||
$this->assertContains('i', $shuffleString);
|
||||
}
|
||||
|
||||
public function testShuffleStringReturnsADifferentStringThanTheOriginal()
|
||||
{
|
||||
$string = 'abcdef';
|
||||
$shuffledString = BaseProvider::shuffleString($string);
|
||||
$this->assertNotEquals($string, $shuffledString);
|
||||
}
|
||||
|
||||
public function testShuffleStringLeavesTheOriginalStringUntouched()
|
||||
{
|
||||
$string = 'abcdef';
|
||||
BaseProvider::shuffleString($string);
|
||||
$this->assertEquals($string, 'abcdef');
|
||||
}
|
||||
|
||||
public function testNumerifyReturnsSameStringWhenItContainsNoHashSign()
|
||||
{
|
||||
$this->assertEquals('fooBar?', BaseProvider::numerify('fooBar?'));
|
||||
}
|
||||
|
||||
public function testNumerifyReturnsStringWithHashSignsReplacedByDigits()
|
||||
{
|
||||
$this->assertRegExp('/foo\dBa\dr/', BaseProvider::numerify('foo#Ba#r'));
|
||||
}
|
||||
|
||||
public function testNumerifyReturnsStringWithPercentageSignsReplacedByDigits()
|
||||
{
|
||||
$this->assertRegExp('/foo\dBa\dr/', BaseProvider::numerify('foo%Ba%r'));
|
||||
}
|
||||
|
||||
public function testNumerifyReturnsStringWithPercentageSignsReplacedByNotNullDigits()
|
||||
{
|
||||
$this->assertNotEquals('0', BaseProvider::numerify('%'));
|
||||
}
|
||||
|
||||
public function testNumerifyCanGenerateALargeNumberOfDigits()
|
||||
{
|
||||
$largePattern = str_repeat('#', 20); // definitely larger than PHP_INT_MAX on all systems
|
||||
$this->assertEquals(20, strlen(BaseProvider::numerify($largePattern)));
|
||||
}
|
||||
|
||||
public function testLexifyReturnsSameStringWhenItContainsNoQuestionMark()
|
||||
{
|
||||
$this->assertEquals('fooBar#', BaseProvider::lexify('fooBar#'));
|
||||
}
|
||||
|
||||
public function testLexifyReturnsStringWithQuestionMarksReplacedByLetters()
|
||||
{
|
||||
$this->assertRegExp('/foo[a-z]Ba[a-z]r/', BaseProvider::lexify('foo?Ba?r'));
|
||||
}
|
||||
|
||||
public function testBothifyCombinesNumerifyAndLexify()
|
||||
{
|
||||
$this->assertRegExp('/foo[a-z]Ba\dr/', BaseProvider::bothify('foo?Ba#r'));
|
||||
}
|
||||
|
||||
public function testBothifyAsterisk()
|
||||
{
|
||||
$this->assertRegExp('/foo([a-z]|\d)Ba([a-z]|\d)r/', BaseProvider::bothify('foo*Ba*r'));
|
||||
}
|
||||
|
||||
public function testBothifyUtf()
|
||||
{
|
||||
$utf = 'œ∑´®†¥¨ˆøπ“‘和製╯°□°╯︵ ┻━┻🐵 🙈 ﺚﻣ ﻦﻔﺳ ﺲﻘﻄﺗ ﻮﺑﺎﻠﺘﺣﺪﻳﺩ،, ﺝﺰﻳﺮﺘﻳ ﺏﺎﺴﺘﺧﺩﺎﻣ ﺄﻧ ﺪﻧﻭ. ﺇﺫ ﻪﻧﺍ؟ ﺎﻠﺴﺗﺍﺭ ﻮﺘ';
|
||||
$this->assertRegExp('/'.$utf.'foo\dB[a-z]a([a-z]|\d)r/u', BaseProvider::bothify($utf.'foo#B?a*r'));
|
||||
}
|
||||
|
||||
public function testAsciifyReturnsSameStringWhenItContainsNoStarSign()
|
||||
{
|
||||
$this->assertEquals('fooBar?', BaseProvider::asciify('fooBar?'));
|
||||
}
|
||||
|
||||
public function testAsciifyReturnsStringWithStarSignsReplacedByAsciiChars()
|
||||
{
|
||||
$this->assertRegExp('/foo.Ba.r/', BaseProvider::asciify('foo*Ba*r'));
|
||||
}
|
||||
|
||||
public function regexifyBasicDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('azeQSDF1234', 'azeQSDF1234', 'does not change non regex chars'),
|
||||
array('foo(bar){1}', 'foobar', 'replaces regex characters'),
|
||||
array('', '', 'supports empty string'),
|
||||
array('/^foo(bar){1}$/', 'foobar', 'ignores regex delimiters')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regexifyBasicDataProvider
|
||||
*/
|
||||
public function testRegexifyBasicFeatures($input, $output, $message)
|
||||
{
|
||||
$this->assertEquals($output, BaseProvider::regexify($input), $message);
|
||||
}
|
||||
|
||||
public function regexifyDataProvider()
|
||||
{
|
||||
return array(
|
||||
array('\d', 'numbers'),
|
||||
array('\w', 'letters'),
|
||||
array('(a|b)', 'alternation'),
|
||||
array('[aeiou]', 'basic character class'),
|
||||
array('[a-z]', 'character class range'),
|
||||
array('[a-z1-9]', 'multiple character class range'),
|
||||
array('a*b+c?', 'single character quantifiers'),
|
||||
array('a{2}', 'brackets quantifiers'),
|
||||
array('a{2,3}', 'min-max brackets quantifiers'),
|
||||
array('[aeiou]{2,3}', 'brackets quantifiers on basic character class'),
|
||||
array('[a-z]{2,3}', 'brackets quantifiers on character class range'),
|
||||
array('(a|b){2,3}', 'brackets quantifiers on alternation'),
|
||||
array('\.\*\?\+', 'escaped characters'),
|
||||
array('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}', 'complex regex')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regexifyDataProvider
|
||||
*/
|
||||
public function testRegexifySupportedRegexSyntax($pattern, $message)
|
||||
{
|
||||
$this->assertRegExp('/' . $pattern . '/', BaseProvider::regexify($pattern), 'Regexify supports ' . $message);
|
||||
}
|
||||
|
||||
public function testOptionalReturnsProviderValueWhenCalledWithWeight1()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$this->assertNotNull($faker->optional(100)->randomDigit);
|
||||
}
|
||||
|
||||
public function testOptionalReturnsNullWhenCalledWithWeight0()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$this->assertNull($faker->optional(0)->randomDigit);
|
||||
}
|
||||
|
||||
public function testOptionalAllowsChainingPropertyAccess()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs
|
||||
$this->assertEquals(1, $faker->optional(100)->count);
|
||||
$this->assertNull($faker->optional(0)->count);
|
||||
}
|
||||
|
||||
public function testOptionalAllowsChainingMethodCall()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs
|
||||
$this->assertEquals(1, $faker->optional(100)->count());
|
||||
$this->assertNull($faker->optional(0)->count());
|
||||
}
|
||||
|
||||
public function testOptionalAllowsChainingProviderCallRandomlyReturnNull()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$values = array();
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
$values[]= $faker->optional()->randomDigit;
|
||||
}
|
||||
$this->assertContains(null, $values);
|
||||
|
||||
$values = array();
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
$values[]= $faker->optional(50)->randomDigit;
|
||||
}
|
||||
$this->assertContains(null, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://github.com/fzaninotto/Faker/issues/265
|
||||
*/
|
||||
public function testOptionalPercentageAndWeight()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$faker->addProvider(new \Faker\Provider\Miscellaneous($faker));
|
||||
|
||||
$valuesOld = array();
|
||||
$valuesNew = array();
|
||||
|
||||
for ($i = 0; $i < 10000; ++$i) {
|
||||
$valuesOld[] = $faker->optional(0.5)->boolean(100);
|
||||
$valuesNew[] = $faker->optional(50)->boolean(100);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
round(array_sum($valuesOld) / 10000, 2),
|
||||
round(array_sum($valuesNew) / 10000, 2)
|
||||
);
|
||||
}
|
||||
|
||||
public function testUniqueAllowsChainingPropertyAccess()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs
|
||||
$this->assertEquals(1, $faker->unique()->count);
|
||||
}
|
||||
|
||||
public function testUniqueAllowsChainingMethodCall()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs
|
||||
$this->assertEquals(1, $faker->unique()->count());
|
||||
}
|
||||
|
||||
public function testUniqueReturnsOnlyUniqueValues()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$values = array();
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
$values[]= $faker->unique()->randomDigit;
|
||||
}
|
||||
sort($values);
|
||||
$this->assertEquals(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException OverflowException
|
||||
*/
|
||||
public function testUniqueThrowsExceptionWhenNoUniqueValueCanBeGenerated()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
for ($i=0; $i < 11; $i++) {
|
||||
$faker->unique()->randomDigit;
|
||||
}
|
||||
}
|
||||
|
||||
public function testUniqueCanResetUniquesWhenPassedTrueAsArgument()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$values = array();
|
||||
for ($i=0; $i < 10; $i++) {
|
||||
$values[]= $faker->unique()->randomDigit;
|
||||
}
|
||||
$values[]= $faker->unique(true)->randomDigit;
|
||||
for ($i=0; $i < 9; $i++) {
|
||||
$values[]= $faker->unique()->randomDigit;
|
||||
}
|
||||
sort($values);
|
||||
$this->assertEquals(array(0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9), $values);
|
||||
}
|
||||
|
||||
public function testValidAllowsChainingPropertyAccess()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$this->assertLessThan(10, $faker->valid()->randomDigit);
|
||||
}
|
||||
|
||||
public function testValidAllowsChainingMethodCall()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$this->assertLessThan(10, $faker->valid()->numberBetween(5, 9));
|
||||
}
|
||||
|
||||
public function testValidReturnsOnlyValidValues()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$values = array();
|
||||
$evenValidator = function($digit) {
|
||||
return $digit % 2 === 0;
|
||||
};
|
||||
for ($i=0; $i < 50; $i++) {
|
||||
$values[$faker->valid($evenValidator)->randomDigit] = true;
|
||||
}
|
||||
$uniqueValues = array_keys($values);
|
||||
sort($uniqueValues);
|
||||
$this->assertEquals(array(0, 2, 4, 6, 8), $uniqueValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException OverflowException
|
||||
*/
|
||||
public function testValidThrowsExceptionWhenNoValidValueCanBeGenerated()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$evenValidator = function($digit) {
|
||||
return $digit % 2 === 0;
|
||||
};
|
||||
for ($i=0; $i < 11; $i++) {
|
||||
$faker->valid($evenValidator)->randomElement(array(1, 3, 5, 7, 9));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testValidThrowsExceptionWhenParameterIsNotCollable()
|
||||
{
|
||||
$faker = new \Faker\Generator();
|
||||
$faker->addProvider(new \Faker\Provider\Base($faker));
|
||||
$faker->valid(12)->randomElement(array(1, 3, 5, 7, 9));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException LengthException
|
||||
* @expectedExceptionMessage Cannot get 2 elements, only 1 in array
|
||||
*/
|
||||
public function testRandomElementsThrowsWhenRequestingTooManyKeys()
|
||||
{
|
||||
BaseProvider::randomElements(array('foo'), 2);
|
||||
}
|
||||
|
||||
public function testRandomElements()
|
||||
{
|
||||
$this->assertCount(1, BaseProvider::randomElements(), 'Should work without any input');
|
||||
|
||||
$empty = BaseProvider::randomElements(array(), 0);
|
||||
$this->assertInternalType('array', $empty);
|
||||
$this->assertCount(0, $empty);
|
||||
|
||||
$shuffled = BaseProvider::randomElements(array('foo', 'bar', 'baz'), 3);
|
||||
$this->assertContains('foo', $shuffled);
|
||||
$this->assertContains('bar', $shuffled);
|
||||
$this->assertContains('baz', $shuffled);
|
||||
|
||||
$allowDuplicates = BaseProvider::randomElements(array('foo', 'bar'), 3, true);
|
||||
$this->assertCount(3, $allowDuplicates);
|
||||
$this->assertContainsOnly('string', $allowDuplicates);
|
||||
}
|
||||
}
|
||||
|
||||
class Collection extends \ArrayObject
|
||||
{
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\Biased;
|
||||
use Faker\Generator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class BiasedTest extends TestCase
|
||||
{
|
||||
const MAX = 10;
|
||||
const NUMBERS = 25000;
|
||||
protected $generator;
|
||||
protected $results = array();
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->generator = new Generator();
|
||||
$this->generator->addProvider(new Biased($this->generator));
|
||||
|
||||
$this->results = array_fill(1, self::MAX, 0);
|
||||
}
|
||||
|
||||
public function performFake($function)
|
||||
{
|
||||
for($i = 0; $i < self::NUMBERS; $i++) {
|
||||
$this->results[$this->generator->biasedNumberBetween(1, self::MAX, $function)]++;
|
||||
}
|
||||
}
|
||||
|
||||
public function testUnbiased()
|
||||
{
|
||||
$this->performFake(array('\Faker\Provider\Biased', 'unbiased'));
|
||||
|
||||
// assert that all numbers are near the expected unbiased value
|
||||
foreach ($this->results as $number => $amount) {
|
||||
// integral
|
||||
$assumed = (1 / self::MAX * $number) - (1 / self::MAX * ($number - 1));
|
||||
// calculate the fraction of the whole area
|
||||
$assumed /= 1;
|
||||
$this->assertGreaterThan(self::NUMBERS * $assumed * .95, $amount, "Value was more than 5 percent under the expected value");
|
||||
$this->assertLessThan(self::NUMBERS * $assumed * 1.05, $amount, "Value was more than 5 percent over the expected value");
|
||||
}
|
||||
}
|
||||
|
||||
public function testLinearHigh()
|
||||
{
|
||||
$this->performFake(array('\Faker\Provider\Biased', 'linearHigh'));
|
||||
|
||||
foreach ($this->results as $number => $amount) {
|
||||
// integral
|
||||
$assumed = 0.5 * pow(1 / self::MAX * $number, 2) - 0.5 * pow(1 / self::MAX * ($number - 1), 2);
|
||||
// calculate the fraction of the whole area
|
||||
$assumed /= pow(1, 2) * .5;
|
||||
$this->assertGreaterThan(self::NUMBERS * $assumed * .9, $amount, "Value was more than 10 percent under the expected value");
|
||||
$this->assertLessThan(self::NUMBERS * $assumed * 1.1, $amount, "Value was more than 10 percent over the expected value");
|
||||
}
|
||||
}
|
||||
|
||||
public function testLinearLow()
|
||||
{
|
||||
$this->performFake(array('\Faker\Provider\Biased', 'linearLow'));
|
||||
|
||||
foreach ($this->results as $number => $amount) {
|
||||
// integral
|
||||
$assumed = -0.5 * pow(1 / self::MAX * $number, 2) - -0.5 * pow(1 / self::MAX * ($number - 1), 2);
|
||||
// shift the graph up
|
||||
$assumed += 1 / self::MAX;
|
||||
// calculate the fraction of the whole area
|
||||
$assumed /= pow(1, 2) * .5;
|
||||
$this->assertGreaterThan(self::NUMBERS * $assumed * .9, $amount, "Value was more than 10 percent under the expected value");
|
||||
$this->assertLessThan(self::NUMBERS * $assumed * 1.1, $amount, "Value was more than 10 percent over the expected value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\Color;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ColorTest extends TestCase
|
||||
{
|
||||
|
||||
public function testHexColor()
|
||||
{
|
||||
$this->assertRegExp('/^#[a-f0-9]{6}$/i', Color::hexColor());
|
||||
}
|
||||
|
||||
public function testSafeHexColor()
|
||||
{
|
||||
$this->assertRegExp('/^#[a-f0-9]{6}$/i', Color::safeHexColor());
|
||||
}
|
||||
|
||||
public function testRgbColorAsArray()
|
||||
{
|
||||
$this->assertEquals(3, count(Color::rgbColorAsArray()));
|
||||
}
|
||||
|
||||
public function testRgbColor()
|
||||
{
|
||||
$regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])';
|
||||
$this->assertRegExp('/^' . $regexp . ',' . $regexp . ',' . $regexp . '$/i', Color::rgbColor());
|
||||
}
|
||||
|
||||
public function testRgbCssColor()
|
||||
{
|
||||
$regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])';
|
||||
$this->assertRegExp('/^rgb\(' . $regexp . ',' . $regexp . ',' . $regexp . '\)$/i', Color::rgbCssColor());
|
||||
}
|
||||
|
||||
public function testRgbaCssColor()
|
||||
{
|
||||
$regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])';
|
||||
$regexpAlpha = '([01]?(\.\d+)?)';
|
||||
$this->assertRegExp('/^rgba\(' . $regexp . ',' . $regexp . ',' . $regexp . ',' . $regexpAlpha . '\)$/i', Color::rgbaCssColor());
|
||||
}
|
||||
|
||||
public function testSafeColorName()
|
||||
{
|
||||
$this->assertRegExp('/^[\w]+$/', Color::safeColorName());
|
||||
}
|
||||
|
||||
public function testColorName()
|
||||
{
|
||||
$this->assertRegExp('/^[\w]+$/', Color::colorName());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\Company;
|
||||
use Faker\Provider\Lorem;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CompanyTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Company($faker));
|
||||
$faker->addProvider(new Lorem($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testJobTitle()
|
||||
{
|
||||
$jobTitle = $this->faker->jobTitle();
|
||||
$pattern = '/^[A-Za-z]+$/';
|
||||
$this->assertRegExp($pattern, $jobTitle);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,282 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\DateTime as DateTimeProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DateTimeTest extends TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$this->defaultTz = 'UTC';
|
||||
DateTimeProvider::setDefaultTimezone($this->defaultTz);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
DateTimeProvider::setDefaultTimezone();
|
||||
}
|
||||
|
||||
public function testPreferDefaultTimezoneOverSystemTimezone()
|
||||
{
|
||||
/**
|
||||
* Set the system timezone to something *other* than the timezone used
|
||||
* in setUp().
|
||||
*/
|
||||
$originalSystemTimezone = date_default_timezone_get();
|
||||
$systemTimezone = 'Antarctica/Vostok';
|
||||
date_default_timezone_set($systemTimezone);
|
||||
|
||||
/**
|
||||
* Get a new date/time value and assert that it prefers the default
|
||||
* timezone over the system timezone.
|
||||
*/
|
||||
$date = DateTimeProvider::dateTime();
|
||||
$this->assertNotSame($systemTimezone, $date->getTimezone()->getName());
|
||||
$this->assertSame($this->defaultTz, $date->getTimezone()->getName());
|
||||
|
||||
/**
|
||||
* Restore the system timezone.
|
||||
*/
|
||||
date_default_timezone_set($originalSystemTimezone);
|
||||
}
|
||||
|
||||
public function testUseSystemTimezoneWhenDefaultTimezoneIsNotSet()
|
||||
{
|
||||
/**
|
||||
* Set the system timezone to something *other* than the timezone used
|
||||
* in setUp() *and* reset the default timezone.
|
||||
*/
|
||||
$originalSystemTimezone = date_default_timezone_get();
|
||||
$originalDefaultTimezone = DateTimeProvider::getDefaultTimezone();
|
||||
$systemTimezone = 'Antarctica/Vostok';
|
||||
date_default_timezone_set($systemTimezone);
|
||||
DateTimeProvider::setDefaultTimezone();
|
||||
|
||||
/**
|
||||
* Get a new date/time value and assert that it uses the system timezone
|
||||
* and not the system timezone.
|
||||
*/
|
||||
$date = DateTimeProvider::dateTime();
|
||||
$this->assertSame($systemTimezone, $date->getTimezone()->getName());
|
||||
$this->assertNotSame($this->defaultTz, $date->getTimezone()->getName());
|
||||
|
||||
/**
|
||||
* Restore the system timezone.
|
||||
*/
|
||||
date_default_timezone_set($originalSystemTimezone);
|
||||
}
|
||||
|
||||
public function testUnixTime()
|
||||
{
|
||||
$timestamp = DateTimeProvider::unixTime();
|
||||
$this->assertInternalType('int', $timestamp);
|
||||
$this->assertGreaterThanOrEqual(0, $timestamp);
|
||||
$this->assertLessThanOrEqual(time(), $timestamp);
|
||||
}
|
||||
|
||||
public function testDateTime()
|
||||
{
|
||||
$date = DateTimeProvider::dateTime();
|
||||
$this->assertInstanceOf('\DateTime', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime('@0'), $date);
|
||||
$this->assertLessThanOrEqual(new \DateTime(), $date);
|
||||
$this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone());
|
||||
}
|
||||
|
||||
public function testDateTimeWithTimezone()
|
||||
{
|
||||
$date = DateTimeProvider::dateTime('now', 'America/New_York');
|
||||
$this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York'));
|
||||
}
|
||||
|
||||
public function testDateTimeAD()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeAD();
|
||||
$this->assertInstanceOf('\DateTime', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime('0000-01-01 00:00:00'), $date);
|
||||
$this->assertLessThanOrEqual(new \DateTime(), $date);
|
||||
$this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone());
|
||||
}
|
||||
|
||||
public function testDateTimeThisCentury()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeThisCentury();
|
||||
$this->assertInstanceOf('\DateTime', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime('-100 year'), $date);
|
||||
$this->assertLessThanOrEqual(new \DateTime(), $date);
|
||||
$this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone());
|
||||
}
|
||||
|
||||
public function testDateTimeThisDecade()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeThisDecade();
|
||||
$this->assertInstanceOf('\DateTime', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime('-10 year'), $date);
|
||||
$this->assertLessThanOrEqual(new \DateTime(), $date);
|
||||
$this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone());
|
||||
}
|
||||
|
||||
public function testDateTimeThisYear()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeThisYear();
|
||||
$this->assertInstanceOf('\DateTime', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime('-1 year'), $date);
|
||||
$this->assertLessThanOrEqual(new \DateTime(), $date);
|
||||
$this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone());
|
||||
}
|
||||
|
||||
public function testDateTimeThisMonth()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeThisMonth();
|
||||
$this->assertInstanceOf('\DateTime', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime('-1 month'), $date);
|
||||
$this->assertLessThanOrEqual(new \DateTime(), $date);
|
||||
$this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone());
|
||||
}
|
||||
|
||||
public function testDateTimeThisCenturyWithTimezone()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeThisCentury('now', 'America/New_York');
|
||||
$this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York'));
|
||||
}
|
||||
|
||||
public function testDateTimeThisDecadeWithTimezone()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeThisDecade('now', 'America/New_York');
|
||||
$this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York'));
|
||||
}
|
||||
|
||||
public function testDateTimeThisYearWithTimezone()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeThisYear('now', 'America/New_York');
|
||||
$this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York'));
|
||||
}
|
||||
|
||||
public function testDateTimeThisMonthWithTimezone()
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeThisMonth('now', 'America/New_York');
|
||||
$this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York'));
|
||||
}
|
||||
|
||||
public function testIso8601()
|
||||
{
|
||||
$date = DateTimeProvider::iso8601();
|
||||
$this->assertRegExp('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-Z](\d{4})?$/', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime('@0'), new \DateTime($date));
|
||||
$this->assertLessThanOrEqual(new \DateTime(), new \DateTime($date));
|
||||
}
|
||||
|
||||
public function testDate()
|
||||
{
|
||||
$date = DateTimeProvider::date();
|
||||
$this->assertRegExp('/^\d{4}-\d{2}-\d{2}$/', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime('@0'), new \DateTime($date));
|
||||
$this->assertLessThanOrEqual(new \DateTime(), new \DateTime($date));
|
||||
}
|
||||
|
||||
public function testTime()
|
||||
{
|
||||
$date = DateTimeProvider::time();
|
||||
$this->assertRegExp('/^\d{2}:\d{2}:\d{2}$/', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @dataProvider providerDateTimeBetween
|
||||
*/
|
||||
public function testDateTimeBetween($start, $end)
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeBetween($start, $end);
|
||||
$this->assertInstanceOf('\DateTime', $date);
|
||||
$this->assertGreaterThanOrEqual(new \DateTime($start), $date);
|
||||
$this->assertLessThanOrEqual(new \DateTime($end), $date);
|
||||
$this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone());
|
||||
}
|
||||
|
||||
public function providerDateTimeBetween()
|
||||
{
|
||||
return array(
|
||||
array('-1 year', false),
|
||||
array('-1 year', null),
|
||||
array('-1 day', '-1 hour'),
|
||||
array('-1 day', 'now'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @dataProvider providerDateTimeInInterval
|
||||
*/
|
||||
public function testDateTimeInInterval($start, $interval = "+5 days", $isInFuture)
|
||||
{
|
||||
$date = DateTimeProvider::dateTimeInInterval($start, $interval);
|
||||
$this->assertInstanceOf('\DateTime', $date);
|
||||
|
||||
$_interval = \DateInterval::createFromDateString($interval);
|
||||
$_start = new \DateTime($start);
|
||||
if ($isInFuture) {
|
||||
$this->assertGreaterThanOrEqual($_start, $date);
|
||||
$this->assertLessThanOrEqual($_start->add($_interval), $date);
|
||||
} else {
|
||||
$this->assertLessThanOrEqual($_start, $date);
|
||||
$this->assertGreaterThanOrEqual($_start->add($_interval), $date);
|
||||
}
|
||||
}
|
||||
|
||||
public function providerDateTimeInInterval()
|
||||
{
|
||||
return array(
|
||||
array('-1 year', '+5 days', true),
|
||||
array('-1 day', '-1 hour', false),
|
||||
array('-1 day', '+1 hour', true),
|
||||
);
|
||||
}
|
||||
|
||||
public function testFixedSeedWithMaximumTimestamp()
|
||||
{
|
||||
$max = '2118-03-01 12:00:00';
|
||||
|
||||
mt_srand(1);
|
||||
$unixTime = DateTimeProvider::unixTime($max);
|
||||
$datetimeAD = DateTimeProvider::dateTimeAD($max);
|
||||
$dateTime1 = DateTimeProvider::dateTime($max);
|
||||
$dateTimeBetween = DateTimeProvider::dateTimeBetween('2014-03-01 06:00:00', $max);
|
||||
$date = DateTimeProvider::date('Y-m-d', $max);
|
||||
$time = DateTimeProvider::time('H:i:s', $max);
|
||||
$iso8601 = DateTimeProvider::iso8601($max);
|
||||
$dateTimeThisCentury = DateTimeProvider::dateTimeThisCentury($max);
|
||||
$dateTimeThisDecade = DateTimeProvider::dateTimeThisDecade($max);
|
||||
$dateTimeThisMonth = DateTimeProvider::dateTimeThisMonth($max);
|
||||
$amPm = DateTimeProvider::amPm($max);
|
||||
$dayOfMonth = DateTimeProvider::dayOfMonth($max);
|
||||
$dayOfWeek = DateTimeProvider::dayOfWeek($max);
|
||||
$month = DateTimeProvider::month($max);
|
||||
$monthName = DateTimeProvider::monthName($max);
|
||||
$year = DateTimeProvider::year($max);
|
||||
$dateTimeThisYear = DateTimeProvider::dateTimeThisYear($max);
|
||||
mt_srand();
|
||||
|
||||
//regenerate Random Date with same seed and same maximum end timestamp
|
||||
mt_srand(1);
|
||||
$this->assertEquals($unixTime, DateTimeProvider::unixTime($max));
|
||||
$this->assertEquals($datetimeAD, DateTimeProvider::dateTimeAD($max));
|
||||
$this->assertEquals($dateTime1, DateTimeProvider::dateTime($max));
|
||||
$this->assertEquals($dateTimeBetween, DateTimeProvider::dateTimeBetween('2014-03-01 06:00:00', $max));
|
||||
$this->assertEquals($date, DateTimeProvider::date('Y-m-d', $max));
|
||||
$this->assertEquals($time, DateTimeProvider::time('H:i:s', $max));
|
||||
$this->assertEquals($iso8601, DateTimeProvider::iso8601($max));
|
||||
$this->assertEquals($dateTimeThisCentury, DateTimeProvider::dateTimeThisCentury($max));
|
||||
$this->assertEquals($dateTimeThisDecade, DateTimeProvider::dateTimeThisDecade($max));
|
||||
$this->assertEquals($dateTimeThisMonth, DateTimeProvider::dateTimeThisMonth($max));
|
||||
$this->assertEquals($amPm, DateTimeProvider::amPm($max));
|
||||
$this->assertEquals($dayOfMonth, DateTimeProvider::dayOfMonth($max));
|
||||
$this->assertEquals($dayOfWeek, DateTimeProvider::dayOfWeek($max));
|
||||
$this->assertEquals($month, DateTimeProvider::month($max));
|
||||
$this->assertEquals($monthName, DateTimeProvider::monthName($max));
|
||||
$this->assertEquals($year, DateTimeProvider::year($max));
|
||||
$this->assertEquals($dateTimeThisYear, DateTimeProvider::dateTimeThisYear($max));
|
||||
mt_srand();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\Image;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ImageTest extends TestCase
|
||||
{
|
||||
public function testImageUrlUses640x680AsTheDefaultSize()
|
||||
{
|
||||
$this->assertRegExp('#^https://lorempixel.com/640/480/#', Image::imageUrl());
|
||||
}
|
||||
|
||||
public function testImageUrlAcceptsCustomWidthAndHeight()
|
||||
{
|
||||
$this->assertRegExp('#^https://lorempixel.com/800/400/#', Image::imageUrl(800, 400));
|
||||
}
|
||||
|
||||
public function testImageUrlAcceptsCustomCategory()
|
||||
{
|
||||
$this->assertRegExp('#^https://lorempixel.com/800/400/nature/#', Image::imageUrl(800, 400, 'nature'));
|
||||
}
|
||||
|
||||
public function testImageUrlAcceptsCustomText()
|
||||
{
|
||||
$this->assertRegExp('#^https://lorempixel.com/800/400/nature/Faker#', Image::imageUrl(800, 400, 'nature', false, 'Faker'));
|
||||
}
|
||||
|
||||
public function testImageUrlAddsARandomGetParameterByDefault()
|
||||
{
|
||||
$url = Image::imageUrl(800, 400);
|
||||
$splitUrl = preg_split('/\?/', $url);
|
||||
|
||||
$this->assertEquals(count($splitUrl), 2);
|
||||
$this->assertRegexp('#\d{5}#', $splitUrl[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testUrlWithDimensionsAndBadCategory()
|
||||
{
|
||||
Image::imageUrl(800, 400, 'bullhonky');
|
||||
}
|
||||
|
||||
public function testDownloadWithDefaults()
|
||||
{
|
||||
$url = "http://lorempixel.com/";
|
||||
$curlPing = curl_init($url);
|
||||
curl_setopt($curlPing, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($curlPing, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($curlPing, CURLOPT_RETURNTRANSFER, true);
|
||||
$data = curl_exec($curlPing);
|
||||
$httpCode = curl_getinfo($curlPing, CURLINFO_HTTP_CODE);
|
||||
curl_close($curlPing);
|
||||
|
||||
if ($httpCode < 200 | $httpCode > 300) {
|
||||
$this->markTestSkipped("LoremPixel is offline, skipping image download");
|
||||
}
|
||||
|
||||
$file = Image::image(sys_get_temp_dir());
|
||||
$this->assertFileExists($file);
|
||||
if (function_exists('getimagesize')) {
|
||||
list($width, $height, $type, $attr) = getimagesize($file);
|
||||
$this->assertEquals(640, $width);
|
||||
$this->assertEquals(480, $height);
|
||||
$this->assertEquals(constant('IMAGETYPE_JPEG'), $type);
|
||||
} else {
|
||||
$this->assertEquals('jpg', pathinfo($file, PATHINFO_EXTENSION));
|
||||
}
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\Company;
|
||||
use Faker\Provider\Internet;
|
||||
use Faker\Provider\Lorem;
|
||||
use Faker\Provider\Person;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InternetTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Lorem($faker));
|
||||
$faker->addProvider(new Person($faker));
|
||||
$faker->addProvider(new Internet($faker));
|
||||
$faker->addProvider(new Company($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function localeDataProvider()
|
||||
{
|
||||
$providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider');
|
||||
$localePaths = array_filter(glob($providerPath . '/*', GLOB_ONLYDIR));
|
||||
foreach ($localePaths as $path) {
|
||||
$parts = explode('/', $path);
|
||||
$locales[] = array($parts[count($parts) - 1]);
|
||||
}
|
||||
|
||||
return $locales;
|
||||
}
|
||||
|
||||
/**
|
||||
* @link http://stackoverflow.com/questions/12026842/how-to-validate-an-email-address-in-php
|
||||
*
|
||||
* @dataProvider localeDataProvider
|
||||
*/
|
||||
public function testEmailIsValid($locale)
|
||||
{
|
||||
if ($locale !== 'en_US' && !class_exists('Transliterator')) {
|
||||
$this->markTestSkipped('Transliterator class not available (intl extension)');
|
||||
}
|
||||
|
||||
$this->loadLocalProviders($locale);
|
||||
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';
|
||||
$emailAddress = $this->faker->email();
|
||||
$this->assertRegExp($pattern, $emailAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
*/
|
||||
public function testUsernameIsValid($locale)
|
||||
{
|
||||
if ($locale !== 'en_US' && !class_exists('Transliterator')) {
|
||||
$this->markTestSkipped('Transliterator class not available (intl extension)');
|
||||
}
|
||||
|
||||
$this->loadLocalProviders($locale);
|
||||
$pattern = '/^[A-Za-z0-9]+([._][A-Za-z0-9]+)*$/';
|
||||
$username = $this->faker->username();
|
||||
$this->assertRegExp($pattern, $username);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
*/
|
||||
public function testDomainnameIsValid($locale)
|
||||
{
|
||||
if ($locale !== 'en_US' && !class_exists('Transliterator')) {
|
||||
$this->markTestSkipped('Transliterator class not available (intl extension)');
|
||||
}
|
||||
|
||||
$this->loadLocalProviders($locale);
|
||||
$pattern = '/^[a-z]+(\.[a-z]+)+$/';
|
||||
$domainName = $this->faker->domainName();
|
||||
$this->assertRegExp($pattern, $domainName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
*/
|
||||
public function testDomainwordIsValid($locale)
|
||||
{
|
||||
if ($locale !== 'en_US' && !class_exists('Transliterator')) {
|
||||
$this->markTestSkipped('Transliterator class not available (intl extension)');
|
||||
}
|
||||
|
||||
$this->loadLocalProviders($locale);
|
||||
$pattern = '/^[a-z]+$/';
|
||||
$domainWord = $this->faker->domainWord();
|
||||
$this->assertRegExp($pattern, $domainWord);
|
||||
}
|
||||
|
||||
public function loadLocalProviders($locale)
|
||||
{
|
||||
$providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider');
|
||||
if (file_exists($providerPath.'/'.$locale.'/Internet.php')) {
|
||||
$internet = "\\Faker\\Provider\\$locale\\Internet";
|
||||
$this->faker->addProvider(new $internet($this->faker));
|
||||
}
|
||||
if (file_exists($providerPath.'/'.$locale.'/Person.php')) {
|
||||
$person = "\\Faker\\Provider\\$locale\\Person";
|
||||
$this->faker->addProvider(new $person($this->faker));
|
||||
}
|
||||
if (file_exists($providerPath.'/'.$locale.'/Company.php')) {
|
||||
$company = "\\Faker\\Provider\\$locale\\Company";
|
||||
$this->faker->addProvider(new $company($this->faker));
|
||||
}
|
||||
}
|
||||
|
||||
public function testPasswordIsValid()
|
||||
{
|
||||
$this->assertRegexp('/^.{6}$/', $this->faker->password(6, 6));
|
||||
}
|
||||
|
||||
public function testSlugIsValid()
|
||||
{
|
||||
$pattern = '/^[a-z0-9-]+$/';
|
||||
$slug = $this->faker->slug();
|
||||
$this->assertSame(preg_match($pattern, $slug), 1);
|
||||
}
|
||||
|
||||
public function testUrlIsValid()
|
||||
{
|
||||
$url = $this->faker->url();
|
||||
$this->assertNotFalse(filter_var($url, FILTER_VALIDATE_URL));
|
||||
}
|
||||
|
||||
public function testLocalIpv4()
|
||||
{
|
||||
$this->assertNotFalse(filter_var(Internet::localIpv4(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4));
|
||||
}
|
||||
|
||||
public function testIpv4()
|
||||
{
|
||||
$this->assertNotFalse(filter_var($this->faker->ipv4(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4));
|
||||
}
|
||||
|
||||
public function testIpv4NotLocalNetwork()
|
||||
{
|
||||
$this->assertNotRegExp('/\A0\./', $this->faker->ipv4());
|
||||
}
|
||||
|
||||
public function testIpv4NotBroadcast()
|
||||
{
|
||||
$this->assertNotEquals('255.255.255.255', $this->faker->ipv4());
|
||||
}
|
||||
|
||||
public function testIpv6()
|
||||
{
|
||||
$this->assertNotFalse(filter_var($this->faker->ipv6(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
|
||||
}
|
||||
|
||||
public function testMacAddress()
|
||||
{
|
||||
$this->assertRegExp('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/i', Internet::macAddress());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Factory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LocalizationTest extends TestCase
|
||||
{
|
||||
public function testLocalizedNameProvidersDoNotThrowErrors()
|
||||
{
|
||||
foreach (glob(__DIR__ . '/../../../src/Faker/Provider/*/Person.php') as $localizedPerson) {
|
||||
preg_match('#/([a-zA-Z_]+)/Person\.php#', $localizedPerson, $matches);
|
||||
$faker = Factory::create($matches[1]);
|
||||
$this->assertNotNull($faker->name(), 'Localized Name Provider ' . $matches[1] . ' does not throw errors');
|
||||
}
|
||||
}
|
||||
|
||||
public function testLocalizedAddressProvidersDoNotThrowErrors()
|
||||
{
|
||||
foreach (glob(__DIR__ . '/../../../src/Faker/Provider/*/Address.php') as $localizedAddress) {
|
||||
preg_match('#/([a-zA-Z_]+)/Address\.php#', $localizedAddress, $matches);
|
||||
$faker = Factory::create($matches[1]);
|
||||
$this->assertNotNull($faker->address(), 'Localized Address Provider ' . $matches[1] . ' does not throw errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\Lorem;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LoremTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testTextThrowsExceptionWhenAskedTextSizeLessThan5()
|
||||
{
|
||||
Lorem::text(4);
|
||||
}
|
||||
|
||||
public function testTextReturnsWordsWhenAskedSizeLessThan25()
|
||||
{
|
||||
$this->assertEquals('Word word word word.', TestableLorem::text(24));
|
||||
}
|
||||
|
||||
public function testTextReturnsSentencesWhenAskedSizeLessThan100()
|
||||
{
|
||||
$this->assertEquals('This is a test sentence. This is a test sentence. This is a test sentence.', TestableLorem::text(99));
|
||||
}
|
||||
|
||||
public function testTextReturnsParagraphsWhenAskedSizeGreaterOrEqualThanThan100()
|
||||
{
|
||||
$this->assertEquals('This is a test paragraph. It has three sentences. Exactly three.', TestableLorem::text(100));
|
||||
}
|
||||
|
||||
public function testSentenceWithZeroNbWordsReturnsEmptyString()
|
||||
{
|
||||
$this->assertEquals('', Lorem::sentence(0));
|
||||
}
|
||||
|
||||
public function testSentenceWithNegativeNbWordsReturnsEmptyString()
|
||||
{
|
||||
$this->assertEquals('', Lorem::sentence(-1));
|
||||
}
|
||||
|
||||
public function testParagraphWithZeroNbSentencesReturnsEmptyString()
|
||||
{
|
||||
$this->assertEquals('', Lorem::paragraph(0));
|
||||
}
|
||||
|
||||
public function testParagraphWithNegativeNbSentencesReturnsEmptyString()
|
||||
{
|
||||
$this->assertEquals('', Lorem::paragraph(-1));
|
||||
}
|
||||
|
||||
public function testSentenceWithPositiveNbWordsReturnsAtLeastOneWord()
|
||||
{
|
||||
$sentence = Lorem::sentence(1);
|
||||
|
||||
$this->assertGreaterThan(1, strlen($sentence));
|
||||
$this->assertGreaterThanOrEqual(1, count(explode(' ', $sentence)));
|
||||
}
|
||||
|
||||
public function testParagraphWithPositiveNbSentencesReturnsAtLeastOneWord()
|
||||
{
|
||||
$paragraph = Lorem::paragraph(1);
|
||||
|
||||
$this->assertGreaterThan(1, strlen($paragraph));
|
||||
$this->assertGreaterThanOrEqual(1, count(explode(' ', $paragraph)));
|
||||
}
|
||||
|
||||
public function testWordssAsText()
|
||||
{
|
||||
$words = TestableLorem::words(2, true);
|
||||
|
||||
$this->assertEquals('word word', $words);
|
||||
}
|
||||
|
||||
public function testSentencesAsText()
|
||||
{
|
||||
$sentences = TestableLorem::sentences(2, true);
|
||||
|
||||
$this->assertEquals('This is a test sentence. This is a test sentence.', $sentences);
|
||||
}
|
||||
|
||||
public function testParagraphsAsText()
|
||||
{
|
||||
$paragraphs = TestableLorem::paragraphs(2, true);
|
||||
|
||||
$expected = "This is a test paragraph. It has three sentences. Exactly three.\n\nThis is a test paragraph. It has three sentences. Exactly three.";
|
||||
$this->assertEquals($expected, $paragraphs);
|
||||
}
|
||||
}
|
||||
|
||||
class TestableLorem extends Lorem
|
||||
{
|
||||
|
||||
public static function word()
|
||||
{
|
||||
return 'word';
|
||||
}
|
||||
|
||||
public static function sentence($nbWords = 5, $variableNbWords = true)
|
||||
{
|
||||
return 'This is a test sentence.';
|
||||
}
|
||||
|
||||
public static function paragraph($nbSentences = 3, $variableNbSentences = true)
|
||||
{
|
||||
return 'This is a test paragraph. It has three sentences. Exactly three.';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\Miscellaneous;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class MiscellaneousTest extends TestCase
|
||||
{
|
||||
public function testBoolean()
|
||||
{
|
||||
$this->assertContains(Miscellaneous::boolean(), array(true, false));
|
||||
}
|
||||
|
||||
public function testMd5()
|
||||
{
|
||||
$this->assertRegExp('/^[a-z0-9]{32}$/', Miscellaneous::md5());
|
||||
}
|
||||
|
||||
public function testSha1()
|
||||
{
|
||||
$this->assertRegExp('/^[a-z0-9]{40}$/', Miscellaneous::sha1());
|
||||
}
|
||||
|
||||
public function testSha256()
|
||||
{
|
||||
$this->assertRegExp('/^[a-z0-9]{64}$/', Miscellaneous::sha256());
|
||||
}
|
||||
|
||||
public function testLocale()
|
||||
{
|
||||
$this->assertRegExp('/^[a-z]{2,3}_[A-Z]{2}$/', Miscellaneous::locale());
|
||||
}
|
||||
|
||||
public function testCountryCode()
|
||||
{
|
||||
$this->assertRegExp('/^[A-Z]{2}$/', Miscellaneous::countryCode());
|
||||
}
|
||||
|
||||
public function testCountryISOAlpha3()
|
||||
{
|
||||
$this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::countryISOAlpha3());
|
||||
}
|
||||
|
||||
public function testLanguage()
|
||||
{
|
||||
$this->assertRegExp('/^[a-z]{2}$/', Miscellaneous::languageCode());
|
||||
}
|
||||
|
||||
public function testCurrencyCode()
|
||||
{
|
||||
$this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::currencyCode());
|
||||
}
|
||||
|
||||
public function testEmoji()
|
||||
{
|
||||
$this->assertRegExp('/^[\x{1F600}-\x{1F637}]$/u', Miscellaneous::emoji());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Calculator\Iban;
|
||||
use Faker\Calculator\Luhn;
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\Base as BaseProvider;
|
||||
use Faker\Provider\DateTime as DateTimeProvider;
|
||||
use Faker\Provider\Payment as PaymentProvider;
|
||||
use Faker\Provider\Person as PersonProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PaymentTest extends TestCase
|
||||
{
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new BaseProvider($faker));
|
||||
$faker->addProvider(new DateTimeProvider($faker));
|
||||
$faker->addProvider(new PersonProvider($faker));
|
||||
$faker->addProvider(new PaymentProvider($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function localeDataProvider()
|
||||
{
|
||||
$providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider');
|
||||
$localePaths = array_filter(glob($providerPath . '/*', GLOB_ONLYDIR));
|
||||
foreach ($localePaths as $path) {
|
||||
$parts = explode('/', $path);
|
||||
$locales[] = array($parts[count($parts) - 1]);
|
||||
}
|
||||
|
||||
return $locales;
|
||||
}
|
||||
|
||||
public function loadLocalProviders($locale)
|
||||
{
|
||||
$providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider');
|
||||
if (file_exists($providerPath.'/'.$locale.'/Payment.php')) {
|
||||
$payment = "\\Faker\\Provider\\$locale\\Payment";
|
||||
$this->faker->addProvider(new $payment($this->faker));
|
||||
}
|
||||
}
|
||||
|
||||
public function testCreditCardTypeReturnsValidVendorName()
|
||||
{
|
||||
$this->assertContains($this->faker->creditCardType, array('Visa', 'Visa Retired', 'MasterCard', 'American Express', 'Discover Card'));
|
||||
}
|
||||
|
||||
public function creditCardNumberProvider()
|
||||
{
|
||||
return array(
|
||||
array('Discover Card', '/^6011\d{12}$/'),
|
||||
array('Visa', '/^4\d{15}$/'),
|
||||
array('Visa Retired', '/^4\d{12}$/'),
|
||||
array('MasterCard', '/^(5[1-5]|2[2-7])\d{14}$/')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider creditCardNumberProvider
|
||||
*/
|
||||
public function testCreditCardNumberReturnsValidCreditCardNumber($type, $regexp)
|
||||
{
|
||||
$cardNumber = $this->faker->creditCardNumber($type);
|
||||
$this->assertRegExp($regexp, $cardNumber);
|
||||
$this->assertTrue(Luhn::isValid($cardNumber));
|
||||
}
|
||||
|
||||
public function testCreditCardNumberCanFormatOutput()
|
||||
{
|
||||
$this->assertRegExp('/^6011-\d{4}-\d{4}-\d{4}$/', $this->faker->creditCardNumber('Discover Card', true));
|
||||
}
|
||||
|
||||
public function testCreditCardExpirationDateReturnsValidDateByDefault()
|
||||
{
|
||||
$expirationDate = $this->faker->creditCardExpirationDate;
|
||||
$this->assertTrue(intval($expirationDate->format('U')) > strtotime('now'));
|
||||
$this->assertTrue(intval($expirationDate->format('U')) < strtotime('+36 months'));
|
||||
}
|
||||
|
||||
public function testRandomCard()
|
||||
{
|
||||
$cardDetails = $this->faker->creditCardDetails;
|
||||
$this->assertEquals(count($cardDetails), 4);
|
||||
$this->assertEquals(array('type', 'number', 'name', 'expirationDate'), array_keys($cardDetails));
|
||||
}
|
||||
|
||||
protected $ibanFormats = array(
|
||||
'AD' => '/^AD\d{2}\d{4}\d{4}[A-Z0-9]{12}$/',
|
||||
'AE' => '/^AE\d{2}\d{3}\d{16}$/',
|
||||
'AL' => '/^AL\d{2}\d{8}[A-Z0-9]{16}$/',
|
||||
'AT' => '/^AT\d{2}\d{5}\d{11}$/',
|
||||
'AZ' => '/^AZ\d{2}[A-Z]{4}[A-Z0-9]{20}$/',
|
||||
'BA' => '/^BA\d{2}\d{3}\d{3}\d{8}\d{2}$/',
|
||||
'BE' => '/^BE\d{2}\d{3}\d{7}\d{2}$/',
|
||||
'BG' => '/^BG\d{2}[A-Z]{4}\d{4}\d{2}[A-Z0-9]{8}$/',
|
||||
'BH' => '/^BH\d{2}[A-Z]{4}[A-Z0-9]{14}$/',
|
||||
'BR' => '/^BR\d{2}\d{8}\d{5}\d{10}[A-Z]{1}[A-Z0-9]{1}$/',
|
||||
'CH' => '/^CH\d{2}\d{5}[A-Z0-9]{12}$/',
|
||||
'CR' => '/^CR\d{2}\d{3}\d{14}$/',
|
||||
'CY' => '/^CY\d{2}\d{3}\d{5}[A-Z0-9]{16}$/',
|
||||
'CZ' => '/^CZ\d{2}\d{4}\d{6}\d{10}$/',
|
||||
'DE' => '/^DE\d{2}\d{8}\d{10}$/',
|
||||
'DK' => '/^DK\d{2}\d{4}\d{9}\d{1}$/',
|
||||
'DO' => '/^DO\d{2}[A-Z0-9]{4}\d{20}$/',
|
||||
'EE' => '/^EE\d{2}\d{2}\d{2}\d{11}\d{1}$/',
|
||||
'ES' => '/^ES\d{2}\d{4}\d{4}\d{1}\d{1}\d{10}$/',
|
||||
'FI' => '/^FI\d{2}\d{6}\d{7}\d{1}$/',
|
||||
'FR' => '/^FR\d{2}\d{5}\d{5}[A-Z0-9]{11}\d{2}$/',
|
||||
'GB' => '/^GB\d{2}[A-Z]{4}\d{6}\d{8}$/',
|
||||
'GE' => '/^GE\d{2}[A-Z]{2}\d{16}$/',
|
||||
'GI' => '/^GI\d{2}[A-Z]{4}[A-Z0-9]{15}$/',
|
||||
'GR' => '/^GR\d{2}\d{3}\d{4}[A-Z0-9]{16}$/',
|
||||
'GT' => '/^GT\d{2}[A-Z0-9]{4}[A-Z0-9]{20}$/',
|
||||
'HR' => '/^HR\d{2}\d{7}\d{10}$/',
|
||||
'HU' => '/^HU\d{2}\d{3}\d{4}\d{1}\d{15}\d{1}$/',
|
||||
'IE' => '/^IE\d{2}[A-Z]{4}\d{6}\d{8}$/',
|
||||
'IL' => '/^IL\d{2}\d{3}\d{3}\d{13}$/',
|
||||
'IS' => '/^IS\d{2}\d{4}\d{2}\d{6}\d{10}$/',
|
||||
'IT' => '/^IT\d{2}[A-Z]{1}\d{5}\d{5}[A-Z0-9]{12}$/',
|
||||
'KW' => '/^KW\d{2}[A-Z]{4}\d{22}$/',
|
||||
'KZ' => '/^KZ\d{2}\d{3}[A-Z0-9]{13}$/',
|
||||
'LB' => '/^LB\d{2}\d{4}[A-Z0-9]{20}$/',
|
||||
'LI' => '/^LI\d{2}\d{5}[A-Z0-9]{12}$/',
|
||||
'LT' => '/^LT\d{2}\d{5}\d{11}$/',
|
||||
'LU' => '/^LU\d{2}\d{3}[A-Z0-9]{13}$/',
|
||||
'LV' => '/^LV\d{2}[A-Z]{4}[A-Z0-9]{13}$/',
|
||||
'MC' => '/^MC\d{2}\d{5}\d{5}[A-Z0-9]{11}\d{2}$/',
|
||||
'MD' => '/^MD\d{2}[A-Z0-9]{2}[A-Z0-9]{18}$/',
|
||||
'ME' => '/^ME\d{2}\d{3}\d{13}\d{2}$/',
|
||||
'MK' => '/^MK\d{2}\d{3}[A-Z0-9]{10}\d{2}$/',
|
||||
'MR' => '/^MR\d{2}\d{5}\d{5}\d{11}\d{2}$/',
|
||||
'MT' => '/^MT\d{2}[A-Z]{4}\d{5}[A-Z0-9]{18}$/',
|
||||
'MU' => '/^MU\d{2}[A-Z]{4}\d{2}\d{2}\d{12}\d{3}[A-Z]{3}$/',
|
||||
'NL' => '/^NL\d{2}[A-Z]{4}\d{10}$/',
|
||||
'NO' => '/^NO\d{2}\d{4}\d{6}\d{1}$/',
|
||||
'PK' => '/^PK\d{2}[A-Z]{4}[A-Z0-9]{16}$/',
|
||||
'PL' => '/^PL\d{2}\d{8}\d{16}$/',
|
||||
'PS' => '/^PS\d{2}[A-Z]{4}[A-Z0-9]{21}$/',
|
||||
'PT' => '/^PT\d{2}\d{4}\d{4}\d{11}\d{2}$/',
|
||||
'RO' => '/^RO\d{2}[A-Z]{4}[A-Z0-9]{16}$/',
|
||||
'RS' => '/^RS\d{2}\d{3}\d{13}\d{2}$/',
|
||||
'SA' => '/^SA\d{2}\d{2}[A-Z0-9]{18}$/',
|
||||
'SE' => '/^SE\d{2}\d{3}\d{16}\d{1}$/',
|
||||
'SI' => '/^SI\d{2}\d{5}\d{8}\d{2}$/',
|
||||
'SK' => '/^SK\d{2}\d{4}\d{6}\d{10}$/',
|
||||
'SM' => '/^SM\d{2}[A-Z]{1}\d{5}\d{5}[A-Z0-9]{12}$/',
|
||||
'TN' => '/^TN\d{2}\d{2}\d{3}\d{13}\d{2}$/',
|
||||
'TR' => '/^TR\d{2}\d{5}\d{1}[A-Z0-9]{16}$/',
|
||||
'VG' => '/^VG\d{2}[A-Z]{4}\d{16}$/',
|
||||
);
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
*/
|
||||
public function testBankAccountNumber($locale)
|
||||
{
|
||||
$parts = explode('_', $locale);
|
||||
$countryCode = array_pop($parts);
|
||||
|
||||
if (!isset($this->ibanFormats[$countryCode])) {
|
||||
// No IBAN format available
|
||||
return;
|
||||
}
|
||||
|
||||
$this->loadLocalProviders($locale);
|
||||
|
||||
try {
|
||||
$iban = $this->faker->bankAccountNumber;
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
// Not implemented, nothing to test
|
||||
$this->markTestSkipped("bankAccountNumber not implemented for $locale");
|
||||
return;
|
||||
}
|
||||
|
||||
// Test format
|
||||
$this->assertRegExp($this->ibanFormats[$countryCode], $iban);
|
||||
|
||||
// Test checksum
|
||||
$this->assertTrue(Iban::isValid($iban), "Checksum for $iban is invalid");
|
||||
}
|
||||
|
||||
public function ibanFormatProvider()
|
||||
{
|
||||
$return = array();
|
||||
foreach ($this->ibanFormats as $countryCode => $regex) {
|
||||
$return[] = array($countryCode, $regex);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
/**
|
||||
* @dataProvider ibanFormatProvider
|
||||
*/
|
||||
public function testIban($countryCode, $regex)
|
||||
{
|
||||
$iban = $this->faker->iban($countryCode);
|
||||
|
||||
// Test format
|
||||
$this->assertRegExp($regex, $iban);
|
||||
|
||||
// Test checksum
|
||||
$this->assertTrue(Iban::isValid($iban), "Checksum for $iban is invalid");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\Person;
|
||||
use Faker\Generator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PersonTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider firstNameProvider
|
||||
*/
|
||||
public function testFirstName($gender, $expected)
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Person($faker));
|
||||
$this->assertContains($faker->firstName($gender), $expected);
|
||||
}
|
||||
|
||||
public function firstNameProvider()
|
||||
{
|
||||
return array(
|
||||
array(null, array('John', 'Jane')),
|
||||
array('foobar', array('John', 'Jane')),
|
||||
array('male', array('John')),
|
||||
array('female', array('Jane')),
|
||||
);
|
||||
}
|
||||
|
||||
public function testFirstNameMale()
|
||||
{
|
||||
$this->assertContains(Person::firstNameMale(), array('John'));
|
||||
}
|
||||
|
||||
public function testFirstNameFemale()
|
||||
{
|
||||
$this->assertContains(Person::firstNameFemale(), array('Jane'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider titleProvider
|
||||
*/
|
||||
public function testTitle($gender, $expected)
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Person($faker));
|
||||
$this->assertContains($faker->title($gender), $expected);
|
||||
}
|
||||
|
||||
public function titleProvider()
|
||||
{
|
||||
return array(
|
||||
array(null, array('Mr.', 'Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')),
|
||||
array('foobar', array('Mr.', 'Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')),
|
||||
array('male', array('Mr.', 'Dr.', 'Prof.')),
|
||||
array('female', array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')),
|
||||
);
|
||||
}
|
||||
|
||||
public function testTitleMale()
|
||||
{
|
||||
$this->assertContains(Person::titleMale(), array('Mr.', 'Dr.', 'Prof.'));
|
||||
}
|
||||
|
||||
public function testTitleFemale()
|
||||
{
|
||||
$this->assertContains(Person::titleFemale(), array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.'));
|
||||
}
|
||||
|
||||
public function testLastNameReturnsDoe()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Person($faker));
|
||||
$this->assertEquals($faker->lastName(), 'Doe');
|
||||
}
|
||||
|
||||
public function testNameReturnsFirstNameAndLastName()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Person($faker));
|
||||
$this->assertContains($faker->name(), array('John Doe', 'Jane Doe'));
|
||||
$this->assertContains($faker->name('foobar'), array('John Doe', 'Jane Doe'));
|
||||
$this->assertContains($faker->name('male'), array('John Doe'));
|
||||
$this->assertContains($faker->name('female'), array('Jane Doe'));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Calculator\Luhn;
|
||||
use Faker\Provider\PhoneNumber;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PhoneNumberTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new PhoneNumber($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testPhoneNumberFormat()
|
||||
{
|
||||
$number = $this->faker->e164PhoneNumber();
|
||||
$this->assertRegExp('/^\+[0-9]{11,}$/', $number);
|
||||
}
|
||||
|
||||
public function testImeiReturnsValidNumber()
|
||||
{
|
||||
$imei = $this->faker->imei();
|
||||
$this->assertTrue(Luhn::isValid($imei));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Mark van der Velden <mark@dynom.nl>
|
||||
*/
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Class ProviderOverrideTest
|
||||
*
|
||||
* @package Faker\Test\Provider
|
||||
*
|
||||
* This class tests a large portion of all locale specific providers. It does not test the entire stack, because each
|
||||
* locale specific provider (can) has specific implementations. The goal of this test is to test the common denominator
|
||||
* and to try to catch possible invalid multi-byte sequences.
|
||||
*/
|
||||
class ProviderOverrideTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Constants with regular expression patterns for testing the output.
|
||||
*
|
||||
* Regular expressions are sensitive for malformed strings (e.g.: strings with incorrect encodings) so by using
|
||||
* PCRE for the tests, even though they seem fairly pointless, we test for incorrect encodings also.
|
||||
*/
|
||||
const TEST_STRING_REGEX = '/.+/u';
|
||||
|
||||
/**
|
||||
* Slightly more specific for e-mail, the point isn't to properly validate e-mails.
|
||||
*/
|
||||
const TEST_EMAIL_REGEX = '/^(.+)@(.+)$/ui';
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
* @param string $locale
|
||||
*/
|
||||
public function testAddress($locale = null)
|
||||
{
|
||||
$faker = Faker\Factory::create($locale);
|
||||
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->city);
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->postcode);
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->address);
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->country);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
* @param string $locale
|
||||
*/
|
||||
public function testCompany($locale = null)
|
||||
{
|
||||
$faker = Faker\Factory::create($locale);
|
||||
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->company);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
* @param string $locale
|
||||
*/
|
||||
public function testDateTime($locale = null)
|
||||
{
|
||||
$faker = Faker\Factory::create($locale);
|
||||
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->century);
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->timezone);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
* @param string $locale
|
||||
*/
|
||||
public function testInternet($locale = null)
|
||||
{
|
||||
if ($locale && $locale !== 'en_US' && !class_exists('Transliterator')) {
|
||||
$this->markTestSkipped('Transliterator class not available (intl extension)');
|
||||
}
|
||||
|
||||
$faker = Faker\Factory::create($locale);
|
||||
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->userName);
|
||||
|
||||
$this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->email);
|
||||
$this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->safeEmail);
|
||||
$this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->freeEmail);
|
||||
$this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->companyEmail);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
* @param string $locale
|
||||
*/
|
||||
public function testPerson($locale = null)
|
||||
{
|
||||
$faker = Faker\Factory::create($locale);
|
||||
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->name);
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->title);
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->firstName);
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->lastName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
* @param string $locale
|
||||
*/
|
||||
public function testPhoneNumber($locale = null)
|
||||
{
|
||||
$faker = Faker\Factory::create($locale);
|
||||
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->phoneNumber);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
* @param string $locale
|
||||
*/
|
||||
public function testUserAgent($locale = null)
|
||||
{
|
||||
$faker = Faker\Factory::create($locale);
|
||||
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->userAgent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider localeDataProvider
|
||||
*
|
||||
* @param null $locale
|
||||
* @param string $locale
|
||||
*/
|
||||
public function testUuid($locale = null)
|
||||
{
|
||||
$faker = Faker\Factory::create($locale);
|
||||
|
||||
$this->assertRegExp(static::TEST_STRING_REGEX, $faker->uuid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function localeDataProvider()
|
||||
{
|
||||
$locales = $this->getAllLocales();
|
||||
$data = array();
|
||||
|
||||
foreach ($locales as $locale) {
|
||||
$data[] = array(
|
||||
$locale
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all locales as array values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getAllLocales()
|
||||
{
|
||||
static $locales = array();
|
||||
|
||||
if ( ! empty($locales)) {
|
||||
return $locales;
|
||||
}
|
||||
|
||||
// Finding all PHP files in the xx_XX directories
|
||||
$providerDir = __DIR__ .'/../../../src/Faker/Provider';
|
||||
foreach (glob($providerDir .'/*_*/*.php') as $file) {
|
||||
$localisation = basename(dirname($file));
|
||||
|
||||
if (isset($locales[ $localisation ])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$locales[ $localisation ] = $localisation;
|
||||
}
|
||||
|
||||
return $locales;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\en_US\Text;
|
||||
use Faker\Generator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TextTest extends TestCase
|
||||
{
|
||||
public function testTextMaxLength()
|
||||
{
|
||||
$generator = new Generator();
|
||||
$generator->addProvider(new Text($generator));
|
||||
$generator->seed(0);
|
||||
|
||||
$lengths = array(10, 20, 50, 70, 90, 120, 150, 200, 500);
|
||||
|
||||
foreach ($lengths as $length) {
|
||||
$this->assertLessThan($length, $generator->realText($length));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testTextMaxIndex()
|
||||
{
|
||||
$generator = new Generator();
|
||||
$generator->addProvider(new Text($generator));
|
||||
$generator->seed(0);
|
||||
$generator->realText(200, 11);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testTextMinIndex()
|
||||
{
|
||||
$generator = new Generator();
|
||||
$generator->addProvider(new Text($generator));
|
||||
$generator->seed(0);
|
||||
$generator->realText(200, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testTextMinLength()
|
||||
{
|
||||
$generator = new Generator();
|
||||
$generator->addProvider(new Text($generator));
|
||||
$generator->seed(0);
|
||||
$generator->realText(9);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Provider\UserAgent;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class UserAgentTest extends TestCase
|
||||
{
|
||||
public function testRandomUserAgent()
|
||||
{
|
||||
$this->assertNotNull(UserAgent::userAgent());
|
||||
}
|
||||
|
||||
public function testFirefoxUserAgent()
|
||||
{
|
||||
$this->stringContains(' Firefox/', UserAgent::firefox());
|
||||
}
|
||||
|
||||
public function testSafariUserAgent()
|
||||
{
|
||||
$this->stringContains('Safari/', UserAgent::safari());
|
||||
}
|
||||
|
||||
public function testInternetExplorerUserAgent()
|
||||
{
|
||||
$this->assertStringStartsWith('Mozilla/5.0 (compatible; MSIE ', UserAgent::internetExplorer());
|
||||
}
|
||||
|
||||
public function testOperaUserAgent()
|
||||
{
|
||||
$this->assertStringStartsWith('Opera/', UserAgent::opera());
|
||||
}
|
||||
|
||||
public function testChromeUserAgent()
|
||||
{
|
||||
$this->stringContains('(KHTML, like Gecko) Chrome/', UserAgent::chrome());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\Uuid as BaseProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class UuidTest extends TestCase
|
||||
{
|
||||
public function testUuidReturnsUuid()
|
||||
{
|
||||
$uuid = BaseProvider::uuid();
|
||||
$this->assertTrue($this->isUuid($uuid));
|
||||
}
|
||||
|
||||
public function testUuidExpectedSeed()
|
||||
{
|
||||
if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) {
|
||||
$this->markTestSkipped('Big Endian');
|
||||
}
|
||||
$faker = new Generator();
|
||||
$faker->seed(123);
|
||||
$this->assertEquals("8e2e0c84-50dd-367c-9e66-f3ab455c78d6", BaseProvider::uuid());
|
||||
$this->assertEquals("073eb60a-902c-30ab-93d0-a94db371f6c8", BaseProvider::uuid());
|
||||
}
|
||||
|
||||
protected function isUuid($uuid)
|
||||
{
|
||||
return is_string($uuid) && (bool) preg_match('/^[a-f0-9]{8,8}-(?:[a-f0-9]{4,4}-){3,3}[a-f0-9]{12,12}$/i', $uuid);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider\ar_JO;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\fi_FI\Person;
|
||||
use Faker\Provider\fi_FI\Internet;
|
||||
use Faker\Provider\fi_FI\Company;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InternetTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Person($faker));
|
||||
$faker->addProvider(new Internet($faker));
|
||||
$faker->addProvider(new Company($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testEmailIsValid()
|
||||
{
|
||||
$email = $this->faker->email();
|
||||
$this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Faker\Test\Provider\ar_SA;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\ar_SA\Person;
|
||||
use Faker\Provider\ar_SA\Internet;
|
||||
use Faker\Provider\ar_SA\Company;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class InternetTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Person($faker));
|
||||
$faker->addProvider(new Internet($faker));
|
||||
$faker->addProvider(new Company($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testEmailIsValid()
|
||||
{
|
||||
$email = $this->faker->email();
|
||||
$this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue