• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jorge07 / symfony-5-es-cqrs-boilerplate / #166

06 Feb 2026 10:12AM UTC coverage: 88.404% (+1.2%) from 87.168%
#166

push

web-flow
Merge c345ce76d into 847c843ce

36 of 45 new or added lines in 21 files covered. (80.0%)

9 existing lines in 4 files now uncovered.

587 of 664 relevant lines covered (88.4%)

8.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.46
/src/App/User/Infrastructure/ReadModel/UserView.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\User\Infrastructure\ReadModel;
6

7
use App\Shared\Domain\Exception\DateTimeException;
8
use App\Shared\Domain\ValueObject\DateTime;
9
use App\User\Domain\ValueObject\Auth\Credentials;
10
use App\User\Domain\ValueObject\Auth\HashedPassword;
11
use App\User\Domain\ValueObject\Email;
12
use Assert\AssertionFailedException;
13
use Broadway\ReadModel\SerializableReadModel;
14
use Broadway\Serializer\Serializable;
15
use Ramsey\Uuid\Uuid;
16
use Ramsey\Uuid\UuidInterface;
17

18
/**
19
 * @psalm-suppress MissingConstructor
20
 */
21
class UserView implements SerializableReadModel
22
{
23
    final public const string TYPE = 'UserView';
24

25
    private readonly UuidInterface $uuid;
26

27
    private Credentials $credentials;
28

29
    public DateTime $createdAt;
30

31
    public ?DateTime $updatedAt;
32

33
    private function __construct(UuidInterface $uuid, Credentials $credentials, DateTime $createdAt, ?DateTime $updatedAt)
34
    {
35
        $this->uuid = $uuid;
26✔
36
        $this->credentials = $credentials;
26✔
37
        $this->createdAt = $createdAt;
26✔
38
        $this->updatedAt = $updatedAt;
26✔
39
    }
40

41
    /**
42
     * @throws DateTimeException
43
     * @throws AssertionFailedException
44
     */
45
    public static function fromSerializable(Serializable $event): self
46
    {
47
        return self::deserialize($event->serialize());
24✔
48
    }
49

50
    /**
51
     * @throws DateTimeException
52
     * @throws AssertionFailedException
53
     */
54
    public static function deserialize(array $data): self
55
    {
56
        return new self(
26✔
57
            Uuid::fromString($data['uuid']),
26✔
58
            new Credentials(
26✔
59
                Email::fromString($data['credentials']['email']),
26✔
60
                HashedPassword::fromHash($data['credentials']['password'] ?? '')
26✔
61
            ),
26✔
62
            DateTime::fromString($data['created_at']),
26✔
63
            isset($data['updated_at']) ? DateTime::fromString($data['updated_at']) : null
26✔
64
        );
26✔
65
    }
66

67
    public function serialize(): array
68
    {
69
        return [
2✔
70
            'uuid' => $this->getId(),
2✔
71
            'credentials' => [
2✔
72
                'email' => (string) $this->credentials->email,
2✔
73
            ],
2✔
74
        ];
2✔
75
    }
76

77
    public function uuid(): UuidInterface
78
    {
UNCOV
79
        return $this->uuid;
×
80
    }
81

82
    public function email(): string
83
    {
UNCOV
84
        return (string) $this->credentials->email;
×
85
    }
86

87
    public function hashedPassword(): HashedPassword
88
    {
NEW
89
        return $this->credentials->password;
×
90
    }
91

92
    public function changeEmail(Email $email): void
93
    {
94
        $this->credentials = new Credentials($email, $this->credentials->password);
2✔
95
    }
96

97
    public function changeUpdatedAt(DateTime $updatedAt): void
98
    {
99
        $this->updatedAt = $updatedAt;
2✔
100
    }
101

102
    public function getId(): string
103
    {
104
        return $this->uuid->toString();
2✔
105
    }
106
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc