Asset nothing is sent if send_welcome is not checked/passed

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2025-08-28 18:05:40 +01:00
parent 315a812df5
commit d1129081df
2 changed files with 11 additions and 3 deletions

View File

@@ -62,6 +62,8 @@ class CreateUserTest extends TestCase
public function testCanCreateUser()
{
Notification::fake();
$this->actingAsForApi(User::factory()->createUsers()->create())
->postJson(route('api.users.store'), [
'first_name' => 'Test First Name',
@@ -69,8 +71,8 @@ class CreateUserTest extends TestCase
'username' => 'testuser',
'password' => 'testpassword1235!!',
'password_confirmation' => 'testpassword1235!!',
'send_welcome' => '1',
'activated' => '1',
'email' => 'foo@example.org',
'notes' => 'Test Note',
])
->assertStatusMessageIs('success')
@@ -81,9 +83,12 @@ class CreateUserTest extends TestCase
'last_name' => 'Test Last Name',
'username' => 'testuser',
'activated' => '1',
'email' => 'foo@example.org',
'notes' => 'Test Note',
]);
Notification::assertNothingSent();
}
public function testCanCreateAndNotifyUser()

View File

@@ -27,6 +27,8 @@ class CreateUserTest extends TestCase
public function testCanCreateUser()
{
Notification::fake();
$response = $this->actingAs(User::factory()->createUsers()->viewUsers()->create())
->from(route('users.index'))
->post(route('users.store'), [
@@ -35,8 +37,8 @@ class CreateUserTest extends TestCase
'username' => 'testuser',
'password' => 'testpassword1235!!',
'password_confirmation' => 'testpassword1235!!',
'send_welcome' => '1',
'activated' => '1',
'email' => 'foo@example.org',
'notes' => 'Test Note',
])
->assertSessionHasNoErrors()
@@ -48,10 +50,11 @@ class CreateUserTest extends TestCase
'last_name' => 'Test Last Name',
'username' => 'testuser',
'activated' => '1',
'email' => 'foo@example.org',
'notes' => 'Test Note',
]);
Notification::assertNothingSent();
$this->followRedirects($response)->assertSee('Success');
}