-
-
Notifications
You must be signed in to change notification settings - Fork 450
/
test_callable_serialization.phpt
66 lines (51 loc) · 1.42 KB
/
test_callable_serialization.phpt
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--TEST--
Test that capturing an exception with a callable looking argument does not trigger an deprecation "Deprecated: Use of "static" in callables is deprecated"
--INI--
error_reporting=E_ALL
zend.exception_ignore_args=0
--FILE--
<?php
declare(strict_types=1);
namespace Sentry\Tests;
use Exception;
use Sentry\ClientBuilder;
use Sentry\Event;
use Sentry\Options;
use Sentry\SentrySdk;
use Sentry\Transport\Result;
use Sentry\Transport\ResultStatus;
use Sentry\Transport\TransportInterface;
$vendor = __DIR__;
while (!file_exists($vendor . '/vendor')) {
$vendor = \dirname($vendor);
}
require $vendor . '/vendor/autoload.php';
$transport = new class implements TransportInterface {
public function send(Event $event): Result
{
echo 'Transport called' . PHP_EOL;
return new Result(ResultStatus::success());
}
public function close(?int $timeout = null): Result
{
return new Result(ResultStatus::success());
}
};
$options = [
'dsn' => 'http://public@example.com/sentry/1',
];
$client = ClientBuilder::create($options)
->setTransport($transport)
->getClient();
SentrySdk::getCurrentHub()->bindClient($client);
class Foo {
function __construct(string $bar) {
SentrySdk::getCurrentHub()->captureException(new Exception('doh!'));
}
}
new Foo('static::sort');
echo 'Triggered capture exception' . PHP_EOL;
?>
--EXPECT--
Transport called
Triggered capture exception