Skip to content
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

Implement fixture guesser for Faker extension #19

Open
yii-bot opened this issue Jan 24, 2016 · 0 comments
Open

Implement fixture guesser for Faker extension #19

yii-bot opened this issue Jan 24, 2016 · 0 comments
Labels
type:enhancement Enhancement

Comments

@yii-bot
Copy link

yii-bot commented Jan 24, 2016

This issue has originally been reported by @Ragazzo at yiisoft/yii2#4056.
Moved here by @cebe.


In the Faker there are some column guessers like this one and this, their purpose is to help user to avoid manual matching attribute names on correct providers, because in most cases username or email in table or other storage means simple user name and email that is userName and email providers in Faker.

In this way it would be great if we will implement such functionality for generating templates based on some tables or mongo collections or other storages. So overall usage of command is :

//generate fixture template for users table, basing on some guessing mechanism
php yii fixture/template users

and if for example users table contains email / username / first_name / last_name and other, the resulting fixture template file will be like this :

//keys are attributes names, while values are anonymous functions or faker provider method names
return [
    'username'  => 'userName',
    'first_name' => 'firstName',
    'email' => 'email',
    'last_name' => 'lastName'
];

Overall what we achive :

  • more automating generation in testing to help user;
  • we can implement different guessing strategies;
  • we can implement different storages that provides metadata for particular fixture template (it can be users table, or users collection in mongo, or some data in redis).

What is your thoughts @samdark @qiangxue @cebe @klimov-paul ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants