Skip to content

Instantly share code, notes, and snippets.

@Tynael
Created October 26, 2023 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tynael/a82347ea4eaa050f88bbf587cab7ff33 to your computer and use it in GitHub Desktop.
Save Tynael/a82347ea4eaa050f88bbf587cab7ff33 to your computer and use it in GitHub Desktop.
Laravel — Improve Email Validation
<?php
declare(strict_types=1);
namespace Tests\Feature;
use Tests\TestCase;
use Faker\Factory as Faker;
class UserControllerTest extends TestCase
{
public function test_can_create_user(): void
{
$faker = Faker::create();
$response = $this->postJson(
route('user.create'),
[
'name' => $faker->name,
'password' => $faker->password(),
'email' => $faker->unique()->freeEmail(), // Don't use $faker->email()
]);
$response->assertSuccessful();
}
}
@Tynael
Copy link
Author

Tynael commented Oct 26, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment