2026-06-03 09:10:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
it('keeps sentinel restarted events from re-syncing editable form fields', function () {
|
|
|
|
|
$componentSource = file_get_contents(app_path('Livewire/Server/Sentinel.php'));
|
|
|
|
|
|
|
|
|
|
preg_match('/public function handleSentinelRestarted\([^)]*\)\s*\{(?<body>.*?)\n \}/s', $componentSource, $matches);
|
|
|
|
|
|
|
|
|
|
expect($matches['body'] ?? '')
|
|
|
|
|
->toContain('$this->sentinelUpdatedAt = $this->server->sentinel_updated_at;')
|
|
|
|
|
->not->toContain('$this->syncData();');
|
|
|
|
|
});
|
|
|
|
|
|
2026-09-09 04:30:32 +00:00
|
|
|
it('does not expose a Sentinel disable action', function () {
|
2026-06-03 09:10:13 +00:00
|
|
|
$componentSource = file_get_contents(app_path('Livewire/Server/Sentinel.php'));
|
2026-09-09 04:30:32 +00:00
|
|
|
$view = file_get_contents(resource_path('views/livewire/server/sentinel.blade.php'));
|
2026-06-03 09:10:13 +00:00
|
|
|
|
2026-09-09 04:30:32 +00:00
|
|
|
expect($componentSource)->not->toContain('function toggleSentinel')
|
|
|
|
|
->and($view)->not->toContain('Disable')
|
|
|
|
|
->and($view)->not->toContain('Enable Sentinel');
|
2026-08-07 13:21:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('does not repeat a disabled status badge in the sentinel empty state', function () {
|
|
|
|
|
$view = file_get_contents(resource_path('views/livewire/server/sentinel.blade.php'));
|
|
|
|
|
|
|
|
|
|
expect($view)->not->toContain("? 'Disabled'");
|
|
|
|
|
});
|
2026-08-18 13:06:05 +00:00
|
|
|
|
|
|
|
|
it('tells the user that saving sentinel settings initiates a restart', function () {
|
|
|
|
|
$componentSource = file_get_contents(app_path('Livewire/Server/Sentinel.php'));
|
|
|
|
|
|
|
|
|
|
preg_match('/public function submit\([^)]*\).*?\{(?<body>.*?)\n \}/s', $componentSource, $matches);
|
|
|
|
|
|
|
|
|
|
expect($matches['body'] ?? '')
|
|
|
|
|
->toContain("\$this->dispatch('success', 'Sentinel settings updated. Restarting Sentinel.');");
|
|
|
|
|
});
|
2026-09-09 04:30:32 +00:00
|
|
|
|
|
|
|
|
it('starts mandatory Sentinel after server validation succeeds', function () {
|
|
|
|
|
$interactiveValidation = file_get_contents(app_path('Livewire/Server/ValidateAndInstall.php'));
|
|
|
|
|
$queuedValidation = file_get_contents(app_path('Jobs/ValidateAndInstallServerJob.php'));
|
|
|
|
|
|
|
|
|
|
expect($interactiveValidation)->toContain('CheckAndStartSentinelJob::dispatch($this->server);')
|
|
|
|
|
->and($queuedValidation)->toContain('CheckAndStartSentinelJob::dispatch($this->server);');
|
|
|
|
|
});
|