From c1b6da6947b14422320ee5128a643ae26e6cc916 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Mon, 23 Sep 2024 12:42:15 +0200 Subject: [PATCH] Remove calls to getExpectedException() --- .../Component/Routing/Tests/Matcher/UrlMatcherTest.php | 10 +++++----- .../Contracts/Service/Test/ServiceLocatorTestCase.php | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php index d9cfa7b1bd57a..c426e071f3b96 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php @@ -396,7 +396,7 @@ public function testMissingTrailingSlash() public function testExtraTrailingSlash() { - $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class); + $this->expectException(ResourceNotFoundException::class); $coll = new RouteCollection(); $coll->add('foo', new Route('/foo')); @@ -406,7 +406,7 @@ public function testExtraTrailingSlash() public function testMissingTrailingSlashForNonSafeMethod() { - $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class); + $this->expectException(ResourceNotFoundException::class); $coll = new RouteCollection(); $coll->add('foo', new Route('/foo/')); @@ -418,7 +418,7 @@ public function testMissingTrailingSlashForNonSafeMethod() public function testExtraTrailingSlashForNonSafeMethod() { - $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class); + $this->expectException(ResourceNotFoundException::class); $coll = new RouteCollection(); $coll->add('foo', new Route('/foo')); @@ -430,7 +430,7 @@ public function testExtraTrailingSlashForNonSafeMethod() public function testSchemeRequirement() { - $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class); + $this->expectException(ResourceNotFoundException::class); $coll = new RouteCollection(); $coll->add('foo', new Route('/foo', [], [], [], '', ['https'])); $matcher = $this->getUrlMatcher($coll); @@ -439,7 +439,7 @@ public function testSchemeRequirement() public function testSchemeRequirementForNonSafeMethod() { - $this->getExpectedException() ?: $this->expectException(ResourceNotFoundException::class); + $this->expectException(ResourceNotFoundException::class); $coll = new RouteCollection(); $coll->add('foo', new Route('/foo', [], [], [], '', ['https'])); diff --git a/src/Symfony/Contracts/Service/Test/ServiceLocatorTestCase.php b/src/Symfony/Contracts/Service/Test/ServiceLocatorTestCase.php index a6b87eb552fe7..fdd5b2793d72b 100644 --- a/src/Symfony/Contracts/Service/Test/ServiceLocatorTestCase.php +++ b/src/Symfony/Contracts/Service/Test/ServiceLocatorTestCase.php @@ -75,10 +75,8 @@ public function testThrowsOnUndefinedInternalService() 'foo' => function () use (&$locator) { return $locator->get('bar'); }, ]); - if (!$this->getExpectedException()) { - $this->expectException(NotFoundExceptionInterface::class); - $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.'); - } + $this->expectException(NotFoundExceptionInterface::class); + $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.'); $locator->get('foo'); }