mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Move InteractsWithSettings to TestCase
This commit is contained in:
parent
693d1c9452
commit
8003615b1f
|
@ -7,13 +7,10 @@ use App\Models\Actionlog;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\CheckoutAccessoryNotification;
|
use App\Notifications\CheckoutAccessoryNotification;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AccessoryCheckoutTest extends TestCase
|
class AccessoryCheckoutTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCheckingOutAccessoryRequiresCorrectPermission()
|
public function testCheckingOutAccessoryRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->create())
|
$this->actingAsForApi(User::factory()->create())
|
||||||
|
|
|
@ -11,13 +11,10 @@ use App\Models\Statuslabel;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetCheckinTest extends TestCase
|
class AssetCheckinTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCheckingInAssetRequiresCorrectPermission()
|
public function testCheckingInAssetRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->create())
|
$this->actingAsForApi(User::factory()->create())
|
||||||
|
|
|
@ -6,13 +6,10 @@ use App\Models\Asset;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Testing\Fluent\AssertableJson;
|
use Illuminate\Testing\Fluent\AssertableJson;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetIndexTest extends TestCase
|
class AssetIndexTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testAssetIndexReturnsExpectedAssets()
|
public function testAssetIndexReturnsExpectedAssets()
|
||||||
{
|
{
|
||||||
Asset::factory()->count(3)->create();
|
Asset::factory()->count(3)->create();
|
||||||
|
|
|
@ -9,15 +9,11 @@ use App\Models\Location;
|
||||||
use App\Models\Statuslabel;
|
use App\Models\Statuslabel;
|
||||||
use App\Models\Supplier;
|
use App\Models\Supplier;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Testing\Fluent\AssertableJson;
|
use Illuminate\Testing\Fluent\AssertableJson;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetStoreTest extends TestCase
|
class AssetStoreTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testRequiresPermissionToCreateAsset()
|
public function testRequiresPermissionToCreateAsset()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->create())
|
$this->actingAsForApi(User::factory()->create())
|
||||||
|
|
|
@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Assets;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetsForSelectListTest extends TestCase
|
class AssetsForSelectListTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testAssetsCanBeSearchedForByAssetTag()
|
public function testAssetsCanBeSearchedForByAssetTag()
|
||||||
{
|
{
|
||||||
Asset::factory()->create(['asset_tag' => '0001']);
|
Asset::factory()->create(['asset_tag' => '0001']);
|
||||||
|
|
|
@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Assets;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class RequestableAssetsTest extends TestCase
|
class RequestableAssetsTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testViewingRequestableAssetsRequiresCorrectPermission()
|
public function testViewingRequestableAssetsRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->create())
|
$this->actingAsForApi(User::factory()->create())
|
||||||
|
|
|
@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Components;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Component;
|
use App\Models\Component;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ComponentIndexTest extends TestCase
|
class ComponentIndexTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testComponentIndexAdheresToCompanyScoping()
|
public function testComponentIndexAdheresToCompanyScoping()
|
||||||
{
|
{
|
||||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||||
|
|
|
@ -7,13 +7,10 @@ use App\Models\Consumable;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\CheckoutConsumableNotification;
|
use App\Notifications\CheckoutConsumableNotification;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ConsumableCheckoutTest extends TestCase
|
class ConsumableCheckoutTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCheckingOutConsumableRequiresCorrectPermission()
|
public function testCheckingOutConsumableRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->create())
|
$this->actingAsForApi(User::factory()->create())
|
||||||
|
|
|
@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Consumables;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Consumable;
|
use App\Models\Consumable;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ConsumablesIndexTest extends TestCase
|
class ConsumablesIndexTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testConsumableIndexAdheresToCompanyScoping()
|
public function testConsumableIndexAdheresToCompanyScoping()
|
||||||
{
|
{
|
||||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||||
|
|
|
@ -5,15 +5,11 @@ namespace Tests\Feature\Api\Departments;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Department;
|
use App\Models\Department;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Routing\Route;
|
|
||||||
use Illuminate\Testing\Fluent\AssertableJson;
|
use Illuminate\Testing\Fluent\AssertableJson;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class DepartmentIndexTest extends TestCase
|
class DepartmentIndexTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testViewingDepartmentIndexRequiresAuthentication()
|
public function testViewingDepartmentIndexRequiresAuthentication()
|
||||||
{
|
{
|
||||||
$this->getJson(route('api.departments.index'))->assertRedirect();
|
$this->getJson(route('api.departments.index'))->assertRedirect();
|
||||||
|
|
|
@ -4,13 +4,10 @@ namespace Tests\Feature\Api\Groups;
|
||||||
|
|
||||||
use App\Models\Group;
|
use App\Models\Group;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class GroupStoreTest extends TestCase
|
class GroupStoreTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testStoringGroupRequiresSuperAdminPermission()
|
public function testStoringGroupRequiresSuperAdminPermission()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->create())
|
$this->actingAsForApi(User::factory()->create())
|
||||||
|
|
|
@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Licenses;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class LicensesIndexTest extends TestCase
|
class LicensesIndexTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testLicensesIndexAdheresToCompanyScoping()
|
public function testLicensesIndexAdheresToCompanyScoping()
|
||||||
{
|
{
|
||||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||||
|
|
|
@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Locations;
|
||||||
use App\Models\Location;
|
use App\Models\Location;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Testing\Fluent\AssertableJson;
|
use Illuminate\Testing\Fluent\AssertableJson;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class LocationsForSelectListTest extends TestCase
|
class LocationsForSelectListTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testGettingLocationListRequiresProperPermission()
|
public function testGettingLocationListRequiresProperPermission()
|
||||||
{
|
{
|
||||||
$this->actingAsForApi(User::factory()->create())
|
$this->actingAsForApi(User::factory()->create())
|
||||||
|
|
|
@ -3,16 +3,10 @@
|
||||||
namespace Tests\Feature\Api\Users;
|
namespace Tests\Feature\Api\Users;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Tests\Support\InteractsWithAuthentication;
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateUserApiTest extends TestCase
|
class UpdateUserApiTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
use InteractsWithAuthentication;
|
|
||||||
|
|
||||||
public function testApiUsersCanBeActivatedWithNumber()
|
public function testApiUsersCanBeActivatedWithNumber()
|
||||||
{
|
{
|
||||||
$admin = User::factory()->superuser()->create();
|
$admin = User::factory()->superuser()->create();
|
||||||
|
@ -64,5 +58,4 @@ class UpdateUserApiTest extends TestCase
|
||||||
|
|
||||||
$this->assertEquals(0, $user->refresh()->activated);
|
$this->assertEquals(0, $user->refresh()->activated);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,10 @@ use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Testing\Fluent\AssertableJson;
|
use Illuminate\Testing\Fluent\AssertableJson;
|
||||||
use Laravel\Passport\Passport;
|
use Laravel\Passport\Passport;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class UsersForSelectListTest extends TestCase
|
class UsersForSelectListTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testUsersAreReturned()
|
public function testUsersAreReturned()
|
||||||
{
|
{
|
||||||
$users = User::factory()->superuser()->count(3)->create();
|
$users = User::factory()->superuser()->count(3)->create();
|
||||||
|
|
|
@ -5,13 +5,10 @@ namespace Tests\Feature\Api\Users;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Laravel\Passport\Passport;
|
use Laravel\Passport\Passport;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class UsersSearchTest extends TestCase
|
class UsersSearchTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCanSearchByUserFirstAndLastName()
|
public function testCanSearchByUserFirstAndLastName()
|
||||||
{
|
{
|
||||||
User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);
|
User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);
|
||||||
|
|
|
@ -8,13 +8,10 @@ use App\Models\Group;
|
||||||
use App\Models\Location;
|
use App\Models\Location;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class UsersUpdateTest extends TestCase
|
class UsersUpdateTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCanUpdateUserViaPatch()
|
public function testCanUpdateUserViaPatch()
|
||||||
{
|
{
|
||||||
$admin = User::factory()->superuser()->create();
|
$admin = User::factory()->superuser()->create();
|
||||||
|
|
|
@ -8,13 +8,10 @@ use App\Models\User;
|
||||||
use App\Notifications\CheckinAccessoryNotification;
|
use App\Notifications\CheckinAccessoryNotification;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AccessoryCheckinTest extends TestCase
|
class AccessoryCheckinTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCheckingInAccessoryRequiresCorrectPermission()
|
public function testCheckingInAccessoryRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$accessory = Accessory::factory()->checkedOutToUser()->create();
|
$accessory = Accessory::factory()->checkedOutToUser()->create();
|
||||||
|
|
|
@ -11,13 +11,10 @@ use App\Models\Statuslabel;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetCheckinTest extends TestCase
|
class AssetCheckinTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCheckingInAssetRequiresCorrectPermission()
|
public function testCheckingInAssetRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->actingAs(User::factory()->create())
|
$this->actingAs(User::factory()->create())
|
||||||
|
|
|
@ -7,13 +7,10 @@ use App\Models\CheckoutAcceptance;
|
||||||
use App\Notifications\AcceptanceAssetAcceptedNotification;
|
use App\Notifications\AcceptanceAssetAcceptedNotification;
|
||||||
use App\Notifications\AcceptanceAssetDeclinedNotification;
|
use App\Notifications\AcceptanceAssetDeclinedNotification;
|
||||||
use Notification;
|
use Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AccessoryAcceptanceTest extends TestCase
|
class AccessoryAcceptanceTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This can be absorbed into a bigger test
|
* This can be absorbed into a bigger test
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,13 +7,10 @@ use App\Models\Actionlog;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\CheckoutAccessoryNotification;
|
use App\Notifications\CheckoutAccessoryNotification;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AccessoryCheckoutTest extends TestCase
|
class AccessoryCheckoutTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCheckingOutAccessoryRequiresCorrectPermission()
|
public function testCheckingOutAccessoryRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->actingAs(User::factory()->create())
|
$this->actingAs(User::factory()->create())
|
||||||
|
|
|
@ -7,13 +7,10 @@ use App\Models\Consumable;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\CheckoutConsumableNotification;
|
use App\Notifications\CheckoutConsumableNotification;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ConsumableCheckoutTest extends TestCase
|
class ConsumableCheckoutTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testCheckingOutConsumableRequiresCorrectPermission()
|
public function testCheckingOutConsumableRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->actingAs(User::factory()->create())
|
$this->actingAs(User::factory()->create())
|
||||||
|
|
|
@ -6,13 +6,10 @@ use App\Models\Asset;
|
||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
use App\Models\LicenseSeat;
|
use App\Models\LicenseSeat;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class LicenseCheckoutTest extends TestCase
|
class LicenseCheckoutTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testNotesAreStoredInActionLogOnCheckoutToAsset()
|
public function testNotesAreStoredInActionLogOnCheckoutToAsset()
|
||||||
{
|
{
|
||||||
$admin = User::factory()->superuser()->create();
|
$admin = User::factory()->superuser()->create();
|
||||||
|
|
|
@ -3,13 +3,10 @@
|
||||||
namespace Tests\Feature;
|
namespace Tests\Feature;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class DashboardTest extends TestCase
|
class DashboardTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testUsersWithoutAdminAccessAreRedirected()
|
public function testUsersWithoutAdminAccessAreRedirected()
|
||||||
{
|
{
|
||||||
$this->actingAs(User::factory()->create())
|
$this->actingAs(User::factory()->create())
|
||||||
|
|
|
@ -11,13 +11,10 @@ use App\Notifications\CheckinAccessoryNotification;
|
||||||
use App\Notifications\CheckoutAccessoryNotification;
|
use App\Notifications\CheckoutAccessoryNotification;
|
||||||
use Illuminate\Notifications\AnonymousNotifiable;
|
use Illuminate\Notifications\AnonymousNotifiable;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AccessoryWebhookTest extends TestCase
|
class AccessoryWebhookTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testAccessoryCheckoutSendsWebhookNotificationWhenSettingEnabled()
|
public function testAccessoryCheckoutSendsWebhookNotificationWhenSettingEnabled()
|
||||||
{
|
{
|
||||||
Notification::fake();
|
Notification::fake();
|
||||||
|
|
|
@ -12,13 +12,10 @@ use App\Notifications\CheckinAssetNotification;
|
||||||
use App\Notifications\CheckoutAssetNotification;
|
use App\Notifications\CheckoutAssetNotification;
|
||||||
use Illuminate\Notifications\AnonymousNotifiable;
|
use Illuminate\Notifications\AnonymousNotifiable;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetWebhookTest extends TestCase
|
class AssetWebhookTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function targets(): array
|
public function targets(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -8,14 +8,10 @@ use App\Models\Asset;
|
||||||
use App\Models\Component;
|
use App\Models\Component;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ComponentWebhookTest extends TestCase
|
class ComponentWebhookTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testComponentCheckoutDoesNotSendWebhookNotification()
|
public function testComponentCheckoutDoesNotSendWebhookNotification()
|
||||||
{
|
{
|
||||||
Notification::fake();
|
Notification::fake();
|
||||||
|
|
|
@ -9,13 +9,10 @@ use App\Models\User;
|
||||||
use App\Notifications\CheckoutConsumableNotification;
|
use App\Notifications\CheckoutConsumableNotification;
|
||||||
use Illuminate\Notifications\AnonymousNotifiable;
|
use Illuminate\Notifications\AnonymousNotifiable;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ConsumableWebhookTest extends TestCase
|
class ConsumableWebhookTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testConsumableCheckoutSendsWebhookNotificationWhenSettingEnabled()
|
public function testConsumableCheckoutSendsWebhookNotificationWhenSettingEnabled()
|
||||||
{
|
{
|
||||||
Notification::fake();
|
Notification::fake();
|
||||||
|
|
|
@ -12,13 +12,10 @@ use App\Notifications\CheckinLicenseSeatNotification;
|
||||||
use App\Notifications\CheckoutLicenseSeatNotification;
|
use App\Notifications\CheckoutLicenseSeatNotification;
|
||||||
use Illuminate\Notifications\AnonymousNotifiable;
|
use Illuminate\Notifications\AnonymousNotifiable;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class LicenseWebhookTest extends TestCase
|
class LicenseWebhookTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function targets(): array
|
public function targets(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -8,14 +8,10 @@ use App\Models\User;
|
||||||
use Illuminate\Testing\TestResponse;
|
use Illuminate\Testing\TestResponse;
|
||||||
use League\Csv\Reader;
|
use League\Csv\Reader;
|
||||||
use PHPUnit\Framework\Assert;
|
use PHPUnit\Framework\Assert;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
|
||||||
class CustomReportTest extends TestCase
|
class CustomReportTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
|
@ -3,13 +3,10 @@
|
||||||
namespace Tests\Feature\Users;
|
namespace Tests\Feature\Users;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class UpdateUserTest extends TestCase
|
class UpdateUserTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testUsersCanBeActivatedWithNumber()
|
public function testUsersCanBeActivatedWithNumber()
|
||||||
{
|
{
|
||||||
$admin = User::factory()->superuser()->create();
|
$admin = User::factory()->superuser()->create();
|
||||||
|
|
|
@ -15,6 +15,7 @@ abstract class TestCase extends BaseTestCase
|
||||||
use CreatesApplication;
|
use CreatesApplication;
|
||||||
use CustomTestMacros;
|
use CustomTestMacros;
|
||||||
use InteractsWithAuthentication;
|
use InteractsWithAuthentication;
|
||||||
|
use InteractsWithSettings;
|
||||||
use LazilyRefreshDatabase;
|
use LazilyRefreshDatabase;
|
||||||
|
|
||||||
private array $globallyDisabledMiddleware = [
|
private array $globallyDisabledMiddleware = [
|
||||||
|
|
|
@ -2,14 +2,10 @@
|
||||||
namespace Tests\Unit;
|
namespace Tests\Unit;
|
||||||
|
|
||||||
use App\Models\AssetMaintenance;
|
use App\Models\AssetMaintenance;
|
||||||
use Carbon\Carbon;
|
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetMaintenanceTest extends TestCase
|
class AssetMaintenanceTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testZerosOutWarrantyIfBlank()
|
public function testZerosOutWarrantyIfBlank()
|
||||||
{
|
{
|
||||||
$c = new AssetMaintenance;
|
$c = new AssetMaintenance;
|
||||||
|
|
|
@ -4,13 +4,10 @@ namespace Tests\Unit;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use App\Models\AssetModel;
|
use App\Models\AssetModel;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetModelTest extends TestCase
|
class AssetModelTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testAnAssetModelContainsAssets()
|
public function testAnAssetModelContainsAssets()
|
||||||
{
|
{
|
||||||
$category = Category::factory()->create([
|
$category = Category::factory()->create([
|
||||||
|
|
|
@ -5,13 +5,10 @@ use App\Models\Asset;
|
||||||
use App\Models\AssetModel;
|
use App\Models\AssetModel;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AssetTest extends TestCase
|
class AssetTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testAutoIncrement()
|
public function testAutoIncrement()
|
||||||
{
|
{
|
||||||
$this->settings->enableAutoIncrement();
|
$this->settings->enableAutoIncrement();
|
||||||
|
|
|
@ -4,13 +4,10 @@ namespace Tests\Unit;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use App\Models\AssetModel;
|
use App\Models\AssetModel;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class CategoryTest extends TestCase
|
class CategoryTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testFailsEmptyValidation()
|
public function testFailsEmptyValidation()
|
||||||
{
|
{
|
||||||
// An Asset requires a name, a qty, and a category_id.
|
// An Asset requires a name, a qty, and a category_id.
|
||||||
|
|
|
@ -12,13 +12,10 @@ use App\Models\License;
|
||||||
use App\Models\LicenseSeat;
|
use App\Models\LicenseSeat;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class CompanyScopingTest extends TestCase
|
class CompanyScopingTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function models(): array
|
public function models(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -5,13 +5,10 @@ use App\Models\Category;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Component;
|
use App\Models\Component;
|
||||||
use App\Models\Location;
|
use App\Models\Location;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ComponentTest extends TestCase
|
class ComponentTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testAComponentBelongsToACompany()
|
public function testAComponentBelongsToACompany()
|
||||||
{
|
{
|
||||||
$component = Component::factory()
|
$component = Component::factory()
|
||||||
|
|
|
@ -5,13 +5,10 @@ use App\Models\Depreciation;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
use App\Models\AssetModel;
|
use App\Models\AssetModel;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class DepreciationTest extends TestCase
|
class DepreciationTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testADepreciationHasModels()
|
public function testADepreciationHasModels()
|
||||||
{
|
{
|
||||||
$depreciation = Depreciation::factory()->create();
|
$depreciation = Depreciation::factory()->create();
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
namespace Tests\Unit;
|
namespace Tests\Unit;
|
||||||
|
|
||||||
use App\Models\Ldap;
|
use App\Models\Ldap;
|
||||||
use Exception;
|
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,7 +10,6 @@ use Tests\TestCase;
|
||||||
*/
|
*/
|
||||||
class LdapTest extends TestCase
|
class LdapTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
use \phpmock\phpunit\PHPMock;
|
use \phpmock\phpunit\PHPMock;
|
||||||
|
|
||||||
public function testConnect()
|
public function testConnect()
|
||||||
|
|
|
@ -4,13 +4,10 @@ namespace Tests\Unit\Models\Company;
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class GetIdForCurrentUserTest extends TestCase
|
class GetIdForCurrentUserTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testReturnsProvidedValueWhenFullCompanySupportDisabled()
|
public function testReturnsProvidedValueWhenFullCompanySupportDisabled()
|
||||||
{
|
{
|
||||||
$this->settings->disableMultipleFullCompanySupport();
|
$this->settings->disableMultipleFullCompanySupport();
|
||||||
|
|
|
@ -8,13 +8,10 @@ use App\Models\Category;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use App\Notifications\CheckoutAssetNotification;
|
use App\Notifications\CheckoutAssetNotification;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class NotificationTest extends TestCase
|
class NotificationTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testAUserIsEmailedIfTheyCheckoutAnAssetWithEULA()
|
public function testAUserIsEmailedIfTheyCheckoutAnAssetWithEULA()
|
||||||
{
|
{
|
||||||
$admin = User::factory()->superuser()->create();
|
$admin = User::factory()->superuser()->create();
|
||||||
|
|
|
@ -2,13 +2,10 @@
|
||||||
namespace Tests\Unit;
|
namespace Tests\Unit;
|
||||||
|
|
||||||
use App\Models\SnipeModel;
|
use App\Models\SnipeModel;
|
||||||
use Tests\Support\InteractsWithSettings;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class SnipeModelTest extends TestCase
|
class SnipeModelTest extends TestCase
|
||||||
{
|
{
|
||||||
use InteractsWithSettings;
|
|
||||||
|
|
||||||
public function testSetsPurchaseDatesAppropriately()
|
public function testSetsPurchaseDatesAppropriately()
|
||||||
{
|
{
|
||||||
$c = new SnipeModel;
|
$c = new SnipeModel;
|
||||||
|
|
Loading…
Reference in a new issue