Skip to content

Commit c828b0a

Browse files
test: write test for email with too long local part
1 parent e9d6b05 commit c828b0a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

framework/core/tests/integration/api/users/CreateTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,35 @@ public function admin_can_create_user_with_longest_possible_local_part_email()
173173
$this->assertEquals($email, $user->email);
174174
}
175175

176+
/**
177+
* @test
178+
*/
179+
public function admin_cannot_create_user_with_invalid_local_part_email()
180+
{
181+
$email = str_repeat('a', 65) . '@machine.local';
182+
183+
$response = $this->send(
184+
$this->request(
185+
'POST',
186+
'/api/users',
187+
[
188+
'authenticatedAs' => 1,
189+
'json' => [
190+
'data' => [
191+
'attributes' => [
192+
'username' => 'test',
193+
'password' => 'too-obscure',
194+
'email' => $email,
195+
],
196+
]
197+
],
198+
]
199+
)
200+
);
201+
202+
$this->assertEquals(422, $response->getStatusCode());
203+
}
204+
176205
/**
177206
* @test
178207
*/

0 commit comments

Comments
 (0)