Skip to content

Commit b617258

Browse files
committed
Added test for create lazing using callback
1 parent 88b4b90 commit b617258

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Unit/Concerns/LazyDataTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@ public function will_create_lazy_instance(): void
3535
self::assertEquals('John Doe', $person->fullName);
3636
}
3737

38+
/**
39+
* @throws Throwable
40+
*/
41+
#[Test]
42+
public function will_create_lazy_instance_using_callback(): void
43+
{
44+
$person = PersonData::createLazyUsing(
45+
static fn () => PersonData::create(
46+
firstName: 'John',
47+
lastName: 'Doe'
48+
)
49+
);
50+
51+
self::assertInstanceOf(PersonData::class, $person);
52+
self::assertEquals('John Doe', $person->fullName);
53+
}
54+
3855
/**
3956
* @throws Throwable
4057
*/

0 commit comments

Comments
 (0)