-
-
Notifications
You must be signed in to change notification settings - Fork 466
Expand file tree
/
Copy pathbootstrap.php
More file actions
30 lines (26 loc) · 1.18 KB
/
bootstrap.php
File metadata and controls
30 lines (26 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
declare(strict_types=1);
use Sentry\Breadcrumb;
use Sentry\Event;
use Sentry\Metrics\Metrics;
use Sentry\Tracing\Span;
use Sentry\Transport\RateLimiter;
use Sentry\Util\ClockMock;
require_once __DIR__ . '/../vendor/autoload.php';
// According to the Symfony documentation the proper way to register the mocked
// functions for a certain class would be to configure the listener in the
// phpunit.xml file, however in our case it doesn't work because PHPUnit loads
// the data providers of the tests long before instantiating the listeners. In
// turn, PHP caches the functions to call to avoid looking up in the function
// table again and again, therefore if for any reason the method that should use
// a mocked function gets called before the mock itself gets created it will not
// use the mocked methods.
//
// See https://symfony.com/doc/current/components/phpunit_bridge.html#troubleshooting
// See https://bugs.php.net/bug.php?id=64346
ClockMock::register(Event::class);
ClockMock::register(Breadcrumb::class);
ClockMock::register(Span::class);
ClockMock::register(RateLimiter::class);
ClockMock::register(Metrics::class);
ClockMock::register(Sentry\Serializer\PayloadSerializer::class);