mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Use laravel v5.5 withCount manual aliases
This commit is contained in:
parent
144a32b1ca
commit
20d0dce73e
|
@ -31,7 +31,7 @@ class ApiCategoriesCest
|
|||
|
||||
$response = json_decode($I->grabResponse(), true);
|
||||
// sample verify
|
||||
$category = App\Models\Category::withCount('assets','accessories','consumables','components','licenses')
|
||||
$category = App\Models\Category::withCount('assets as assets_count','accessories as accessories_count','consumables as consumables_count','components as components_count','licenses as licenses_count')
|
||||
->orderByDesc('created_at')->take(10)->get()->shuffle()->first();
|
||||
$I->seeResponseContainsJson($I->removeTimestamps((new CategoriesTransformer)->transformCategory($category)));
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ApiCompaniesCest
|
|||
$response = json_decode($I->grabResponse(), true);
|
||||
// dd($response);
|
||||
// sample verify
|
||||
$company = App\Models\Company::withCount('assets','licenses','accessories','consumables','components','users')
|
||||
$company = App\Models\Company::withCount('assets as assets_count','licenses as licenses_count','accessories as accessories_count','consumables as consumables_count','components as components_count','users as users_count')
|
||||
->orderByDesc('created_at')->take(10)->get()->shuffle()->first();
|
||||
|
||||
$I->seeResponseContainsJson($I->removeTimestamps((new CompaniesTransformer)->transformCompany($company)));
|
||||
|
|
|
@ -31,7 +31,7 @@ class ApiLicensesCest
|
|||
$response = json_decode($I->grabResponse(), true);
|
||||
// sample verify
|
||||
$license = App\Models\License::orderByDesc('created_at')
|
||||
->withCount('freeSeats')
|
||||
->withCount('freeSeats as freeSeats_count')
|
||||
->take(10)->get()->shuffle()->first();
|
||||
$I->seeResponseContainsJson($I->removeTimestamps((new LicensesTransformer)->transformLicense($license)));
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ApiLocationsCest
|
|||
$response = json_decode($I->grabResponse(), true);
|
||||
// sample verify
|
||||
$location = App\Models\Location::orderByDesc('created_at')
|
||||
->withCount('assignedAssets', 'assets', 'users')
|
||||
->withCount('assignedAssets as assignedAssets_count', 'assets as assets_count', 'users as users_count')
|
||||
->take(10)->get()->shuffle()->first();
|
||||
$I->seeResponseContainsJson($I->removeTimestamps((new LocationsTransformer)->transformLocation($location)));
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class ApiManufacturersCest
|
|||
|
||||
$response = json_decode($I->grabResponse(), true);
|
||||
// sample verify
|
||||
$manufacturer = App\Models\Manufacturer::withCount('assets','accessories','consumables','licenses')
|
||||
$manufacturer = App\Models\Manufacturer::withCount('assets as assets_count','accessories as accessories_count','consumables as consumables_count','licenses as licenses_count')
|
||||
->orderByDesc('created_at')->take(10)->get()->shuffle()->first();
|
||||
|
||||
$I->seeResponseContainsJson($I->removeTimestamps((new ManufacturersTransformer)->transformManufacturer($manufacturer)));
|
||||
|
|
|
@ -31,7 +31,7 @@ class ApiAssetModelsCest
|
|||
|
||||
$response = json_decode($I->grabResponse(), true);
|
||||
$assetmodel = App\Models\AssetModel::orderByDesc('created_at')
|
||||
->withCount('assets')->take(10)->get()->shuffle()->first();
|
||||
->withCount('assets as assets_count')->take(10)->get()->shuffle()->first();
|
||||
$I->seeResponseContainsJson($I->removeTimestamps((new AssetModelsTransformer)->transformAssetModel($assetmodel)));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class ApiStatuslabelsCest
|
|||
$response = json_decode($I->grabResponse(), true);
|
||||
// sample verify
|
||||
$statuslabel = App\Models\Statuslabel::orderByDesc('created_at')
|
||||
->withCount('assets')
|
||||
->withCount('assets as assets_count')
|
||||
->take(10)->get()->shuffle()->first();
|
||||
$I->seeResponseContainsJson($I->removeTimestamps((new StatuslabelsTransformer)->transformStatuslabel($statuslabel)));
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class ApiUsersCest
|
|||
$response = json_decode($I->grabResponse(), true);
|
||||
// sample verify
|
||||
$user = App\Models\User::orderByDesc('created_at')
|
||||
->withCount('assets', 'licenses', 'accessories', 'consumables')
|
||||
->withCount('assets as assets_count', 'licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count')
|
||||
->take(10)->get()->shuffle()->first();
|
||||
$I->seeResponseContainsJson($I->removeTimestamps((new UsersTransformer)->transformUser($user)));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue