Skip to content

Commit

Permalink
Move InteractsWithSettings to TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusmoore committed Mar 14, 2024
1 parent 693d1c9 commit 8003615
Show file tree
Hide file tree
Showing 43 changed files with 1 addition and 135 deletions.
3 changes: 0 additions & 3 deletions tests/Feature/Api/Accessories/AccessoryCheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Assets/AssetCheckinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Assets/AssetIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
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();
Expand Down
4 changes: 0 additions & 4 deletions tests/Feature/Api/Assets/AssetStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@
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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Assets/AssetsForSelectListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
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']);
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Assets/RequestableAssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Components/ComponentIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
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();
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Consumables/ConsumableCheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Consumables/ConsumablesIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
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();
Expand Down
4 changes: 0 additions & 4 deletions tests/Feature/Api/Departments/DepartmentIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
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();
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Groups/GroupStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@

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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Licenses/LicensesIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
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();
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Locations/LocationsForSelectListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
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())
Expand Down
7 changes: 0 additions & 7 deletions tests/Feature/Api/Users/UpdateUserApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
namespace Tests\Feature\Api\Users;

use App\Models\User;
use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
use Tests\Support\InteractsWithAuthentication;


class UpdateUserApiTest extends TestCase
{
use InteractsWithSettings;
use InteractsWithAuthentication;

public function testApiUsersCanBeActivatedWithNumber()
{
$admin = User::factory()->superuser()->create();
Expand Down Expand Up @@ -64,5 +58,4 @@ public function testApiUsersCanBeDeactivatedWithBooleanFalse()

$this->assertEquals(0, $user->refresh()->activated);
}

}
3 changes: 0 additions & 3 deletions tests/Feature/Api/Users/UsersForSelectListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
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();
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Users/UsersSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
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']);
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Api/Users/UsersUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
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();
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Checkins/AccessoryCheckinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
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();
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Checkins/AssetCheckinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/CheckoutAcceptances/AccessoryAcceptanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
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
*/
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Checkouts/AccessoryCheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Checkouts/ConsumableCheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Checkouts/LicenseCheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
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();
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/DashboardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Notifications/AccessoryWebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
use App\Notifications\CheckoutAccessoryNotification;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Support\Facades\Notification;
use Tests\Support\InteractsWithSettings;
use Tests\TestCase;

class AccessoryWebhookTest extends TestCase
{
use InteractsWithSettings;

public function testAccessoryCheckoutSendsWebhookNotificationWhenSettingEnabled()
{
Notification::fake();
Expand Down
3 changes: 0 additions & 3 deletions tests/Feature/Notifications/AssetWebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@
use App\Notifications\CheckoutAssetNotification;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Support\Facades\Notification;
use Tests\Support\InteractsWithSettings;
use Tests\TestCase;

class AssetWebhookTest extends TestCase
{
use InteractsWithSettings;

public function targets(): array
{
return [
Expand Down
4 changes: 0 additions & 4 deletions tests/Feature/Notifications/ComponentWebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@
use App\Models\Component;
use App\Models\User;
use Illuminate\Support\Facades\Notification;
use Tests\Support\InteractsWithSettings;
use Tests\TestCase;

class ComponentWebhookTest extends TestCase
{

use InteractsWithSettings;

public function testComponentCheckoutDoesNotSendWebhookNotification()
{
Notification::fake();
Expand Down

0 comments on commit 8003615

Please sign in to comment.