-
@endif
@@ -298,11 +297,16 @@
}).change();
// Only display the field element if the type is not text
+ // and don't display encryption option for checkbox or radio
$(".field_element").change(function(){
$(this).find("option:selected").each(function(){
if (($(this).attr("value")!="text") && ($(this).attr("value")!="textarea")){
$("#field_values_text").show();
+ if ($(this).attr("value") == "checkbox" || $(this).attr("value") == "radio") {
+ $("#encryption_section").hide();
+ }
} else{
+ $("#encryption_section").show();
$("#field_values_text").hide();
}
});
diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php
index a32503d7ea..550359eb0b 100755
--- a/resources/views/hardware/view.blade.php
+++ b/resources/views/hardware/view.blade.php
@@ -904,27 +904,18 @@
@endcan
@can('delete', $asset)
- @if ($asset->deleted_at=='')
-
diff --git a/tests/Feature/Api/Accessories/AccessoryCheckoutTest.php b/tests/Feature/Api/Accessories/AccessoryCheckoutTest.php
index d65a3ad613..854a96ada2 100644
--- a/tests/Feature/Api/Accessories/AccessoryCheckoutTest.php
+++ b/tests/Feature/Api/Accessories/AccessoryCheckoutTest.php
@@ -7,13 +7,10 @@ use App\Models\Actionlog;
use App\Models\User;
use App\Notifications\CheckoutAccessoryNotification;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AccessoryCheckoutTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCheckingOutAccessoryRequiresCorrectPermission()
{
$this->actingAsForApi(User::factory()->create())
diff --git a/tests/Feature/Api/Assets/AssetCheckinTest.php b/tests/Feature/Api/Assets/AssetCheckinTest.php
index 6f8daf5691..add90a067d 100644
--- a/tests/Feature/Api/Assets/AssetCheckinTest.php
+++ b/tests/Feature/Api/Assets/AssetCheckinTest.php
@@ -11,13 +11,10 @@ use App\Models\Statuslabel;
use App\Models\User;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Event;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AssetCheckinTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCheckingInAssetRequiresCorrectPermission()
{
$this->actingAsForApi(User::factory()->create())
diff --git a/tests/Feature/Api/Assets/AssetIndexTest.php b/tests/Feature/Api/Assets/AssetIndexTest.php
index 778483c1c9..3175db6953 100644
--- a/tests/Feature/Api/Assets/AssetIndexTest.php
+++ b/tests/Feature/Api/Assets/AssetIndexTest.php
@@ -6,13 +6,10 @@ use App\Models\Asset;
use App\Models\Company;
use App\Models\User;
use Illuminate\Testing\Fluent\AssertableJson;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AssetIndexTest extends TestCase
{
- use InteractsWithSettings;
-
public function testAssetIndexReturnsExpectedAssets()
{
Asset::factory()->count(3)->create();
diff --git a/tests/Feature/Api/Assets/AssetStoreTest.php b/tests/Feature/Api/Assets/AssetStoreTest.php
index 92a58a5006..e98da36cf9 100644
--- a/tests/Feature/Api/Assets/AssetStoreTest.php
+++ b/tests/Feature/Api/Assets/AssetStoreTest.php
@@ -9,15 +9,11 @@ use App\Models\Location;
use App\Models\Statuslabel;
use App\Models\Supplier;
use App\Models\User;
-use Carbon\Carbon;
use Illuminate\Testing\Fluent\AssertableJson;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AssetStoreTest extends TestCase
{
- use InteractsWithSettings;
-
public function testRequiresPermissionToCreateAsset()
{
$this->actingAsForApi(User::factory()->create())
@@ -69,8 +65,7 @@ class AssetStoreTest extends TestCase
$this->assertEquals('random_string', $asset->asset_tag);
$this->assertEquals($userAssigned->id, $asset->assigned_to);
$this->assertTrue($asset->company->is($company));
- // I don't see this on the GUI side either, but it's in the docs so I'm guessing that's a mistake? It wasn't in the controller.
- // $this->assertEquals('2023-09-03', $asset->last_audit_date);
+ $this->assertEquals('2023-09-03 00:00:00', $asset->last_audit_date->format('Y-m-d H:i:s'));
$this->assertTrue($asset->location->is($location));
$this->assertTrue($asset->model->is($model));
$this->assertEquals('A New Asset', $asset->name);
@@ -86,6 +81,52 @@ class AssetStoreTest extends TestCase
$this->assertEquals(10, $asset->warranty_months);
}
+ public function testSetsLastAuditDateToMidnightOfProvidedDate()
+ {
+ $response = $this->actingAsForApi(User::factory()->superuser()->create())
+ ->postJson(route('api.assets.store'), [
+ 'last_audit_date' => '2023-09-03 12:23:45',
+ 'asset_tag' => '1234',
+ 'model_id' => AssetModel::factory()->create()->id,
+ 'status_id' => Statuslabel::factory()->create()->id,
+ ])
+ ->assertOk()
+ ->assertStatusMessageIs('success');
+
+ $asset = Asset::find($response['payload']['id']);
+ $this->assertEquals('00:00:00', $asset->last_audit_date->format('H:i:s'));
+ }
+
+ public function testLastAuditDateCanBeNull()
+ {
+ $response = $this->actingAsForApi(User::factory()->superuser()->create())
+ ->postJson(route('api.assets.store'), [
+ // 'last_audit_date' => '2023-09-03 12:23:45',
+ 'asset_tag' => '1234',
+ 'model_id' => AssetModel::factory()->create()->id,
+ 'status_id' => Statuslabel::factory()->create()->id,
+ ])
+ ->assertOk()
+ ->assertStatusMessageIs('success');
+
+ $asset = Asset::find($response['payload']['id']);
+ $this->assertNull($asset->last_audit_date);
+ }
+
+ public function testNonDateUsedForLastAuditDateReturnsValidationError()
+ {
+ $response = $this->actingAsForApi(User::factory()->superuser()->create())
+ ->postJson(route('api.assets.store'), [
+ 'last_audit_date' => 'this-is-not-valid',
+ 'asset_tag' => '1234',
+ 'model_id' => AssetModel::factory()->create()->id,
+ 'status_id' => Statuslabel::factory()->create()->id,
+ ])
+ ->assertStatusMessageIs('error');
+
+ $this->assertNotNull($response->json('messages.last_audit_date'));
+ }
+
public function testArchivedDepreciateAndPhysicalCanBeNull()
{
$model = AssetModel::factory()->ipadModel()->create();
diff --git a/tests/Feature/Api/Assets/AssetsForSelectListTest.php b/tests/Feature/Api/Assets/AssetsForSelectListTest.php
index cccae38d38..3c5e1e4e7c 100644
--- a/tests/Feature/Api/Assets/AssetsForSelectListTest.php
+++ b/tests/Feature/Api/Assets/AssetsForSelectListTest.php
@@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Assets;
use App\Models\Asset;
use App\Models\Company;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AssetsForSelectListTest extends TestCase
{
- use InteractsWithSettings;
-
public function testAssetsCanBeSearchedForByAssetTag()
{
Asset::factory()->create(['asset_tag' => '0001']);
diff --git a/tests/Feature/Api/Assets/RequestableAssetsTest.php b/tests/Feature/Api/Assets/RequestableAssetsTest.php
index 8649b1b00b..d90e45f223 100644
--- a/tests/Feature/Api/Assets/RequestableAssetsTest.php
+++ b/tests/Feature/Api/Assets/RequestableAssetsTest.php
@@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Assets;
use App\Models\Asset;
use App\Models\Company;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class RequestableAssetsTest extends TestCase
{
- use InteractsWithSettings;
-
public function testViewingRequestableAssetsRequiresCorrectPermission()
{
$this->actingAsForApi(User::factory()->create())
diff --git a/tests/Feature/Api/Components/ComponentIndexTest.php b/tests/Feature/Api/Components/ComponentIndexTest.php
index ee83b7a46d..517724a499 100644
--- a/tests/Feature/Api/Components/ComponentIndexTest.php
+++ b/tests/Feature/Api/Components/ComponentIndexTest.php
@@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Components;
use App\Models\Company;
use App\Models\Component;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class ComponentIndexTest extends TestCase
{
- use InteractsWithSettings;
-
public function testComponentIndexAdheresToCompanyScoping()
{
[$companyA, $companyB] = Company::factory()->count(2)->create();
diff --git a/tests/Feature/Api/Consumables/ConsumableCheckoutTest.php b/tests/Feature/Api/Consumables/ConsumableCheckoutTest.php
index 103be96ac2..1528e65aa3 100644
--- a/tests/Feature/Api/Consumables/ConsumableCheckoutTest.php
+++ b/tests/Feature/Api/Consumables/ConsumableCheckoutTest.php
@@ -7,13 +7,10 @@ use App\Models\Consumable;
use App\Models\User;
use App\Notifications\CheckoutConsumableNotification;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class ConsumableCheckoutTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCheckingOutConsumableRequiresCorrectPermission()
{
$this->actingAsForApi(User::factory()->create())
diff --git a/tests/Feature/Api/Consumables/ConsumablesIndexTest.php b/tests/Feature/Api/Consumables/ConsumablesIndexTest.php
index 33c10ed078..00fa43da27 100644
--- a/tests/Feature/Api/Consumables/ConsumablesIndexTest.php
+++ b/tests/Feature/Api/Consumables/ConsumablesIndexTest.php
@@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Consumables;
use App\Models\Company;
use App\Models\Consumable;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class ConsumablesIndexTest extends TestCase
{
- use InteractsWithSettings;
-
public function testConsumableIndexAdheresToCompanyScoping()
{
[$companyA, $companyB] = Company::factory()->count(2)->create();
diff --git a/tests/Feature/Api/Departments/DepartmentIndexTest.php b/tests/Feature/Api/Departments/DepartmentIndexTest.php
index 1a3884308f..11ab5df9bc 100644
--- a/tests/Feature/Api/Departments/DepartmentIndexTest.php
+++ b/tests/Feature/Api/Departments/DepartmentIndexTest.php
@@ -5,15 +5,11 @@ namespace Tests\Feature\Api\Departments;
use App\Models\Company;
use App\Models\Department;
use App\Models\User;
-use Illuminate\Routing\Route;
use Illuminate\Testing\Fluent\AssertableJson;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class DepartmentIndexTest extends TestCase
{
- use InteractsWithSettings;
-
public function testViewingDepartmentIndexRequiresAuthentication()
{
$this->getJson(route('api.departments.index'))->assertRedirect();
diff --git a/tests/Feature/Api/Groups/GroupStoreTest.php b/tests/Feature/Api/Groups/GroupStoreTest.php
index 9ffba51913..31a69fb469 100644
--- a/tests/Feature/Api/Groups/GroupStoreTest.php
+++ b/tests/Feature/Api/Groups/GroupStoreTest.php
@@ -4,13 +4,10 @@ namespace Tests\Feature\Api\Groups;
use App\Models\Group;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class GroupStoreTest extends TestCase
{
- use InteractsWithSettings;
-
public function testStoringGroupRequiresSuperAdminPermission()
{
$this->actingAsForApi(User::factory()->create())
diff --git a/tests/Feature/Api/Licenses/LicensesIndexTest.php b/tests/Feature/Api/Licenses/LicensesIndexTest.php
index a21a27da73..603002a095 100644
--- a/tests/Feature/Api/Licenses/LicensesIndexTest.php
+++ b/tests/Feature/Api/Licenses/LicensesIndexTest.php
@@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Licenses;
use App\Models\Company;
use App\Models\License;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class LicensesIndexTest extends TestCase
{
- use InteractsWithSettings;
-
public function testLicensesIndexAdheresToCompanyScoping()
{
[$companyA, $companyB] = Company::factory()->count(2)->create();
diff --git a/tests/Feature/Api/Locations/LocationsForSelectListTest.php b/tests/Feature/Api/Locations/LocationsForSelectListTest.php
index 4170cfc7f7..bfc7fc5374 100644
--- a/tests/Feature/Api/Locations/LocationsForSelectListTest.php
+++ b/tests/Feature/Api/Locations/LocationsForSelectListTest.php
@@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Locations;
use App\Models\Location;
use App\Models\User;
use Illuminate\Testing\Fluent\AssertableJson;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class LocationsForSelectListTest extends TestCase
{
- use InteractsWithSettings;
-
public function testGettingLocationListRequiresProperPermission()
{
$this->actingAsForApi(User::factory()->create())
diff --git a/tests/Feature/Api/Users/UpdateUserApiTest.php b/tests/Feature/Api/Users/UpdateUserApiTest.php
index 0786b171e4..f58aae4a05 100644
--- a/tests/Feature/Api/Users/UpdateUserApiTest.php
+++ b/tests/Feature/Api/Users/UpdateUserApiTest.php
@@ -3,13 +3,10 @@
namespace Tests\Feature\Api\Users;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class UpdateUserApiTest extends TestCase
{
- use InteractsWithSettings;
-
public function testApiUsersCanBeActivatedWithNumber()
{
$admin = User::factory()->superuser()->create();
diff --git a/tests/Feature/Api/Users/UsersForSelectListTest.php b/tests/Feature/Api/Users/UsersForSelectListTest.php
index 8cdf700f04..1ebfcf72eb 100644
--- a/tests/Feature/Api/Users/UsersForSelectListTest.php
+++ b/tests/Feature/Api/Users/UsersForSelectListTest.php
@@ -6,13 +6,10 @@ use App\Models\Company;
use App\Models\User;
use Illuminate\Testing\Fluent\AssertableJson;
use Laravel\Passport\Passport;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class UsersForSelectListTest extends TestCase
{
- use InteractsWithSettings;
-
public function testUsersAreReturned()
{
$users = User::factory()->superuser()->count(3)->create();
diff --git a/tests/Feature/Api/Users/UsersSearchTest.php b/tests/Feature/Api/Users/UsersSearchTest.php
index 723a115db1..72f23017f5 100644
--- a/tests/Feature/Api/Users/UsersSearchTest.php
+++ b/tests/Feature/Api/Users/UsersSearchTest.php
@@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Users;
use App\Models\Company;
use App\Models\User;
use Laravel\Passport\Passport;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class UsersSearchTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCanSearchByUserFirstAndLastName()
{
User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);
diff --git a/tests/Feature/Api/Users/UsersUpdateTest.php b/tests/Feature/Api/Users/UsersUpdateTest.php
index 953a671cf1..d6e0f9e46b 100644
--- a/tests/Feature/Api/Users/UsersUpdateTest.php
+++ b/tests/Feature/Api/Users/UsersUpdateTest.php
@@ -8,13 +8,10 @@ use App\Models\Group;
use App\Models\Location;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class UsersUpdateTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCanUpdateUserViaPatch()
{
$admin = User::factory()->superuser()->create();
diff --git a/tests/Feature/Checkins/AccessoryCheckinTest.php b/tests/Feature/Checkins/AccessoryCheckinTest.php
index 25cd5d0d87..56030991e2 100644
--- a/tests/Feature/Checkins/AccessoryCheckinTest.php
+++ b/tests/Feature/Checkins/AccessoryCheckinTest.php
@@ -8,13 +8,10 @@ use App\Models\User;
use App\Notifications\CheckinAccessoryNotification;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AccessoryCheckinTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCheckingInAccessoryRequiresCorrectPermission()
{
$accessory = Accessory::factory()->checkedOutToUser()->create();
diff --git a/tests/Feature/Checkins/AssetCheckinTest.php b/tests/Feature/Checkins/AssetCheckinTest.php
index fb6d21a6ac..1e6d2b995b 100644
--- a/tests/Feature/Checkins/AssetCheckinTest.php
+++ b/tests/Feature/Checkins/AssetCheckinTest.php
@@ -11,13 +11,10 @@ use App\Models\Statuslabel;
use App\Models\User;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Event;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AssetCheckinTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCheckingInAssetRequiresCorrectPermission()
{
$this->actingAs(User::factory()->create())
diff --git a/tests/Feature/CheckoutAcceptances/AccessoryAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/AccessoryAcceptanceTest.php
index a49b1167cb..bdaf0e780f 100644
--- a/tests/Feature/CheckoutAcceptances/AccessoryAcceptanceTest.php
+++ b/tests/Feature/CheckoutAcceptances/AccessoryAcceptanceTest.php
@@ -7,13 +7,10 @@ use App\Models\CheckoutAcceptance;
use App\Notifications\AcceptanceAssetAcceptedNotification;
use App\Notifications\AcceptanceAssetDeclinedNotification;
use Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AccessoryAcceptanceTest extends TestCase
{
- use InteractsWithSettings;
-
/**
* This can be absorbed into a bigger test
*/
diff --git a/tests/Feature/Checkouts/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/AccessoryCheckoutTest.php
index cbe9801cc0..11224e4d1f 100644
--- a/tests/Feature/Checkouts/AccessoryCheckoutTest.php
+++ b/tests/Feature/Checkouts/AccessoryCheckoutTest.php
@@ -7,13 +7,10 @@ use App\Models\Actionlog;
use App\Models\User;
use App\Notifications\CheckoutAccessoryNotification;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AccessoryCheckoutTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCheckingOutAccessoryRequiresCorrectPermission()
{
$this->actingAs(User::factory()->create())
diff --git a/tests/Feature/Checkouts/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/ConsumableCheckoutTest.php
index 5785d0572b..e38ae96c83 100644
--- a/tests/Feature/Checkouts/ConsumableCheckoutTest.php
+++ b/tests/Feature/Checkouts/ConsumableCheckoutTest.php
@@ -7,13 +7,10 @@ use App\Models\Consumable;
use App\Models\User;
use App\Notifications\CheckoutConsumableNotification;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class ConsumableCheckoutTest extends TestCase
{
- use InteractsWithSettings;
-
public function testCheckingOutConsumableRequiresCorrectPermission()
{
$this->actingAs(User::factory()->create())
diff --git a/tests/Feature/Checkouts/LicenseCheckoutTest.php b/tests/Feature/Checkouts/LicenseCheckoutTest.php
index 978fac28f2..2f4f51d4ac 100644
--- a/tests/Feature/Checkouts/LicenseCheckoutTest.php
+++ b/tests/Feature/Checkouts/LicenseCheckoutTest.php
@@ -6,13 +6,10 @@ use App\Models\Asset;
use App\Models\License;
use App\Models\LicenseSeat;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class LicenseCheckoutTest extends TestCase
{
- use InteractsWithSettings;
-
public function testNotesAreStoredInActionLogOnCheckoutToAsset()
{
$admin = User::factory()->superuser()->create();
diff --git a/tests/Feature/DashboardTest.php b/tests/Feature/DashboardTest.php
index 4e9459fb06..4690a13901 100644
--- a/tests/Feature/DashboardTest.php
+++ b/tests/Feature/DashboardTest.php
@@ -3,13 +3,10 @@
namespace Tests\Feature;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class DashboardTest extends TestCase
{
- use InteractsWithSettings;
-
public function testUsersWithoutAdminAccessAreRedirected()
{
$this->actingAs(User::factory()->create())
diff --git a/tests/Feature/Notifications/Email/EmailNotificationsUponCheckinTest.php b/tests/Feature/Notifications/Email/EmailNotificationsUponCheckinTest.php
index dbe79c5727..4ae415f1ee 100644
--- a/tests/Feature/Notifications/Email/EmailNotificationsUponCheckinTest.php
+++ b/tests/Feature/Notifications/Email/EmailNotificationsUponCheckinTest.php
@@ -7,7 +7,6 @@ use App\Models\Asset;
use App\Models\User;
use App\Notifications\CheckinAssetNotification;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
/**
@@ -15,8 +14,6 @@ use Tests\TestCase;
*/
class EmailNotificationsUponCheckinTest extends TestCase
{
- use InteractsWithSettings;
-
protected function setUp(): void
{
parent::setUp();
diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php
index b6bb7801a7..29bf06d9dc 100644
--- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php
+++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php
@@ -14,7 +14,6 @@ use App\Notifications\CheckinAssetNotification;
use App\Notifications\CheckinLicenseSeatNotification;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
/**
@@ -22,8 +21,6 @@ use Tests\TestCase;
*/
class SlackNotificationsUponCheckinTest extends TestCase
{
- use InteractsWithSettings;
-
protected function setUp(): void
{
parent::setUp();
diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php
index 550f7c5b18..048448cad7 100644
--- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php
+++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php
@@ -16,7 +16,6 @@ use App\Notifications\CheckoutConsumableNotification;
use App\Notifications\CheckoutLicenseSeatNotification;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
/**
@@ -24,8 +23,6 @@ use Tests\TestCase;
*/
class SlackNotificationsUponCheckoutTest extends TestCase
{
- use InteractsWithSettings;
-
protected function setUp(): void
{
parent::setUp();
diff --git a/tests/Feature/Reports/CustomReportTest.php b/tests/Feature/Reports/CustomReportTest.php
index dd3199212e..d90e4cb2a0 100644
--- a/tests/Feature/Reports/CustomReportTest.php
+++ b/tests/Feature/Reports/CustomReportTest.php
@@ -8,14 +8,10 @@ use App\Models\User;
use Illuminate\Testing\TestResponse;
use League\Csv\Reader;
use PHPUnit\Framework\Assert;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
-
class CustomReportTest extends TestCase
{
- use InteractsWithSettings;
-
protected function setUp(): void
{
parent::setUp();
diff --git a/tests/Feature/Users/UpdateUserTest.php b/tests/Feature/Users/UpdateUserTest.php
index 92245059ef..934fbce2b8 100644
--- a/tests/Feature/Users/UpdateUserTest.php
+++ b/tests/Feature/Users/UpdateUserTest.php
@@ -3,13 +3,10 @@
namespace Tests\Feature\Users;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class UpdateUserTest extends TestCase
{
- use InteractsWithSettings;
-
public function testUsersCanBeActivatedWithNumber()
{
$admin = User::factory()->superuser()->create();
diff --git a/tests/Support/InteractsWithSettings.php b/tests/Support/InitializesSettings.php
similarity index 90%
rename from tests/Support/InteractsWithSettings.php
rename to tests/Support/InitializesSettings.php
index a8c0070188..7c08e6f897 100644
--- a/tests/Support/InteractsWithSettings.php
+++ b/tests/Support/InitializesSettings.php
@@ -4,7 +4,7 @@ namespace Tests\Support;
use App\Models\Setting;
-trait InteractsWithSettings
+trait InitializesSettings
{
protected Settings $settings;
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 535f9a3e21..0c5ecc37e8 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -9,7 +9,7 @@ use RuntimeException;
use Tests\Support\AssertsAgainstSlackNotifications;
use Tests\Support\CustomTestMacros;
use Tests\Support\InteractsWithAuthentication;
-use Tests\Support\InteractsWithSettings;
+use Tests\Support\InitializesSettings;
abstract class TestCase extends BaseTestCase
{
@@ -17,6 +17,7 @@ abstract class TestCase extends BaseTestCase
use CreatesApplication;
use CustomTestMacros;
use InteractsWithAuthentication;
+ use InitializesSettings;
use LazilyRefreshDatabase;
private array $globallyDisabledMiddleware = [
@@ -25,20 +26,23 @@ abstract class TestCase extends BaseTestCase
protected function setUp(): void
{
- if (!file_exists(realpath(__DIR__ . '/../') . '/.env.testing')) {
- throw new RuntimeException(
- '.env.testing file does not exist. Aborting to avoid wiping your local database'
- );
- }
+ $this->guardAgainstMissingEnv();
parent::setUp();
+ $this->registerCustomMacros();
+
$this->withoutMiddleware($this->globallyDisabledMiddleware);
- if (collect(class_uses_recursive($this))->contains(InteractsWithSettings::class)) {
- $this->initializeSettings();
- }
+ $this->initializeSettings();
+ }
- $this->registerCustomMacros();
+ private function guardAgainstMissingEnv(): void
+ {
+ if (!file_exists(realpath(__DIR__ . '/../') . '/.env.testing')) {
+ throw new RuntimeException(
+ '.env.testing file does not exist. Aborting to avoid wiping your local database.'
+ );
+ }
}
}
diff --git a/tests/Unit/AssetMaintenanceTest.php b/tests/Unit/AssetMaintenanceTest.php
index 69c4c30938..46a0efdd7c 100644
--- a/tests/Unit/AssetMaintenanceTest.php
+++ b/tests/Unit/AssetMaintenanceTest.php
@@ -2,14 +2,10 @@
namespace Tests\Unit;
use App\Models\AssetMaintenance;
-use Carbon\Carbon;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AssetMaintenanceTest extends TestCase
{
- use InteractsWithSettings;
-
public function testZerosOutWarrantyIfBlank()
{
$c = new AssetMaintenance;
diff --git a/tests/Unit/AssetModelTest.php b/tests/Unit/AssetModelTest.php
index aec8edf692..4cc62e20a0 100644
--- a/tests/Unit/AssetModelTest.php
+++ b/tests/Unit/AssetModelTest.php
@@ -4,13 +4,10 @@ namespace Tests\Unit;
use App\Models\Asset;
use App\Models\Category;
use App\Models\AssetModel;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AssetModelTest extends TestCase
{
- use InteractsWithSettings;
-
public function testAnAssetModelContainsAssets()
{
$category = Category::factory()->create([
diff --git a/tests/Unit/AssetTest.php b/tests/Unit/AssetTest.php
index d3d9a90114..9c3a76af69 100644
--- a/tests/Unit/AssetTest.php
+++ b/tests/Unit/AssetTest.php
@@ -5,13 +5,10 @@ use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Category;
use Carbon\Carbon;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class AssetTest extends TestCase
{
- use InteractsWithSettings;
-
public function testAutoIncrement()
{
$this->settings->enableAutoIncrement();
diff --git a/tests/Unit/CategoryTest.php b/tests/Unit/CategoryTest.php
index e5c98a67ad..c3c9b0de8e 100644
--- a/tests/Unit/CategoryTest.php
+++ b/tests/Unit/CategoryTest.php
@@ -4,13 +4,10 @@ namespace Tests\Unit;
use App\Models\Category;
use App\Models\AssetModel;
use App\Models\Asset;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class CategoryTest extends TestCase
{
- use InteractsWithSettings;
-
public function testFailsEmptyValidation()
{
// An Asset requires a name, a qty, and a category_id.
diff --git a/tests/Unit/CompanyScopingTest.php b/tests/Unit/CompanyScopingTest.php
index 669dd5ed41..3923dd9f7d 100644
--- a/tests/Unit/CompanyScopingTest.php
+++ b/tests/Unit/CompanyScopingTest.php
@@ -12,13 +12,10 @@ use App\Models\License;
use App\Models\LicenseSeat;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class CompanyScopingTest extends TestCase
{
- use InteractsWithSettings;
-
public function models(): array
{
return [
diff --git a/tests/Unit/ComponentTest.php b/tests/Unit/ComponentTest.php
index 8f71057bfc..df8f64771f 100644
--- a/tests/Unit/ComponentTest.php
+++ b/tests/Unit/ComponentTest.php
@@ -5,13 +5,10 @@ use App\Models\Category;
use App\Models\Company;
use App\Models\Component;
use App\Models\Location;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class ComponentTest extends TestCase
{
- use InteractsWithSettings;
-
public function testAComponentBelongsToACompany()
{
$component = Component::factory()
diff --git a/tests/Unit/DepreciationTest.php b/tests/Unit/DepreciationTest.php
index ed033cf442..4dd8422276 100644
--- a/tests/Unit/DepreciationTest.php
+++ b/tests/Unit/DepreciationTest.php
@@ -5,13 +5,10 @@ use App\Models\Depreciation;
use App\Models\Category;
use App\Models\License;
use App\Models\AssetModel;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class DepreciationTest extends TestCase
{
- use InteractsWithSettings;
-
public function testADepreciationHasModels()
{
$depreciation = Depreciation::factory()->create();
diff --git a/tests/Unit/LdapTest.php b/tests/Unit/LdapTest.php
index c286b38496..6beb0d2118 100644
--- a/tests/Unit/LdapTest.php
+++ b/tests/Unit/LdapTest.php
@@ -3,8 +3,6 @@
namespace Tests\Unit;
use App\Models\Ldap;
-use Exception;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
/**
@@ -12,7 +10,6 @@ use Tests\TestCase;
*/
class LdapTest extends TestCase
{
- use InteractsWithSettings;
use \phpmock\phpunit\PHPMock;
public function testConnect()
diff --git a/tests/Unit/Models/Company/GetIdForCurrentUserTest.php b/tests/Unit/Models/Company/GetIdForCurrentUserTest.php
index 1ca88d7cac..6d77c88731 100644
--- a/tests/Unit/Models/Company/GetIdForCurrentUserTest.php
+++ b/tests/Unit/Models/Company/GetIdForCurrentUserTest.php
@@ -4,13 +4,10 @@ namespace Tests\Unit\Models\Company;
use App\Models\Company;
use App\Models\User;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class GetIdForCurrentUserTest extends TestCase
{
- use InteractsWithSettings;
-
public function testReturnsProvidedValueWhenFullCompanySupportDisabled()
{
$this->settings->disableMultipleFullCompanySupport();
diff --git a/tests/Unit/NotificationTest.php b/tests/Unit/NotificationTest.php
index 64cf8afb0a..8005759a1e 100644
--- a/tests/Unit/NotificationTest.php
+++ b/tests/Unit/NotificationTest.php
@@ -8,13 +8,10 @@ use App\Models\Category;
use Carbon\Carbon;
use App\Notifications\CheckoutAssetNotification;
use Illuminate\Support\Facades\Notification;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class NotificationTest extends TestCase
{
- use InteractsWithSettings;
-
public function testAUserIsEmailedIfTheyCheckoutAnAssetWithEULA()
{
$admin = User::factory()->superuser()->create();
diff --git a/tests/Unit/SnipeModelTest.php b/tests/Unit/SnipeModelTest.php
index ad4231010f..2bc81da61b 100644
--- a/tests/Unit/SnipeModelTest.php
+++ b/tests/Unit/SnipeModelTest.php
@@ -2,13 +2,10 @@
namespace Tests\Unit;
use App\Models\SnipeModel;
-use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class SnipeModelTest extends TestCase
{
- use InteractsWithSettings;
-
public function testSetsPurchaseDatesAppropriately()
{
$c = new SnipeModel;
diff --git a/webpack.mix.js b/webpack.mix.js
index fdda6618ab..cbf7fe1231 100644
--- a/webpack.mix.js
+++ b/webpack.mix.js
@@ -183,11 +183,11 @@ mix
[
"./resources/assets/js/dragtable.js",
'./node_modules/bootstrap-table/dist/bootstrap-table.js',
- "./resources/assets/js/bootstrap-table-reorder-columns.js",
'./node_modules/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile.js',
'./node_modules/bootstrap-table/dist/extensions/export/bootstrap-table-export.js',
'./node_modules/bootstrap-table/dist/extensions/cookie/bootstrap-table-cookie.js',
'./node_modules/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.js',
+ './node_modules/bootstrap-table/dist/extensions/addrbar/bootstrap-table-addrbar.js',
'./resources/assets/js/extensions/jquery.base64.js',
'./node_modules/tableexport.jquery.plugin/tableExport.min.js',
'./node_modules/tableexport.jquery.plugin/libs/jsPDF/jspdf.umd.min.js',