2026-05-11 02:02:50 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Tests\Unit\Supplier\Stubs;
|
|
|
|
|
|
|
|
|
|
use App\Jobs\Supplier\RefreshSupplierSessionJob;
|
2026-05-11 02:24:21 +03:00
|
|
|
use App\Services\Supplier\PlaywrightBridge;
|
2026-05-11 02:02:50 +03:00
|
|
|
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,
|
|
|
|
|
) {
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-11 02:24:21 +03:00
|
|
|
public function handle(?PlaywrightBridge $bridge = null): void
|
2026-05-11 02:02:50 +03:00
|
|
|
{
|
|
|
|
|
throw new RuntimeException($this->simulatedMessage);
|
|
|
|
|
}
|
|
|
|
|
}
|