8000 minor #58358 Remove calls to `getExpectedException()` (derrabus) · symfony/symfony@e1bd3cf · GitHub
[go: up one dir, main page]

Skip to content

Commit e1bd3cf

Browse files
committed
minor #58358 Remove calls to getExpectedException() (derrabus)
This PR was merged into the 7.2 branch. Discussion ---------- Remove calls to `getExpectedException()` | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT PHPUnit 11 does not allow us to query anymore whether we already expect an exception. We call the now-removed method `getExpectedException()` several times, but I could not really figure out why we do that. The simplest fix would be to remove the calls. As far as I can tell, our tests pass without them. Commits ------- c1b6da6 Remove calls to getExpectedException()
2 parents db47683 + c1b6da6 commit e1bd3cf

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public function testMissingTrailingSlash()
396396

397397
public function testExtraTrailingSlash()
398398
{
399-
$this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
399+
$this->expectException(ResourceNotFoundException::class);
400400
$coll = new RouteCollection();
401401
$coll->add('foo', new Route('/foo'));
402402

@@ -406,7 +406,7 @@ public function testExtraTrailingSlash()
406406

407407
public function testMissingTrailingSlashForNonSafeMethod()
408408
{
409-
$this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
409+
$this->expectException(ResourceNotFoundException::class);
410410
$coll = new RouteCollection();
411411
$coll->add('foo', new Route('/foo/'));
412412

@@ -418,7 +418,7 @@ public function testMissingTrailingSlashForNonSafeMethod()
418418

419419
public function testExtraTrailingSlashForNonSafeMethod()
420420
{
421-
$this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
421+
$this->expectException(ResourceNotFoundException::class);
422422
$coll = new RouteCollection();
423423
$coll->add('foo', new Route('/foo'));
424424

@@ -430,7 +430,7 @@ public function test 8000 ExtraTrailingSlashForNonSafeMethod()
430430

431431
public function testSchemeRequirement()
432432
{
433-
$this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
433+
$this->expectException(ResourceNotFoundException::class);
434434
$coll = new RouteCollection();
435435
$coll->add('foo', new Route('/foo', [], [], [], '', ['https']));
436436
$matcher = $this->getUrlMatcher($coll);
@@ -439,7 +439,7 @@ public function testSchemeRequirement()
439439

440440
public function testSchemeRequirementForNonSafeMethod()
441441
{
442-
$this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class);
442+
$this->expectException(ResourceNotFoundException::class);
443443
$coll = new RouteCollection();
444444
$coll->add('foo', new Route('/foo', [], [], [], '', ['https']));
445445

src/Symfony/Contracts/Service/Test/ServiceLocatorTestCase.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ public function testThrowsOnUndefinedInternalService()
7575
'foo' => function () use (&$locator) { return $locator->get('bar'); },
7676
]);
7777

78-
if (!$this->getExpectedException()) {
79-
$this->expectException(NotFoundExceptionInterface::class);
80-
$this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
81-
}
78+
$this->expectException(NotFoundExceptionInterface::class);
79+
$this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
8280

8381
$locator->get('foo');
8482
}

0 commit comments

Comments
 (0)
0