From 73ff438e9c07d471746d395e2db513e9cdb64fbd Mon Sep 17 00:00:00 2001 From: Michael Utz Date: Tue, 15 Nov 2022 14:37:59 +0300 Subject: [PATCH] Add more variety to the test calls --- tests/Feature/UserTest.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/Feature/UserTest.php b/tests/Feature/UserTest.php index b19fea9..6c5c38d 100644 --- a/tests/Feature/UserTest.php +++ b/tests/Feature/UserTest.php @@ -2,19 +2,25 @@ use TestProject\User; +uses()->group('file group'); + $makeUser = fn () => new User(18, 'John'); +beforeEach(fn () => $this->sut = $makeUser()); + test('class constructor') ->expect($makeUser) ->name->toBe('John') ->age->toBe(18) ->favorite_movies->toBeEmpty(); -test('tellName') - ->expect($makeUser) - ->tellName()->toBeString()->toContain('John'); +test('tellName', function () { + expect($this->sut) + ->tellName()->toBeString()->toContain('John'); +}) + ->group('special tests'); -test('tellAge') +it('can tellAge') ->expect($makeUser) ->tellAge()->toBeString()->toContain('18');