mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Higher Order Tests now resolve callable expectations. The tap method now always returns the test case.
This commit is contained in:
@ -10,14 +10,18 @@ it('is capable doing multiple assertions')
|
||||
->assertTrue(true)
|
||||
->assertFalse(false);
|
||||
|
||||
it('resolves expect callables correctly')
|
||||
->expect(function () { return 'foo'; })
|
||||
->toBeString()
|
||||
->toBe('foo')
|
||||
->and('bar')
|
||||
->toBeString()
|
||||
->toBe('bar');
|
||||
|
||||
it('can tap into the test')
|
||||
->expect('foo')->toBeString()->toBe('foo')
|
||||
->expect('foo')->toBeString()
|
||||
->tap(function () { expect($this)->toBeInstanceOf(TestCase::class); })
|
||||
->toBe('foo')
|
||||
->and('hello world')->toBeString();
|
||||
|
||||
it('can use the returned instance from a tap')
|
||||
->expect('foo')->toBeString()->toBe('foo')
|
||||
->tap(function () { return expect($this); })
|
||||
->toBeInstanceOf(TestCase::class);
|
||||
|
||||
afterEach()->assertTrue(true);
|
||||
|
||||
Reference in New Issue
Block a user