Giter Site home page Giter Site logo

factory-muffin-faker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

factory-muffin-faker's Issues

Keep compatibility with Faker

I really like FactoryMuffin 3.0. In my opinion a lot of good design decisions were made for the upcoming version.

What's a show stopper for me at the moment though is very limited compatibility with Faker through the facade. Especially bothering at the current point is one thing. If I'm using Faker directly I can concatenate generated string. So this would work

$fm->define('Model')->setDefinitions(array(
    'someValue' => $faker->firstName() . ' ' . $faker->randomNumber()
));

Using the facade I get an exception, because the returned closure can not be casted to a string.

$fm->define('Model')->setDefinitions(array(
    'someValue' => Faker::firstName() . ' ' . Faker::randomNumber()
));

That's why I'm wondering, why is a closure returned in Faker.php in line 121 (format() method). Why is the result not directly returned like so:

/**
     * Wrap a faker format in a closure.
     *
     * @param string $formatter The formatter.
     * @param array  $arguments The arguments.
     *
     * @return \Closure
     */
    public function format($formatter, array $arguments = [])
    {
        return $this->getGenerator()->format( $formatter, $arguments );
    }

This would already resolve the issue but I guess there would be other drawbacks?

I dosent install Faker 1.5

when I require the package with composer I figure out that the faker dependency still on 1.4, how I can get 1.5? because I need the Arabic support from faker 1.5 to to generate data!!

unique() doesn't scale

unique() is pretty easy to understand: a global repository of already-generated data, guaranteed not to be repeated. In our application, we have ~400 factories, and about 1k instances of unique() corresponding to database constraint and about 800 unit tests. We easily surpass the 10k limit and even when upping to 100k. It would be immensely helpful to be able to pass a key: unique('table.column')->whatever(). In addition, would be good to have a clear() method when we refresh the database.

protected function _after()
{
    Faker::unique()->clear();
}

If agreed, I can spin up a PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.