What Changed Removed per-file uses(TestCase::class ...) bindings in Unit tests to avoid Pest v4 “folder already uses the test case” discovery failure (kept RefreshDatabase where needed). Updated the backup scheduling job test to pass the newly required BulkOperationService when manually calling RunBackupScheduleJob::handle(). Where Unit (bulk cleanup across 56 files) RunBackupScheduleJobTest.php Verification ./vendor/bin/sail test → 443 passed, 5 skipped Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local> Reviewed-on: #45
71 lines
2.7 KiB
PHP
71 lines
2.7 KiB
PHP
<?php
|
|
|
|
use App\Services\Graph\GraphContractRegistry;
|
|
|
|
it('builds settings write method and path from the contract', function () {
|
|
config()->set('graph_contracts.types.settingsCatalogPolicy', [
|
|
'settings_write' => [
|
|
'path_template' => 'deviceManagement/configurationPolicies/{id}/settings/{settingId}',
|
|
'method' => 'PATCH',
|
|
],
|
|
]);
|
|
|
|
$registry = app(GraphContractRegistry::class);
|
|
|
|
expect($registry->settingsWriteMethod('settingsCatalogPolicy'))->toBe('PATCH');
|
|
expect($registry->settingsWritePath('settingsCatalogPolicy', 'policy-1', 'setting-9'))
|
|
->toBe('deviceManagement/configurationPolicies/policy-1/settings/setting-9');
|
|
});
|
|
|
|
it('returns null when settings write path requires a setting id', function () {
|
|
config()->set('graph_contracts.types.settingsCatalogPolicy', [
|
|
'settings_write' => [
|
|
'path_template' => 'deviceManagement/configurationPolicies/{id}/settings/{settingId}',
|
|
'method' => 'PATCH',
|
|
],
|
|
]);
|
|
|
|
$registry = app(GraphContractRegistry::class);
|
|
|
|
expect($registry->settingsWritePath('settingsCatalogPolicy', 'policy-1'))->toBeNull();
|
|
});
|
|
|
|
it('defaults settings write body shape to collection', function () {
|
|
config()->set('graph_contracts.types.settingsCatalogPolicy', [
|
|
'settings_write' => [
|
|
'path_template' => 'deviceManagement/configurationPolicies/{id}/settings',
|
|
'method' => 'POST',
|
|
],
|
|
]);
|
|
|
|
$registry = app(GraphContractRegistry::class);
|
|
|
|
expect($registry->settingsWriteBodyShape('settingsCatalogPolicy'))->toBe('collection');
|
|
expect($registry->settingsWriteFallbackBodyShape('settingsCatalogPolicy'))->toBeNull();
|
|
});
|
|
|
|
it('returns null when settings write contract is missing', function () {
|
|
config()->set('graph_contracts.types.settingsCatalogPolicy', []);
|
|
|
|
$registry = app(GraphContractRegistry::class);
|
|
|
|
expect($registry->settingsWriteMethod('settingsCatalogPolicy'))->toBeNull();
|
|
expect($registry->settingsWritePath('settingsCatalogPolicy', 'policy-1', 'setting-9'))->toBeNull();
|
|
});
|
|
|
|
it('returns fallback body shape when configured', function () {
|
|
config()->set('graph_contracts.types.settingsCatalogPolicy', [
|
|
'settings_write' => [
|
|
'path_template' => 'deviceManagement/configurationPolicies/{id}/settings',
|
|
'method' => 'POST',
|
|
'body_shape' => 'collection',
|
|
'fallback_body_shape' => 'wrapped',
|
|
],
|
|
]);
|
|
|
|
$registry = app(GraphContractRegistry::class);
|
|
|
|
expect($registry->settingsWriteBodyShape('settingsCatalogPolicy'))->toBe('collection');
|
|
expect($registry->settingsWriteFallbackBodyShape('settingsCatalogPolicy'))->toBe('wrapped');
|
|
});
|