mirror of
https://github.com/pnx/neotest-phpunit
synced 2026-06-18 04:10:01 +02:00
Add more variety to the test calls
This commit is contained in:
parent
d6dd4fd598
commit
73ff438e9c
1 changed files with 10 additions and 4 deletions
|
|
@ -2,19 +2,25 @@
|
||||||
|
|
||||||
use TestProject\User;
|
use TestProject\User;
|
||||||
|
|
||||||
|
uses()->group('file group');
|
||||||
|
|
||||||
$makeUser = fn () => new User(18, 'John');
|
$makeUser = fn () => new User(18, 'John');
|
||||||
|
|
||||||
|
beforeEach(fn () => $this->sut = $makeUser());
|
||||||
|
|
||||||
test('class constructor')
|
test('class constructor')
|
||||||
->expect($makeUser)
|
->expect($makeUser)
|
||||||
->name->toBe('John')
|
->name->toBe('John')
|
||||||
->age->toBe(18)
|
->age->toBe(18)
|
||||||
->favorite_movies->toBeEmpty();
|
->favorite_movies->toBeEmpty();
|
||||||
|
|
||||||
test('tellName')
|
test('tellName', function () {
|
||||||
->expect($makeUser)
|
expect($this->sut)
|
||||||
->tellName()->toBeString()->toContain('John');
|
->tellName()->toBeString()->toContain('John');
|
||||||
|
})
|
||||||
|
->group('special tests');
|
||||||
|
|
||||||
test('tellAge')
|
it('can tellAge')
|
||||||
->expect($makeUser)
|
->expect($makeUser)
|
||||||
->tellAge()->toBeString()->toContain('18');
|
->tellAge()->toBeString()->toContain('18');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue