|
18 | 18 | use Guanguans\Notify\Pushover\Authenticator; |
19 | 19 | use Guanguans\Notify\Pushover\Client; |
20 | 20 | use Guanguans\Notify\Pushover\Messages\Message; |
21 | | -use Psr\Http\Message\ResponseInterface; |
22 | 21 |
|
23 | 22 | it('can send message', function (): void { |
24 | 23 | $authenticator = new Authenticator( |
|
28 | 27 | $client = new Client($authenticator); |
29 | 28 | $message = Message::make([ |
30 | 29 | 'message' => 'This is message.', |
31 | | - // 'title' => 'This is title.', |
32 | | - // 'timestamp' => time(), |
33 | | - // 'priority' => 2, |
34 | | - // 'url' => 'https://www.guanguans.cn', |
35 | | - // 'url_title' => 'This is URL title.', |
36 | | - // 'sound' => 'none', |
37 | | - // 'retry' => 60, |
38 | | - // 'expire' => 3600, |
39 | | - // 'html' => 1, |
40 | | - // 'monospace' => 0, |
41 | | - // 'callback' => 'https://www.guanguans.cn/', |
42 | | - // 'device' => 'This is device.', |
43 | | - // 'attachment' => '/Users/yaozm/Downloads/images.jpeg', |
| 30 | + 'attachment' => 'tests/fixtures/image.png', |
| 31 | + 'device' => 'This is device.', |
| 32 | + 'html' => 1, |
| 33 | + 'priority' => 2, |
| 34 | + 'sound' => 'none', |
| 35 | + 'timestamp' => time(), |
| 36 | + 'title' => 'This is title.', |
| 37 | + 'ttl' => 3600, |
| 38 | + 'url' => 'https://www.guanguans.cn', |
| 39 | + 'url_title' => 'This is url title.', |
| 40 | + 'retry' => 60, |
| 41 | + 'expire' => 3600, |
| 42 | + 'monospace' => 0, |
| 43 | + 'callback' => 'https://www.guanguans.cn/', |
44 | 44 | ]); |
45 | 45 |
|
46 | 46 | expect($client) |
47 | 47 | ->mock([ |
48 | 48 | create_response('{"status":1,"request":"a84b20eb-b69e-4687-83d1-bab8ee2d0e40"}'), |
49 | 49 | create_response('{"token":"invalid","errors":["application token is invalid, see https://pushover.net/api"],"status":0,"request":"5c4487c0-a61a-497e-9205-3441a99471b0"}', 400), |
50 | 50 | ]) |
51 | | - ->send($message)->toBeInstanceOf(ResponseInterface::class) |
52 | | - ->send($message)->toBeInstanceOf(ResponseInterface::class); |
| 51 | + ->assertCanSendMessage($message); |
53 | 52 | })->group(__DIR__, __FILE__); |
0 commit comments