Skip to content

Commit fa74d3b

Browse files
committed
lints
1 parent 1693a75 commit fa74d3b

2 files changed

Lines changed: 23 additions & 21 deletions

File tree

tests/Integration/ModulesIntegrationTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
use PHPUnit\Framework\MockObject\MockObject;
88
use PHPUnit\Framework\TestCase;
9+
use Sentry\ClientBuilder;
910
use Sentry\ClientInterface;
1011
use Sentry\Event;
1112
use Sentry\Integration\ModulesIntegration;
1213
use Sentry\SentrySdk;
1314
use Sentry\State\Scope;
14-
use Sentry\ClientBuilder;
1515
use Sentry\Transport\Result;
1616
use Sentry\Transport\ResultStatus;
1717
use Sentry\Transport\TransportInterface;
@@ -90,4 +90,16 @@ public function testModuleIntegration(): void
9090

9191
$client->captureEvent(Event::createEvent(), null, new Scope());
9292
}
93+
94+
/**
95+
* Polyfill for older phpunit versions.
96+
*/
97+
public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void
98+
{
99+
if (method_exists(parent::class, 'assertMatchesRegularExpression')) {
100+
parent::assertMatchesRegularExpression($pattern, $string, $message);
101+
} else {
102+
static::assertRegExp($pattern, $string, $message);
103+
}
104+
}
93105
}

tests/Serializer/PayloadSerializerTest.php

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
6868
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
6969
{"type":"event","content_type":"application\/json"}
7070
{"timestamp":1597790835,"platform":"php","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
71-
TEXT
72-
,
71+
TEXT,
7372
];
7473

7574
$event = Event::createEvent(new EventId('fc9442f5aef34234bb22b9a615e30ccd'));
@@ -185,8 +184,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
185184
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
186185
{"type":"event","content_type":"application\/json"}
187186
{"timestamp":1597790835,"platform":"php","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]},"message":"My raw message with interpreted strings like this"}
188-
TEXT
189-
,
187+
TEXT,
190188
];
191189

192190
$event = Event::createEvent(new EventId('fc9442f5aef34234bb22b9a615e30ccd'));
@@ -210,8 +208,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
210208
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
211209
{"type":"event","content_type":"application\/json"}
212210
{"timestamp":1597790835,"platform":"php","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]},"message":{"message":"My raw message with interpreted strings like %s","params":["this"],"formatted":"My raw message with interpreted strings like that"}}
213-
TEXT
214-
,
211+
TEXT,
215212
];
216213

217214
$span1 = new Span();
@@ -301,8 +298,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
301298
{"timestamp":1597790835,"platform":"php","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]},"transaction":"GET \/","release":"1.0.0","environment":"dev","contexts":{"os":{"name":"macOS","version":"13.2.1","build":"22D68","kernel_version":"Darwin Kernel Version 22.2.0"},"runtime":{"name":"php","sapi":"cli","version":"8.2.3"},"trace":{"trace_id":"21160e9b836d479f81611368b2aa3d2c","span_id":"5dd538dc297544cc"}},"spans":[{"span_id":"5dd538dc297544cc","trace_id":"21160e9b836d479f81611368b2aa3d2c","start_timestamp":1597790835,"origin":"manual"},{"span_id":"b01b9f6349558cd1","trace_id":"1e57b752bc6e4544bbaa246cd1d05dee","start_timestamp":1597790835,"origin":"manual","parent_span_id":"b0e6f15b45c36b12","timestamp":1598659060,"status":"ok","description":"GET \/sockjs-node\/info","op":"http","data":{"url":"http:\/\/localhost:8080\/sockjs-node\/info?t=1588601703755","status_code":200,"type":"xhr","method":"GET"},"tags":{"http.status_code":"200"}}]}
302299
{"type":"profile","content_type":"application\/json"}
303300
{"device":{"architecture":"aarch64"},"event_id":"fc9442f5aef34234bb22b9a615e30ccd","os":{"name":"macOS","version":"13.2.1","build_number":"22D68"},"platform":"php","release":"1.0.0","environment":"dev","runtime":{"name":"php","sapi":"cli","version":"8.2.3"},"timestamp":"2023-02-28T08:41:00.000+00:00","transaction":{"id":"fc9442f5aef34234bb22b9a615e30ccd","name":"GET \/","trace_id":"21160e9b836d479f81611368b2aa3d2c","active_thread_id":"0"},"version":"1","profile":{"frames":[{"filename":"\/var\/www\/html\/index.php","abs_path":"\/var\/www\/html\/index.php","module":null,"function":"\/var\/www\/html\/index.php","lineno":42},{"filename":"\/var\/www\/html\/function.php","abs_path":"\/var\/www\/html\/function.php","module":"Function","function":"Function::doStuff","lineno":84}],"samples":[{"stack_id":0,"thread_id":"0","elapsed_since_start_ns":1000000},{"stack_id":1,"thread_id":"0","elapsed_since_start_ns":2000000}],"stacks":[[0],[0,1]]}}
304-
TEXT
305-
,
301+
TEXT,
306302
];
307303

