diff --git a/framework/core/tests/integration/api/users/CreateTest.php b/framework/core/tests/integration/api/users/CreateTest.php index 48d1340ad5..98f988ce01 100644 --- a/framework/core/tests/integration/api/users/CreateTest.php +++ b/framework/core/tests/integration/api/users/CreateTest.php @@ -173,6 +173,35 @@ public function admin_can_create_user_with_longest_possible_local_part_email() $this->assertEquals($email, $user->email); } + /** + * @test + */ + public function admin_cannot_create_user_with_invalid_local_part_email() + { + $email = str_repeat('a', 65) . '@machine.local'; + + $response = $this->send( + $this->request( + 'POST', + '/api/users', + [ + 'authenticatedAs' => 1, + 'json' => [ + 'data' => [ + 'attributes' => [ + 'username' => 'test', + 'password' => 'too-obscure', + 'email' => $email, + ], + ] + ], + ] + ) + ); + + $this->assertEquals(422, $response->getStatusCode()); + } + /** * @test */