Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | namespace Apie\IntegrationTests\Interfaces; |
3 | |
4 | use Apie\Common\ValueObjects\DecryptedAuthenticatedUser; |
5 | use Apie\Core\Entities\EntityInterface; |
6 | use Apie\IntegrationTests\Config\ApplicationConfig; |
7 | use Apie\IntegrationTests\Requests\TestRequestInterface; |
8 | use Psr\Container\ContainerInterface; |
9 | use Psr\Http\Message\ResponseInterface; |
10 | use Symfony\Component\Console\Application; |
11 | |
12 | interface TestApplicationInterface |
13 | { |
14 | /** |
15 | * Boot application. Should be called at the start of the test. |
16 | */ |
17 | public function bootApplication(): void; |
18 | |
19 | /** |
20 | * Starts bootApplication, runs test and does cleanApplication. |
21 | */ |
22 | public function ItRunsApplications(callable $test): void; |
23 | |
24 | /** |
25 | * Get console command application for testing console commands. |
26 | */ |
27 | public function getConsoleApplication(): Application; |
28 | |
29 | /** |
30 | * Gets service container of application. Should be used as little as possible. |
31 | */ |
32 | public function getServiceContainer(): ContainerInterface; |
33 | |
34 | /** |
35 | * Cleans up application. Should be called at the end of the test. |
36 | */ |
37 | public function cleanApplication(): void; |
38 | |
39 | /** |
40 | * Gets used Application config |
41 | */ |
42 | public function getApplicationConfig(): ApplicationConfig; |
43 | |
44 | /** |
45 | * Login as a specific user. |
46 | * |
47 | * @param DecryptedAuthenticatedUser<EntityInterface> $user |
48 | */ |
49 | public function loginAs(DecryptedAuthenticatedUser $user): void; |
50 | |
51 | /** |
52 | * Forget that you are logged in. |
53 | */ |
54 | public function logout(): void; |
55 | |
56 | /** |
57 | * Get logged in as user. |
58 | * @return DecryptedAuthenticatedUser<EntityInterface>|null |
59 | */ |
60 | public function getLoggedInAs(): ?DecryptedAuthenticatedUser; |
61 | |
62 | /** |
63 | * Does a GET HTTP request on the application and returns the response. |
64 | */ |
65 | public function httpRequestGet(string $uri): ResponseInterface; |
66 | |
67 | /** |
68 | * Does a HTTP request on the application and returns the response. |
69 | */ |
70 | public function httpRequest(TestRequestInterface $testRequest): ResponseInterface; |
71 | } |