Files
portal/app/tests/Unit/Supplier/Stubs/ThrowingRefreshSupplierSessionJob.php
T

33 lines
981 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Tests\Unit\Supplier\Stubs;
use App\Jobs\Supplier\RefreshSupplierSessionJob;
use App\Services\Supplier\PlaywrightBridge;
use RuntimeException;
/**
* Test stub: simulates Task 5 Playwright failure by throwing a deterministic
* RuntimeException from handle(). Used in SupplierPortalClientTest to verify
* SupplierPortalClient correctly translates raw exceptions from the refresh
* job into typed SupplierAuthException (preserves error taxonomy).
*
* Cannot be an anonymous class because Laravel's dispatchSync serializes the
* job (SerializesModels trait), and anonymous classes cannot be serialized.
*/
class ThrowingRefreshSupplierSessionJob extends RefreshSupplierSessionJob
{
public function __construct(
public readonly string $simulatedMessage,
) {
//
}
public function handle(?PlaywrightBridge $bridge = null): void
{
throw new RuntimeException($this->simulatedMessage);
}
}