1818class BulkCheckoutEmailTest extends TestCase
1919{
2020 private Collection $ assets ;
21- private Model $ target ;
21+ private Model $ assignee ;
2222
2323 protected function setUp (): void
2424 {
@@ -30,7 +30,7 @@ protected function setUp(): void
3030 $ this ->settings ->disableAdminCCAlways ();
3131
3232 $ this ->assets = Asset::factory ()->requiresAcceptance ()->count (2 )->create ();
33- $ this ->
target = User::
factory ()->
create ([
'email ' =>
'[email protected] ' ]);
33+ $ this ->
assignee = User::
factory ()->
create ([
'email ' =>
'[email protected] ' ]);
3434 }
3535
3636 public function test_email_is_sent_to_user ()
@@ -42,7 +42,7 @@ public function test_email_is_sent_to_user()
4242 Mail::assertSent (BulkAssetCheckoutMail::class, 1 );
4343
4444 Mail::assertSent (BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $ mail ) {
45- return $ mail ->hasTo ($ this ->target ->email )
45+ return $ mail ->hasTo ($ this ->assignee ->email )
4646 && $ mail ->assertSeeInText ('Assets have been checked out to you ' );
4747 });
4848 }
@@ -51,7 +51,7 @@ public function test_email_is_sent_to_location_manager()
5151 {
5252 $ manager = User::factory ()->create ();
5353
54- $ this ->target = Location::factory ()->for ($ manager , 'manager ' )->create ();
54+ $ this ->assignee = Location::factory ()->for ($ manager , 'manager ' )->create ();
5555
5656 $ this ->sendRequest ();
5757
@@ -61,15 +61,15 @@ public function test_email_is_sent_to_location_manager()
6161
6262 Mail::assertSent (BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $ mail ) use ($ manager ) {
6363 return $ mail ->hasTo ($ manager ->email )
64- && $ mail ->assertSeeInText ('Assets have been checked out to ' . $ this ->target ->name );
64+ && $ mail ->assertSeeInText ('Assets have been checked out to ' . $ this ->assignee ->name );
6565 });
6666 }
6767
6868 public function test_email_is_sent_to_user_asset_is_checked_out_to ()
6969 {
7070 $ user = User::factory ()->create ();
7171
72- $ this ->target = Asset::factory ()->assignedToUser ($ user )->create ();
72+ $ this ->assignee = Asset::factory ()->assignedToUser ($ user )->create ();
7373
7474 $ this ->sendRequest ();
7575
@@ -84,7 +84,7 @@ public function test_email_is_sent_to_user_asset_is_checked_out_to()
8484
8585 public function test_email_is_not_sent_to_user_when_user_does_not_have_email_address ()
8686 {
87- $ this ->target = User::factory ()->create (['email ' => null ]);
87+ $ this ->assignee = User::factory ()->create (['email ' => null ]);
8888
8989 $ this ->sendRequest ();
9090
@@ -129,7 +129,7 @@ public function test_email_is_sent_when_assets_do_not_require_acceptance_but_hav
129129 Mail::assertSent (BulkAssetCheckoutMail::class, 1 );
130130
131131 Mail::assertSent (BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $ mail ) {
132- return $ mail ->hasTo ($ this ->target ->email )
132+ return $ mail ->hasTo ($ this ->assignee ->email )
133133 && $ mail ->assertSeeInText ('Assets have been checked out to you ' )
134134 && $ mail ->assertDontSeeInText ('Click here to review the terms of use and accept ' );
135135 });
@@ -154,7 +154,7 @@ public function test_email_is_sent_when_assets_do_not_require_acceptance_or_have
154154 Mail::assertSent (BulkAssetCheckoutMail::class, 1 );
155155
156156 Mail::assertSent (BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $ mail ) {
157- return $ mail ->hasTo ($ this ->target ->email )
157+ return $ mail ->hasTo ($ this ->assignee ->email )
158158 && $ mail ->assertSeeInText ('Assets have been checked out to you ' )
159159 && $ mail ->assertDontSeeInText ('review the terms ' );
160160 });
@@ -171,7 +171,7 @@ public function test_email_is_sent_to_cc_address()
171171 Mail::assertSent (BulkAssetCheckoutMail::class, 2 );
172172
173173 Mail::assertSent (BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $ mail ) {
174- return $ mail ->hasTo ($ this ->target ->email );
174+ return $ mail ->hasTo ($ this ->assignee ->email );
175175 });
176176
177177 Mail::assertSent (BulkAssetCheckoutMail::class, function (BulkAssetCheckoutMail $ mail ) {
@@ -226,18 +226,18 @@ public function test_email_is_not_sent_to_cc_address_if_assets_do_not_require_ac
226226
227227 private function sendRequest ()
228228 {
229- $ assigned = match (get_class ($ this ->target )) {
229+ $ assigned = match (get_class ($ this ->assignee )) {
230230 User::class => [
231231 'checkout_to_type ' => 'user ' ,
232- 'assigned_user ' => $ this ->target ->id ,
232+ 'assigned_user ' => $ this ->assignee ->id ,
233233 ],
234234 Location::class => [
235235 'checkout_to_type ' => 'location ' ,
236- 'assigned_location ' => $ this ->target ->id ,
236+ 'assigned_location ' => $ this ->assignee ->id ,
237237 ],
238238 Asset::class => [
239239 'checkout_to_type ' => 'asset ' ,
240- 'assigned_asset ' => $ this ->target ->id ,
240+ 'assigned_asset ' => $ this ->assignee ->id ,
241241 ],
242242 default => [],
243243 };
0 commit comments