Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Signature of closure #361

Merged
merged 1 commit into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/Unit/FieldDefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Ergebnis\FactoryBot\FieldDefinition;
use Ergebnis\FactoryBot\FixtureFactory;
use Example\Entity;
use Faker\Generator;

/**
* @internal
Expand All @@ -38,7 +39,7 @@ final class FieldDefinitionTest extends AbstractTestCase
{
public function testClosureReturnsRequiredClosure(): void
{
$closure = static function (FixtureFactory $fixtureFactory): Entity\User {
$closure = static function (Generator $faker, FixtureFactory $fixtureFactory): Entity\User {
/** @var Entity\User $user */
$user = $fixtureFactory->createOne(Entity\User::class);

Expand All @@ -56,7 +57,7 @@ public function testClosureReturnsRequiredClosure(): void

public function testOptionalClosureReturnsOptionalClosure(): void
{
$closure = static function (FixtureFactory $fixtureFactory): Entity\User {
$closure = static function (Generator $faker, FixtureFactory $fixtureFactory): Entity\User {
/** @var Entity\User $user */
$user = $fixtureFactory->createOne(Entity\User::class);

Expand Down
2 changes: 1 addition & 1 deletion test/Unit/FixtureFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public function testCreateOneResolvesOptionalClosureToNullWhenFakerReturnsFalse(
$fixtureFactory->define(Entity\CodeOfConduct::class);

$fixtureFactory->define(Entity\Repository::class, [
'codeOfConduct' => FieldDefinition::optionalClosure(static function (FixtureFactory $fixtureFactory): Entity\CodeOfConduct {
'codeOfConduct' => FieldDefinition::optionalClosure(static function (Generator $faker, FixtureFactory $fixtureFactory): Entity\CodeOfConduct {
return $fixtureFactory->createOne(Entity\CodeOfConduct::class);
}),
]);
Expand Down