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

api-platform / core / 14966772795

12 May 2025 07:51AM UTC coverage: 8.418% (+0.02%) from 8.396%
14966772795

push

github

soyuka
!fix(openapi): allowReserved, allowEmtpyValue defaults to null

45 of 75 new or added lines in 3 files covered. (60.0%)

591 existing lines in 8 files now uncovered.

13484 of 160174 relevant lines covered (8.42%)

22.88 hits per line

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

0.0
/tests/Fixtures/TestBundle/Entity/User.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity;
15

16
use ApiPlatform\Metadata\ApiResource;
17
use ApiPlatform\Metadata\Delete;
18
use ApiPlatform\Metadata\Get;
19
use ApiPlatform\Metadata\GetCollection;
20
use ApiPlatform\Metadata\Post;
21
use ApiPlatform\Metadata\Put;
22
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\PasswordResetRequest;
23
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\PasswordResetRequestResult;
24
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\RecoverPasswordInput;
25
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\RecoverPasswordOutput;
26
use ApiPlatform\Tests\Fixtures\TestBundle\State\RecoverPasswordProcessor;
27
use Doctrine\ORM\Mapping as ORM;
28
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
29
use Symfony\Component\Security\Core\User\UserInterface;
30
use Symfony\Component\Serializer\Annotation\Groups;
31

32
/**
33
 * A User.
34
 *
35
 * @author Théo FIDRY <theo.fidry@gmail.com>
36
 * @author Kévin Dunglas <dunglas@gmail.com>
37
 */
38
#[ApiResource(operations: [
39
    new Post(
×
40
        uriTemplate: '/users/password_reset_request',
×
41
        messenger: 'input',
×
42
        input: PasswordResetRequest::class,
×
43
        output: PasswordResetRequestResult::class,
×
44
        normalizationContext: ['groups' => ['user_password_reset_request']],
×
45
        denormalizationContext: ['groups' => ['user_password_reset_request']]
×
46
    ),
×
NEW
47
    new Put(
×
NEW
48
        input: RecoverPasswordInput::class,
×
NEW
49
        output: RecoverPasswordOutput::class,
×
NEW
50
        uriTemplate: 'users/recover/{id}',
×
NEW
51
        processor: RecoverPasswordProcessor::class,
×
NEW
52
        openapi: false, // ambigous path
×
NEW
53
    ),
×
54
    new Get(),
×
55
    new Put(),
×
56
    new Delete(),
×
57
    new Post(),
×
58
    new GetCollection(),
×
59
    new Get('users-with-groups/{id}', normalizationContext: ['groups' => ['api-test-case-group']]),
×
60
    new GetCollection('users-with-groups', normalizationContext: ['groups' => ['api-test-case-group']]),
×
61
], normalizationContext: ['groups' => ['user', 'user-read']], denormalizationContext: ['groups' => ['user', 'user-write']])]
×
62
#[ORM\Entity]
63
#[ORM\Table(name: 'user_test')]
64
class User implements UserInterface, PasswordAuthenticatedUserInterface
65
{
66
    #[ORM\Id]
67
    #[ORM\Column(type: 'integer')]
68
    #[ORM\GeneratedValue(strategy: 'AUTO')]
69
    private ?int $id = null;
70
    #[Groups(['user'])]
71
    private ?string $email = null;
72
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
73
    #[Groups(['user', 'api-test-case-group'])]
74
    private ?string $fullname = null;
75
    #[Groups(['user-write'])]
76
    private ?string $plainPassword = null;
77

78
    public function getId(): ?int
79
    {
80
        return $this->id;
×
81
    }
82

83
    public function getEmail(): ?string
84
    {
85
        return $this->email;
×
86
    }
87

88
    public function setEmail(string $email): void
89
    {
90
        $this->email = $email;
×
91
    }
92

93
    public function getPlainPassword(): ?string
94
    {
95
        return $this->plainPassword;
×
96
    }
97

98
    public function setPlainPassword(string $plainPassword): void
99
    {
100
        $this->plainPassword = $plainPassword;
×
101
    }
102

103
    public function setFullname(?string $fullname): self
104
    {
105
        $this->fullname = $fullname;
×
106

107
        return $this;
×
108
    }
109

110
    public function getFullname(): ?string
111
    {
112
        return $this->fullname;
×
113
    }
114

115
    public function getUsername(): string
116
    {
117
        return (string) $this->email;
×
118
    }
119

120
    public function getUserIdentifier(): string
121
    {
122
        return (string) $this->email;
×
123
    }
124

125
    public function getRoles(): array
126
    {
127
        return ['ROLE_USER'];
×
128
    }
129

130
    public function getPassword(): ?string
131
    {
132
        return null;
×
133
    }
134

135
    public function getSalt(): ?string
136
    {
137
        return null;
×
138
    }
139

140
    public function eraseCredentials(): void
141
    {
142
    }
×
143
}
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

© 2025 Coveralls, Inc