-
-
Notifications
You must be signed in to change notification settings - Fork 466
Expand file tree
/
Copy pathExceptionMechanismTest.php
More file actions
58 lines (50 loc) · 1.48 KB
/
ExceptionMechanismTest.php
File metadata and controls
58 lines (50 loc) · 1.48 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
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
<?php
declare(strict_types=1);
namespace Sentry\Tests;
use PHPUnit\Framework\TestCase;
use Sentry\ExceptionMechanism;
final class ExceptionMechanismTest extends TestCase
{
/**
* @dataProvider constructorDataProvider
*/
public function testConstructor(
array $constructorArgs,
string $expectedType,
bool $expectedHandled,
array $expectedData
): void {
$exceptionMechanism = new ExceptionMechanism(...$constructorArgs);
$this->assertSame($expectedType, $exceptionMechanism->getType());
$this->assertSame($expectedHandled, $exceptionMechanism->isHandled());
$this->assertSame($expectedData, $exceptionMechanism->getData());
}
public static function constructorDataProvider(): iterable
{
yield [
[
ExceptionMechanism::TYPE_GENERIC,
true,
],
ExceptionMechanism::TYPE_GENERIC,
true,
[],
];
yield [
[
'custom',
false,
['key' => 'value'],
],
'custom',
false,
['key' => 'value'],
];
}
public function testSetData(): void
{
$exceptionDataBag = new ExceptionMechanism(ExceptionMechanism::TYPE_GENERIC, true, ['replace' => 'me']);
$exceptionDataBag->setData(['new' => 'value']);
$this->assertSame(['new' => 'value'], $exceptionDataBag->getData());
}
}