File tree 3 files changed +23
-3
lines changed
3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ composer require seregazhuk/react-promise-testing --dev
38
38
```
39
39
40
40
## Quick Start
41
- Use the trait ` seregazhuk\React\PromiseTesting\AssertPromise ` or extend your
41
+ Use the trait ` seregazhuk\React\PromiseTesting\AssertsPromise ` or extend your
42
42
test classes from ` seregazhuk\React\PromiseTesting\TestCase ` class,
43
43
which itself extends PHPUnit ` TestCase ` .
44
44
@@ -53,7 +53,27 @@ final class MyTest extends TestCase
53
53
$this->assertPromiseFulfillsWithInstanceOf($promise, ResponseInterface::class);
54
54
}
55
55
}
56
+ ```
57
+
58
+ Using the trait:
59
+
60
+ ``` php
61
+
62
+ use PHPUnit\Framework\TestCase;
63
+ use seregazhuk\React\PromiseTesting\AssertsPromise;
64
+
65
+ final class MyTest extends TestCase
66
+ {
67
+ use AssertsPromise;
56
68
69
+ /** @test */
70
+ public function promise_fulfills_with_a_response_object()
71
+ {
72
+ $browser = new Clue\React\Buzz\Browser($this->eventLoop());
73
+ $promise = $browser->get('http://www.google.com/');
74
+ $this->assertPromiseFulfillsWithInstanceOf($promise, ResponseInterface::class);
75
+ }
76
+ }
57
77
```
58
78
59
79
Test above checks that a specified promise fulfills with an instance of ` ResponseInterface ` .
Original file line number Diff line number Diff line change 10
10
use React \Promise \PromiseInterface ;
11
11
use React \Promise \Timer \TimeoutException ;
12
12
13
- trait AssertPromise
13
+ trait AssertsPromise
14
14
{
15
15
protected $ defaultWaitTimeout = 2 ;
16
16
Original file line number Diff line number Diff line change 6
6
7
7
abstract class TestCase extends PHPUnitTestCase
8
8
{
9
- use AssertPromise ;
9
+ use AssertsPromise ;
10
10
11
11
protected function setUp (): void
12
12
{
You can’t perform that action at this time.
0 commit comments