Skip to content

Commit d1b6d76

Browse files
authored
Add support for PHPUnit 10 (#794)
1 parent 90fd313 commit d1b6d76

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
}
3434
},
3535
"require-dev": {
36-
"phpunit/phpunit": "^8.4 | ^9.3",
36+
"phpunit/phpunit": "^8.4 | ^9.3 | ^10.4",
3737
"laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0",
3838
"orchestra/testbench": "^4.7 | ^5.1 | ^6.0 | ^7.0 | ^8.0",
3939
"friendsofphp/php-cs-fixer": "^3.11",

test/Sentry/Integration/ExceptionContextIntegrationTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testInvoke(Exception $exception, ?array $expectedContext): void
3737
});
3838
}
3939

40-
public function invokeDataProvider(): iterable
40+
public static function invokeDataProvider(): iterable
4141
{
4242
yield 'Exception without context method -> no exception context' => [
4343
new Exception('Exception without context.'),
@@ -47,17 +47,17 @@ public function invokeDataProvider(): iterable
4747
$context = ['some' => 'context'];
4848

4949
yield 'Exception with context method returning array of context' => [
50-
$this->generateExceptionWithContext($context),
50+
self::generateExceptionWithContext($context),
5151
$context,
5252
];
5353

5454
yield 'Exception with context method returning string of context' => [
55-
$this->generateExceptionWithContext('Invalid context, expects array'),
55+
self::generateExceptionWithContext('Invalid context, expects array'),
5656
null,
5757
];
5858
}
5959

60-
private function generateExceptionWithContext($context): Exception
60+
private static function generateExceptionWithContext($context): Exception
6161
{
6262
return new class($context) extends Exception {
6363
private $context;

test/Sentry/LogChannelTest.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ public function testHandlerWritingExpectedEventsAndContext(array $context, calla
5757
$asserter($lastEvent);
5858
}
5959

60-
public function handlerDataProvider(): iterable
60+
public static function handlerDataProvider(): iterable
6161
{
6262
$context = ['foo' => 'bar'];
6363

6464
yield [
6565
$context,
6666
function (Event $event) use ($context) {
67-
$this->assertEquals($context, $event->getExtra()['log_context']);
67+
self::assertEquals($context, $event->getExtra()['log_context']);
6868
},
6969
];
7070

@@ -73,8 +73,8 @@ function (Event $event) use ($context) {
7373
yield [
7474
$context,
7575
function (Event $event) use ($context) {
76-
$this->assertEquals($context['fingerprint'], $event->getFingerprint());
77-
$this->assertEmpty($event->getExtra());
76+
self::assertEquals($context['fingerprint'], $event->getFingerprint());
77+
self::assertEmpty($event->getExtra());
7878
},
7979
];
8080

@@ -83,8 +83,8 @@ function (Event $event) use ($context) {
8383
yield [
8484
$context,
8585
function (Event $event) use ($context) {
86-
$this->assertNull($event->getUser());
87-
$this->assertEquals($context, $event->getExtra()['log_context']);
86+
self::assertNull($event->getUser());
87+
self::assertEquals($context, $event->getExtra()['log_context']);
8888
},
8989
];
9090

@@ -93,9 +93,9 @@ function (Event $event) use ($context) {
9393
yield [
9494
$context,
9595
function (Event $event) {
96-
$this->assertNotNull($event->getUser());
97-
$this->assertEquals(123, $event->getUser()->getId());
98-
$this->assertEmpty($event->getExtra());
96+
self::assertNotNull($event->getUser());
97+
self::assertEquals(123, $event->getUser()->getId());
98+
self::assertEmpty($event->getExtra());
9999
},
100100
];
101101

@@ -107,11 +107,11 @@ function (Event $event) {
107107
yield [
108108
$context,
109109
function (Event $event) {
110-
$this->assertSame([
110+
self::assertSame([
111111
'foo' => 'bar',
112112
'bar' => '123',
113113
], $event->getTags());
114-
$this->assertEmpty($event->getExtra());
114+
self::assertEmpty($event->getExtra());
115115
},
116116
];
117117
}

0 commit comments

Comments
 (0)