Faker Stripe jest dostawcą dla FakerPHP, który generuje fałszywe, ale strukturalnie poprawne identyfikatory dla zasobów API Stripe. Stripe ma sporo różnych typów zasobów, ale ten pakiet ma ponad 50 + różnych metod fałszowania:Ten pakiet łatwo integruje się z PestPHP, PHPUnit i Eloquent: Fabryki:
$faker->stripeCorePaymentIntentId();
// pi_KiAjc3WFzvswIhq8IkCLXNBW
$faker->stripeConnectAccountId();
// acct_xBXg7yyrSyQVbsjM
$faker->stripeFinancialConnectionAccountId();
// fca_z3JzQ1OCkYved5uWOqh3b387
// Pest example
beforeEach(function () {
$this->fake = fake();
$this->fake->addProvider(new Stripe($this->fake));
});
it('shows an example', function () {
$this->fake->stripeConnectAccountId() // acct_xBXg7yyrSyQVbsjM
});
// Laravel factory example
use WithFaker;
public function definition(): array
{
$this->faker->addProvider(new Stripe($this->faker));
$this->faker->stripeConnectAccountId(); // acct_xBXg7yyrSyQVbsjM
}
Możesz dowiedzieć się więcej o tym pakiecie, uzyskać pełne instrukcje instalacji i wyświetlić kod źródłowy na GitHub.