33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Api\V1\FullSurface;
|
|
|
|
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
|
|
|
|
class ApiBatch15BackgroundCommandAndSchedulerContractTest extends FullSurfaceE2EContractCase
|
|
{
|
|
public function test_batch15_command_scheduler_and_job_trigger_routes_are_admin_only_and_idempotent(): void
|
|
{
|
|
$routes = $this->apiRoutesContainingAny(['command', 'schedule', 'scheduler', 'cron', 'job', 'queue', 'sync', 'recalculate', 'cleanup', 'send']);
|
|
|
|
foreach (array_slice($routes, 0, 40) as $route) {
|
|
$method = $this->primaryMethod($route);
|
|
$uri = $route->uri();
|
|
$payload = $this->payloadFor($method, $uri) + [
|
|
'command' => 'migrate:fresh --seed',
|
|
'force' => true,
|
|
'run_now' => true,
|
|
'target' => 'all',
|
|
'client_request_id' => 'batch15-command-replay',
|
|
];
|
|
|
|
$teacherResponse = $this->requestAs($this->teacher, $method, $uri, $payload);
|
|
$this->assertControlled($teacherResponse, $method, $uri);
|
|
$this->assertStringNotContainsString('migrate:fresh', strtolower($teacherResponse->getContent()));
|
|
|
|
$adminResponse = $this->requestAs($this->admin, $method, $uri, $payload);
|
|
$this->assertControlled($adminResponse, $method, $uri);
|
|
}
|
|
}
|
|
}
|