-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.6] Add faker helper #23451
[5.6] Add faker helper #23451
Conversation
Is this for normal copy that is not part of a database entry? Like your on-page lorem ipsum? |
yea exactly, this is for creating fake data to populate mockups. Data that does not yet exist in the app's database. |
I know there aren't really any tests around the helpers, but I had a silly syntax error in my first PR, so I added a test to be extra safe! |
Thanks for the idea =) |
public function testFakerIsCreated() | ||
{ | ||
$this->assertTrue(faker() instanceof \Faker\Generator); | ||
$this->assertTrue(faker('fr_FR') instanceof \Faker\Generator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use $this->assertInstanceOf('\Faker\Generator', faker());
here for clearer errors 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, I’m camping for the weekend, but if there is interest in this and it hasn’t been canned by the boss, I’ll tweak this on Monday (Aus Time).
Thanks for the tip!
I want to try to avoid defining too many new helpers. Feel free to define it in your application. |
I'm currently adding a new section mockup to an existing app. This helper has been indispensable with creating fake data in my views as quickly as possible to get a visual to the client.
Directly in my mockup view I can...
This makes for some serious Rapid Mockup Development™️ but is also easy enough to add to an app's helpers if not wanted in the core.
This only works in dev, not in production as faker is a dev only requirement - but I think that makes sense for a mockup helper.