Skip to content

Commit d112908

Browse files
committed
Asset nothing is sent if send_welcome is not checked/passed
Signed-off-by: snipe <[email protected]>
1 parent 315a812 commit d112908

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

tests/Feature/Users/Api/CreateUserTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ public function testDepartmentIdNeedsToBeInteger()
6262

6363
public function testCanCreateUser()
6464
{
65+
Notification::fake();
66+
6567
$this->actingAsForApi(User::factory()->createUsers()->create())
6668
->postJson(route('api.users.store'), [
6769
'first_name' => 'Test First Name',
6870
'last_name' => 'Test Last Name',
6971
'username' => 'testuser',
7072
'password' => 'testpassword1235!!',
7173
'password_confirmation' => 'testpassword1235!!',
72-
'send_welcome' => '1',
7374
'activated' => '1',
75+
'email' => '[email protected]',
7476
'notes' => 'Test Note',
7577
])
7678
->assertStatusMessageIs('success')
@@ -81,9 +83,12 @@ public function testCanCreateUser()
8183
'last_name' => 'Test Last Name',
8284
'username' => 'testuser',
8385
'activated' => '1',
86+
'email' => '[email protected]',
8487
'notes' => 'Test Note',
8588

8689
]);
90+
91+
Notification::assertNothingSent();
8792
}
8893

8994
public function testCanCreateAndNotifyUser()

tests/Feature/Users/Ui/CreateUserTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public function testPageRenders()
2727

2828
public function testCanCreateUser()
2929
{
30+
Notification::fake();
31+
3032
$response = $this->actingAs(User::factory()->createUsers()->viewUsers()->create())
3133
->from(route('users.index'))
3234
->post(route('users.store'), [
@@ -35,8 +37,8 @@ public function testCanCreateUser()
3537
'username' => 'testuser',
3638
'password' => 'testpassword1235!!',
3739
'password_confirmation' => 'testpassword1235!!',
38-
'send_welcome' => '1',
3940
'activated' => '1',
41+
'email' => '[email protected]',
4042
'notes' => 'Test Note',
4143
])
4244
->assertSessionHasNoErrors()
@@ -48,10 +50,11 @@ public function testCanCreateUser()
4850
'last_name' => 'Test Last Name',
4951
'username' => 'testuser',
5052
'activated' => '1',
53+
'email' => '[email protected]',
5154
'notes' => 'Test Note',
5255

5356
]);
54-
57+
Notification::assertNothingSent();
5558
$this->followRedirects($response)->assertSee('Success');
5659

5760
}

0 commit comments

Comments
 (0)