308304
$event = Event::createTransaction(new EventId('fc9442f5aef34234bb22b9a615e30ccd'));
@@ -315,8 +311,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
315311
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]},"trace":{"public_key":"public","trace_id":"d49d9bf66f13450b81f65bc51cf49c03","sample_rate":"1"}}
316312
{"type":"transaction","content_type":"application\/json"}
317313
{"timestamp":1597790835,"platform":"php","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]},"spans":[],"transaction_info":{"source":"custom"}}
318-
TEXT
319-
,
314+
TEXT,
320315
];
321316

322317
$event = Event::createEvent(new EventId('fc9442f5aef34234bb22b9a615e30ccd'));
@@ -328,8 +323,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
328323
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
329324
{"type":"event","content_type":"application\/json"}
330325
{"timestamp":1597790835,"platform":"php","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]},"stacktrace":{"frames":[{"filename":"","lineno":0,"in_app":true}]}}
331-
TEXT
332-
,
326+
TEXT,
333327
];
334328

335329
$checkinId = SentryUid::generate();
@@ -351,8 +345,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
351345
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
352346
{"type":"check_in","content_type":"application\/json"}
353347
{"check_in_id":"$checkinId","monitor_slug":"my-monitor","status":"ok","duration":10,"release":"1.0.0","environment":"dev"}
354-
TEXT
355-
,
348+
TEXT,
356349
];
357350

358351
$checkinId = SentryUid::generate();
@@ -371,8 +364,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
371364
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
372365
{"type":"check_in","content_type":"application\/json"}
373366
{"check_in_id":"$checkinId","monitor_slug":"my-monitor","status":"in_progress","duration":null,"release":"","environment":"production"}
374-
TEXT
375-
,
367+
TEXT,
376368
];
377369

378370
$checkinId = SentryUid::generate();
@@ -406,8 +398,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
406398
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
407399
{"type":"check_in","content_type":"application\/json"}
408400
{"check_in_id":"$checkinId","monitor_slug":"my-monitor","status":"ok","duration":10,"release":"1.0.0","environment":"dev","monitor_config":{"schedule":{"type":"crontab","value":"0 0 * * *","unit":""},"checkin_margin":10,"max_runtime":12,"timezone":"Europe\/Amsterdam","failure_issue_threshold":5,"recovery_threshold":10},"contexts":{"trace":{"trace_id":"21160e9b836d479f81611368b2aa3d2c","span_id":"5dd538dc297544cc"}}}
409-
TEXT
410-
,
401+
TEXT,
411402
];
412403

413404
$event = Event::createLogs(new EventId('fc9442f5aef34234bb22b9a615e30ccd'));
@@ -422,8 +413,7 @@ public static function serializeAsEnvelopeDataProvider(): iterable
422413
{"event_id":"fc9442f5aef34234bb22b9a615e30ccd","sent_at":"2020-08-18T22:47:15Z","dsn":"http:\/\/public@example.com\/sentry\/1","sdk":{"name":"sentry.php","version":"$sdkVersion","packages":[{"name":"composer:sentry\/sentry","version":"$sdkVersion"}]}}
423414
{"type":"log","item_count":1,"content_type":"application\/vnd.sentry.items.log+json"}
424415
{"items":[{"timestamp":1597790835,"trace_id":"21160e9b836d479f81611368b2aa3d2c","level":"info","body":"A log message","attributes":{"foo":{"type":"string","value":"bar"}}}]}
425-
TEXT
426-
,
416+
TEXT,
427417
];
428418
}
429419
}

0 commit comments

Comments
 (0)