InMemoryUsersRepositoryStub.php 1.58 KB
Newer Older
Jacob Priddy's avatar
Jacob Priddy committed
1
2
3
<?php


Jacob Priddy's avatar
Jacob Priddy committed
4
namespace Tests\Doubles;
Jacob Priddy's avatar
Jacob Priddy committed
5
6
7
8
9
10


use Source\Entities\User;
use Source\Gateways\Users\UsersRepository;

class InMemoryUsersRepositoryStub implements UsersRepository {
Jacob Priddy's avatar
Jacob Priddy committed
11
    protected ?User $user;
Jacob Priddy's avatar
Jacob Priddy committed
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
66

    public function setUserToReturnOnGet(User $user): void {
        $this->user = $user;
    }

    /**
     * @param string $userId
     * @return User|null
     */
    public function get(string $userId): ?User {
        if ($this->user) {
            return $this->user;
        }
        return null;
    }

    /**
     * @return array
     */
    public function all(): array {
        return [];
    }

    /**
     * @param User $user
     * @return User|null
     */
    public function create(User $user): ?User {
        return null;
    }

    /**
     * @param string $userId
     * @param User   $user
     * @return User|null
     */
    public function update(string $userId, User $user): ?User {
        return null;
    }

    /**
     * @param string $userId
     * @return bool
     */
    public function delete(string $userId): bool {
        return false;
    }

    /**
     * @param string $userId
     * @return bool
     */
    public function exists(string $userId): bool {
        return true;
    }
Jacob Priddy's avatar
Jacob Priddy committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80

    /**
     * @inheritDoc
     */
    public function findByCredentials(string $email, string $password): ?User {
        return null;
    }

    /**
     * @inheritDoc
     */
    public function findByDoorcode(string $doorcode): ?User {
        return null;
    }
81
82
83
84
85
86
87

    /**
     * @inheritDoc
     */
    public function findByEmail(string $email): ?User {
        return null;
    }
Jacob Priddy's avatar
Jacob Priddy committed
88
}