move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 15:27:09 +01:00
parent 0ca7a2cf1e
commit e44a59a91e
7 changed files with 141 additions and 0 deletions
@@ -0,0 +1,30 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
final class SonarDeskCheckoutHandoffTest extends TestCase
{
public function test_checkout_is_disabled_by_default(): void
{
config()->set('sonardesk-integration.checkout_enabled', false);
$this->get('/sonardesk/buy')->assertOk()->assertSee('not yet enabled');
$this->get('/sonardesk/checkout')->assertStatus(503);
}
public function test_checkout_rejects_unlisted_host(): void
{
config()->set('sonardesk-integration.checkout_enabled', true);
config()->set('sonardesk-integration.checkout_url', 'https://evil.example/buy');
config()->set('sonardesk-integration.allowed_checkout_hosts', ['sonardesk.example']);
$this->get('/sonardesk/checkout')->assertStatus(503);
}
public function test_checkout_redirects_only_to_approved_https_host(): void
{
config()->set('sonardesk-integration.checkout_enabled', true);
config()->set('sonardesk-integration.checkout_url', 'https://sonardesk.example/buy');
config()->set('sonardesk-integration.allowed_checkout_hosts', ['sonardesk.example']);
$this->get('/sonardesk/checkout')->assertRedirect('https://sonardesk.example/buy');
}
}