Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Writes Pest tests and data-object factories for framework-agnostic PHP Composer packages using fbarrento/data-factory and in-memory doubles.
55% 100%+45 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 12 of 22 without it.
3 of 3 safety checks passed
Not used yet
Use this skill for standalone Composer packages that do not boot Laravel. There is no service container, no Laravel fakes, and no Eloquent. Resolve collaborators with new, build test data with fbarrento/data-factory for data objects, and roll in-memory doubles for service dependencies.
When testing inside a full Laravel application instead, prefer the laravel-rules skill.
use FBarrento\DataFactory\Factory;
use Vendor\Package\Actions\CreateWaitlistSignup;
use Vendor\Package\Data\CreateWaitlistSignupData;
beforeEach(function (): void {
$this->createWaitlistSignup = new CreateWaitlistSignup();
});
test('creates a waitlist signup from data',
/**
* @throws Exception
*/
function (): void {
$data = CreateWaitlistSignupData::factory()->make();
$waitlistSignup = $this->createWaitlistSignup->handle($data);
expect($waitlistSignup->id)->toBeString()
->and($waitlistSignup->email)->toBe($data->email)
->and($waitlistSignup->createdAt)->not->toBeNull();
});
rules/testing.mdtest() for Pest tests, never it().->and() instead of separate expect() blocks.new in beforeEach() and assign them to $this.Next to this one in the catalogue, plus more from the same author.