UseCaseBaseTest.php 1.67 KB
Newer Older
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php


namespace Tests\Unit\Source\UseCases\Users\Authenticate;

use PHPUnit\Framework\TestCase;
use Source\Gateways\Saml\InMemorySamlRepository;
use Source\UseCases\Users\Authenticate\Authenticate;
use Source\Gateways\Users\InMemoryUsersRepository;
use Source\Gateways\Tokens\InMemoryTokensRepository;
use Source\UseCases\Users\Authenticate\ResponseModel;

abstract class UseCaseBaseTest extends TestCase
{
    /**
     * @var \Source\Gateways\Users\InMemoryUsersRepository
     */
    protected InMemoryUsersRepository $users;

    /**
     * @var \Source\Gateways\Tokens\InMemoryTokensRepository
     */
    protected InMemoryTokensRepository $tokens;

    /**
     * @var \Source\Gateways\Saml\InMemorySamlRepository
     */
    protected InMemorySamlRepository $saml;

    /**
     * @var \Source\UseCases\Users\Authenticate\Authenticate
     */
    protected Authenticate $useCase;

    /**
     * @var \Source\UseCases\Users\Authenticate\ResponseModel
     */
    protected ResponseModel $response;

    /**
     * @var \Tests\Unit\Source\UseCases\Users\Authenticate\PresenterStub
     */
    protected PresenterStub $presenter;

    /**
     * @var string
     */
    protected string $loginUrl = 'login url';

    /**
     * @var string
     */
    protected string $logoutUrl = 'logout url';

    public function setUp(): void
    {
        parent::setUp();

        $this->users = new InMemoryUsersRepository();
        $this->tokens = new InMemoryTokensRepository();
        $this->saml = new InMemorySamlRepository($this->loginUrl, $this->logoutUrl);
        $this->useCase = new Authenticate($this->users, $this->saml, $this->tokens);
        $this->presenter = new PresenterStub();
    }
}