-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathBase.php
More file actions
47 lines (37 loc) · 1.15 KB
/
Base.php
File metadata and controls
47 lines (37 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace Utopia\Tests\Adapter;
use PHPUnit\Framework\TestCase;
class Base extends TestCase
{
/**
* @return array<string, mixed>
*/
protected function getLastRequest(): array
{
\sleep(2);
$request = \json_decode(\file_get_contents('http://request-catcher:5000/__last_request__'), true);
$request['data'] = \json_decode($request['data'], true);
return $request;
}
/**
* @return array<string, mixed>
*/
protected function getLastEmail(): array
{
sleep(3);
$emails = \json_decode(\file_get_contents('http://maildev:1080/email'), true);
if ($emails && \is_array($emails)) {
return \end($emails);
}
return [];
}
/**
* @param array<string, mixed> $response
*/
protected function assertResponse(array $response): void
{
$this->assertSame(1, $response['deliveredTo'], \var_export($response, true));
$this->assertSame('', $response['results'][0]['error'], \var_export($response, true));
$this->assertSame('success', $response['results'][0]['status'], \var_export($response, true));
}
}