Skip to content

A free open source IT asset/license management system

Move Notification::fake() to setUp method

Marcus Moore2ea883aa1575
diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php
index 2cf697e93f..feb4cd26d9 100644
--- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php
+++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php
@@ -22,6 +22,13 @@ class SlackNotificationsUponCheckinTest extends TestCase
{
use InteractsWithSettings;
+ protected function setUp(): void
+ {
+ parent::setUp();
+
+ Notification::fake();
+ }
+
public function assetCheckoutTargets(): array
{
return [
@@ -41,8 +48,6 @@ class SlackNotificationsUponCheckinTest extends TestCase
public function testAccessoryCheckinSendsSlackNotificationWhenSettingEnabled()
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedIn(
@@ -63,8 +68,6 @@ class SlackNotificationsUponCheckinTest extends TestCase
public function testAccessoryCheckinDoesNotSendSlackNotificationWhenSettingDisabled()
{
- Notification::fake();
-
$this->settings->disableSlackWebhook();
event(new CheckoutableCheckedIn(
@@ -80,8 +83,6 @@ class SlackNotificationsUponCheckinTest extends TestCase
/** @dataProvider assetCheckoutTargets */
public function testAssetCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedIn(
@@ -103,8 +104,6 @@ class SlackNotificationsUponCheckinTest extends TestCase
/** @dataProvider assetCheckoutTargets */
public function testAssetCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
{
- Notification::fake();
-
$this->settings->disableSlackWebhook();
event(new CheckoutableCheckedIn(
@@ -119,8 +118,6 @@ class SlackNotificationsUponCheckinTest extends TestCase
public function testComponentCheckinDoesNotSendSlackNotification()
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedIn(
@@ -146,8 +143,6 @@ class SlackNotificationsUponCheckinTest extends TestCase
/** @dataProvider licenseCheckoutTargets */
public function testLicenseCheckinSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedIn(
@@ -169,8 +164,6 @@ class SlackNotificationsUponCheckinTest extends TestCase
/** @dataProvider licenseCheckoutTargets */
public function testLicenseCheckinDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
{
- Notification::fake();
-
$this->settings->disableSlackWebhook();
event(new CheckoutableCheckedIn(
diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php
index aeee70c9b4..4f8b1da223 100644
--- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php
+++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php
@@ -24,6 +24,13 @@ class SlackNotificationsUponCheckoutTest extends TestCase
{
use InteractsWithSettings;
+ protected function setUp(): void
+ {
+ parent::setUp();
+
+ Notification::fake();
+ }
+
public function assetCheckoutTargets(): array
{
return [
@@ -43,8 +50,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
public function testAccessoryCheckoutSendsSlackNotificationWhenSettingEnabled()
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedOut(
@@ -65,8 +70,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
public function testAccessoryCheckoutDoesNotSendSlackNotificationWhenSettingDisabled()
{
- Notification::fake();
-
$this->settings->disableSlackWebhook();
event(new CheckoutableCheckedOut(
@@ -82,8 +85,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
/** @dataProvider assetCheckoutTargets */
public function testAssetCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedOut(
@@ -105,8 +106,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
/** @dataProvider assetCheckoutTargets */
public function testAssetCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
{
- Notification::fake();
-
$this->settings->disableSlackWebhook();
event(new CheckoutableCheckedOut(
@@ -121,8 +120,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
public function testComponentCheckoutDoesNotSendSlackNotification()
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedOut(
@@ -137,8 +134,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
public function testConsumableCheckoutSendsSlackNotificationWhenSettingEnabled()
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedOut(
@@ -159,8 +154,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
public function testConsumableCheckoutDoesNotSendSlackNotificationWhenSettingDisabled()
{
- Notification::fake();
-
$this->settings->disableSlackWebhook();
event(new CheckoutableCheckedOut(
@@ -176,8 +169,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
/** @dataProvider licenseCheckoutTargets */
public function testLicenseCheckoutSendsSlackNotificationWhenSettingEnabled($checkoutTarget)
{
- Notification::fake();
-
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedOut(
@@ -199,8 +190,6 @@ class SlackNotificationsUponCheckoutTest extends TestCase
/** @dataProvider licenseCheckoutTargets */
public function testLicenseCheckoutDoesNotSendSlackNotificationWhenSettingDisabled($checkoutTarget)
{
- Notification::fake();
-
$this->settings->disableSlackWebhook();
event(new CheckoutableCheckedOut(