Use CaseUpdated
PHPUnit Fixtures with MockHero
Base Test Case
<?php
use PHPUnit\Framework\TestCase;
use GuzzleHttp\Client;
abstract class IntegrationTestCase extends TestCase {
protected static array $data;
public static function setUpBeforeClass(): void {
$client = new Client();
$res = $client->post("https://api.mockhero.dev/api/v1/generate", [
"headers" => [
"x-api-key" => getenv("MOCKHERO_API_KEY"),
],
"json" => [
"seed" => 1,
"tables" => [[
"name" => "users", "count" => 10, "fields" => [
["name" => "id", "type" => "uuid"],
["name" => "email", "type" => "email"],
]
]]
]
]);
self::$data = json_decode($res->getBody(), true);
}
}
Get Started
D
Founder of MockHero. Writes about synthetic test data, agent workflows, and database seeding with MockHero.
Start generating test data for free
500 records/day on the free tier. No credit card required.
Get Your API Key