Adds tap for Higher Order tests

This commit is contained in:
luke
2021-06-24 22:57:26 +01:00
parent 4f67eff619
commit acef002a2d
5 changed files with 78 additions and 5 deletions

View File

@ -1,5 +1,7 @@
<?php
use PHPUnit\Framework\TestCase;
beforeEach()->assertTrue(true);
it('proxies calls to object')->assertTrue(true);
@ -8,7 +10,14 @@ it('is capable doing multiple assertions')
->assertTrue(true)
->assertFalse(false);
//it('can tap into the test')
it('can tap into the test')
->expect('foo')->toBeString()->toBe('foo')
->tap(function () { expect($this)->toBeInstanceOf(TestCase::class); })
->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);