A Faker provider with some random miscellaneous helpers
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
$ composer require mrgoodbytes8667/test-common-faker
use Bytes\Common\Faker\Providers\MiscProvider; use Faker\Factory; /** @var Factory|MiscProvider $faker */ $faker = Factory::create(); $faker->addProvider(new MiscProvider($faker)); $faker->camelWords(); $faker->snakeWords(); $faker->oneOrMoreOf(['some', 'iterable', 'object']); $faker->rangeBetween(4, 1, 2); $faker->randomAlphanumericString(); $faker->paragraphsMinimumChars();
Note: @var is helpful for IDE autocompletion
If you are using $faker in every test, you can use
TestFakerTrait to setup/teardown
$this->faker before/after each test.
Declare $this->providers as an array of additional providers beyond MiscProvider to auto-add them when using this trait.
discord-response-bundle by MrGoodBytes is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Based on a work at https://github.com/mrgoodbytes8667/discord-response-bundle.