diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc030b2..9cb1ae7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ jobs: - php: 8.1 # should use monolog v3 - php: 8.2 # should use monolog v3 - php: 8.3 # should use monolog v3 + # TODO matrix should support Both versions of Sentry SDK steps: - uses: actions/checkout@v2 diff --git a/composer.json b/composer.json index 06d6576..4c5a542 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "require": { "php": "^7.4 || ^8.0", "monolog/monolog": "^1.6 || ^2.0 || ^3.0", - "sentry/sentry": "^3.1" + "sentry/sentry": "^3.1 || ^4.0" }, "require-dev": { "coduo/php-matcher": "^6.0.8", diff --git a/tests/SentryHandlerTest.php b/tests/SentryHandlerTest.php index 27e6854..bc94584 100644 --- a/tests/SentryHandlerTest.php +++ b/tests/SentryHandlerTest.php @@ -14,6 +14,7 @@ use Monolog\LogRecord; use PHPUnit\Framework\TestCase; use Sentry\Breadcrumb; +use Sentry\Client; use Sentry\ClientBuilder; use Sentry\Event; use Sentry\Integration\EnvironmentIntegration; @@ -570,62 +571,66 @@ public function resetSpy(): void } } -class SpyTransport implements TransportInterface -{ - /** - * @var Event|null - */ - public $spiedEvent; - - /** - * @var bool - */ - public $isFlushed = false; - - public function send(Event $event): PromiseInterface +if (version_compare(Client::SDK_VERSION, '4.0.0') >= 0) { + dump('TODO'); +} else { + class SpyTransport implements TransportInterface { - $this->spiedEvent = $event; + /** + * @var Event|null + */ + public $spiedEvent; - return new FulfilledPromise(new Response(ResponseStatus::skipped(), $event)); - } + /** + * @var bool + */ + public $isFlushed = false; - public function resetSpy(): void - { - $this->spiedEvent = null; - $this->isFlushed = false; - } + public function send(Event $event): PromiseInterface + { + $this->spiedEvent = $event; - public function getSpiedEvent(): Event - { - if (null === $this->spiedEvent) { - throw new \RuntimeException('No spied scope'); + return new FulfilledPromise(new Response(ResponseStatus::skipped(), $event)); } - return $this->spiedEvent; - } + public function resetSpy(): void + { + $this->spiedEvent = null; + $this->isFlushed = false; + } - public function close(?int $timeout = null): PromiseInterface - { - $this->isFlushed = true; + public function getSpiedEvent(): Event + { + if (null === $this->spiedEvent) { + throw new \RuntimeException('No spied scope'); + } - return new FulfilledPromise(true); - } -} + return $this->spiedEvent; + } -class FakeTransportFactory implements TransportFactoryInterface -{ - /** - * @var SpyTransport - */ - private $transport; + public function close(?int $timeout = null): PromiseInterface + { + $this->isFlushed = true; - public function __construct(SpyTransport $transport) - { - $this->transport = $transport; + return new FulfilledPromise(true); + } } - public function create(Options $options): TransportInterface + class FakeTransportFactory implements TransportFactoryInterface { - return $this->transport; + /** + * @var SpyTransport + */ + private $transport; + + public function __construct(SpyTransport $transport) + { + $this->transport = $transport; + } + + public function create(Options $options): TransportInterface + { + return $this->transport; + } } }