Skip to content

A free open source IT asset/license management system

Asset nothing is sent if `send_welcome` is not checked/passed

sniped1129081df29
diff --git a/tests/Feature/Users/Api/CreateUserTest.php b/tests/Feature/Users/Api/CreateUserTest.php
index 080224d3e7..bbed8479d5 100644
--- a/tests/Feature/Users/Api/CreateUserTest.php
+++ b/tests/Feature/Users/Api/CreateUserTest.php
@@ -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' => '[email protected]',
'notes' => 'Test Note',
])
->assertStatusMessageIs('success')
@@ -81,9 +83,12 @@ class CreateUserTest extends TestCase
'last_name' => 'Test Last Name',
'username' => 'testuser',
'activated' => '1',
+ 'email' => '[email protected]',
'notes' => 'Test Note',
]);
+
+ Notification::assertNothingSent();
}
public function testCanCreateAndNotifyUser()
diff --git a/tests/Feature/Users/Ui/CreateUserTest.php b/tests/Feature/Users/Ui/CreateUserTest.php
index e5ee870aae..f2f5c2ed67 100644
--- a/tests/Feature/Users/Ui/CreateUserTest.php
+++ b/tests/Feature/Users/Ui/CreateUserTest.php
@@ -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' => '[email protected]',
'notes' => 'Test Note',
])
->assertSessionHasNoErrors()
@@ -48,10 +50,11 @@ class CreateUserTest extends TestCase
'last_name' => 'Test Last Name',
'username' => 'testuser',
'activated' => '1',
+ 'email' => '[email protected]',
'notes' => 'Test Note',
]);
-
+ Notification::assertNothingSent();
$this->followRedirects($response)->assertSee('Success');
}