From e4e549d9f6cb7c40eec98407fc72b3f883afa229 Mon Sep 17 00:00:00 2001 From: Martin Linzmayer Date: Tue, 2 Dec 2025 21:23:50 +0100 Subject: [PATCH 1/2] ref(tests): move `ClockMock` into `tests` --- tests/BreadcrumbTest.php | 2 +- tests/Metrics/MetricsTest.php | 3 +-- tests/Serializer/PayloadSerializerTest.php | 2 +- {src/Util => tests/TestUtil}/ClockMock.php | 2 +- tests/Tracing/SpanTest.php | 2 +- tests/Tracing/TransactionTest.php | 3 +-- tests/Transport/HttpTransportTest.php | 2 +- tests/Transport/RateLimiterTest.php | 2 +- tests/bootstrap.php | 2 +- 9 files changed, 9 insertions(+), 11 deletions(-) rename {src/Util => tests/TestUtil}/ClockMock.php (99%) diff --git a/tests/BreadcrumbTest.php b/tests/BreadcrumbTest.php index 77329f191..932b49a1c 100644 --- a/tests/BreadcrumbTest.php +++ b/tests/BreadcrumbTest.php @@ -6,7 +6,7 @@ use PHPUnit\Framework\TestCase; use Sentry\Breadcrumb; -use Sentry\Util\ClockMock; +use Sentry\Tests\TestUtil\ClockMock; final class BreadcrumbTest extends TestCase { diff --git a/tests/Metrics/MetricsTest.php b/tests/Metrics/MetricsTest.php index 3de480657..08c7929ad 100644 --- a/tests/Metrics/MetricsTest.php +++ b/tests/Metrics/MetricsTest.php @@ -11,10 +11,9 @@ use Sentry\Options; use Sentry\SentrySdk; use Sentry\State\Hub; +use Sentry\Tests\TestUtil\ClockMock; use Sentry\Tracing\SpanContext; use Sentry\Tracing\TransactionContext; -use Sentry\Util\ClockMock; - use function Sentry\metrics; final class MetricsTest extends TestCase diff --git a/tests/Serializer/PayloadSerializerTest.php b/tests/Serializer/PayloadSerializerTest.php index 3d3cc4c75..53f3235e8 100644 --- a/tests/Serializer/PayloadSerializerTest.php +++ b/tests/Serializer/PayloadSerializerTest.php @@ -28,6 +28,7 @@ use Sentry\Serializer\PayloadSerializer; use Sentry\Severity; use Sentry\Stacktrace; +use Sentry\Tests\TestUtil\ClockMock; use Sentry\Tracing\DynamicSamplingContext; use Sentry\Tracing\Span; use Sentry\Tracing\SpanId; @@ -36,7 +37,6 @@ use Sentry\Tracing\TransactionMetadata; use Sentry\Unit; use Sentry\UserDataBag; -use Sentry\Util\ClockMock; use Sentry\Util\SentryUid; /** diff --git a/src/Util/ClockMock.php b/tests/TestUtil/ClockMock.php similarity index 99% rename from src/Util/ClockMock.php rename to tests/TestUtil/ClockMock.php index 004291d39..73809f591 100644 --- a/src/Util/ClockMock.php +++ b/tests/TestUtil/ClockMock.php @@ -26,7 +26,7 @@ * THE SOFTWARE. */ -namespace Sentry\Util; +namespace Sentry\Tests\TestUtil; /** * @author Nicolas Grekas diff --git a/tests/Tracing/SpanTest.php b/tests/Tracing/SpanTest.php index e0db7c6d5..cf8956172 100644 --- a/tests/Tracing/SpanTest.php +++ b/tests/Tracing/SpanTest.php @@ -5,13 +5,13 @@ namespace Sentry\Tests\Tracing; use PHPUnit\Framework\TestCase; +use Sentry\Tests\TestUtil\ClockMock; use Sentry\Tracing\Span; use Sentry\Tracing\SpanContext; use Sentry\Tracing\SpanId; use Sentry\Tracing\TraceId; use Sentry\Tracing\Transaction; use Sentry\Tracing\TransactionContext; -use Sentry\Util\ClockMock; /** * @group time-sensitive diff --git a/tests/Tracing/TransactionTest.php b/tests/Tracing/TransactionTest.php index 61c8d44f6..76a2c3aab 100644 --- a/tests/Tracing/TransactionTest.php +++ b/tests/Tracing/TransactionTest.php @@ -12,11 +12,10 @@ use Sentry\Options; use Sentry\State\Hub; use Sentry\State\HubInterface; -use Sentry\Tracing\Span; +use Sentry\Tests\TestUtil\ClockMock; use Sentry\Tracing\SpanContext; use Sentry\Tracing\Transaction; use Sentry\Tracing\TransactionContext; -use Sentry\Util\ClockMock; /** * @group time-sensitive diff --git a/tests/Transport/HttpTransportTest.php b/tests/Transport/HttpTransportTest.php index 66d564b85..1d34137ae 100644 --- a/tests/Transport/HttpTransportTest.php +++ b/tests/Transport/HttpTransportTest.php @@ -14,9 +14,9 @@ use Sentry\Options; use Sentry\Profiling\Profile; use Sentry\Serializer\PayloadSerializerInterface; +use Sentry\Tests\TestUtil\ClockMock; use Sentry\Transport\HttpTransport; use Sentry\Transport\ResultStatus; -use Sentry\Util\ClockMock; final class HttpTransportTest extends TestCase { diff --git a/tests/Transport/RateLimiterTest.php b/tests/Transport/RateLimiterTest.php index c1112e9ab..6a34556c7 100644 --- a/tests/Transport/RateLimiterTest.php +++ b/tests/Transport/RateLimiterTest.php @@ -7,8 +7,8 @@ use PHPUnit\Framework\TestCase; use Sentry\EventType; use Sentry\HttpClient\Response; +use Sentry\Tests\TestUtil\ClockMock; use Sentry\Transport\RateLimiter; -use Sentry\Util\ClockMock; /** * @group time-sensitive diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 49e701ceb..a3a416679 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -5,9 +5,9 @@ use Sentry\Breadcrumb; use Sentry\Event; use Sentry\Metrics\Metrics; +use Sentry\Tests\TestUtil\ClockMock; use Sentry\Tracing\Span; use Sentry\Transport\RateLimiter; -use Sentry\Util\ClockMock; require_once __DIR__ . '/../vendor/autoload.php'; From 7f618db74fd70f7033530387755ec5d3bd587724 Mon Sep 17 00:00:00 2001 From: Martin Linzmayer Date: Tue, 2 Dec 2025 21:26:59 +0100 Subject: [PATCH 2/2] lints --- psalm.xml.dist | 1 - tests/Metrics/MetricsTest.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/psalm.xml.dist b/psalm.xml.dist index 502f940b3..ea60216a6 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -10,7 +10,6 @@ - diff --git a/tests/Metrics/MetricsTest.php b/tests/Metrics/MetricsTest.php index 08c7929ad..760bf90c0 100644 --- a/tests/Metrics/MetricsTest.php +++ b/tests/Metrics/MetricsTest.php @@ -14,6 +14,7 @@ use Sentry\Tests\TestUtil\ClockMock; use Sentry\Tracing\SpanContext; use Sentry\Tracing\TransactionContext; + use function Sentry\metrics; final class MetricsTest extends TestCase