From ff176de56a36fa49c7a63677038b9865fc4dd68a Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sun, 27 Dec 2020 00:49:32 +0100 Subject: [PATCH 01/10] CS: Apply ternary_to_null_coalescing fixer --- Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client.php b/Client.php index ce6e34ea..7e95ebc4 100644 --- a/Client.php +++ b/Client.php @@ -157,7 +157,7 @@ public function setServerParameter($key, $value) */ public function getServerParameter($key, $default = '') { - return isset($this->server[$key]) ? $this->server[$key] : $default; + return $this->server[$key] ?? $default; } public function xmlHttpRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): Crawler @@ -671,7 +671,7 @@ protected function getAbsoluteUri($uri) } else { $currentUri = sprintf('http%s://%s/', isset($this->server['HTTPS']) ? 's' : '', - isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : 'localhost' + $this->server['HTTP_HOST'] ?? 'localhost' ); } From 1dfe37c6a7df12d773868933582dd9366e971ad0 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 1 Jan 2021 10:24:35 +0100 Subject: [PATCH 02/10] Bump license year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9e936ec0..9ff2d0d6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2020 Fabien Potencier +Copyright (c) 2004-2021 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 12ae595168105bdce8a8587caf974cd1ddd8110d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 5 Jan 2021 10:01:01 +0100 Subject: [PATCH 03/10] fix code style --- Tests/RequestTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/RequestTest.php b/Tests/RequestTest.php index 5d7c7d6b..a7327b0f 100644 --- a/Tests/RequestTest.php +++ b/Tests/RequestTest.php @@ -52,7 +52,7 @@ public function testGetServer() $this->assertEquals(['foo' => 'bar'], $request->getServer(), '->getServer() returns the server parameters of the request'); } - public function testAllParameterValuesAreConvertedToString(): void + public function testAllParameterValuesAreConvertedToString() { $parameters = [ 'foo' => 1, From 593508ecc674e6e6216481908faf9b9065a9d9a8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 10 Jan 2021 09:16:05 +0100 Subject: [PATCH 04/10] Improve composer.json descriptions --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ca81670e..f2a3fb1e 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "symfony/browser-kit", "type": "library", - "description": "Symfony BrowserKit Component", + "description": "Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically", "keywords": [], "homepage": "https://symfony.com", "license": "MIT", From ad51ab6a7531f59aab7f79dbd18f607b2cfd63cd Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 10 Jan 2021 13:29:43 +0100 Subject: [PATCH 05/10] Use ::class keyword when possible --- Tests/HttpBrowserTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/HttpBrowserTest.php b/Tests/HttpBrowserTest.php index 1397d9b1..4cd44aff 100644 --- a/Tests/HttpBrowserTest.php +++ b/Tests/HttpBrowserTest.php @@ -73,7 +73,7 @@ public function testMultiPartRequestWithSingleFile() ->method('request') ->with('POST', 'http://example.com/', $this->callback(function ($options) { $this->assertStringContainsString('Content-Type: multipart/form-data', implode('', $options['headers'])); - $this->assertInstanceOf('\Generator', $options['body']); + $this->assertInstanceOf(\Generator::class, $options['body']); $this->assertStringContainsString('my_file', implode('', iterator_to_array($options['body']))); return true; @@ -183,7 +183,7 @@ protected function expectClientToSendRequestWithFiles(HttpClientInterface $clien ->method('request') ->with('POST', 'http://example.com/', $this->callback(function ($options) use ($fileContents) { $this->assertStringContainsString('Content-Type: multipart/form-data', implode('', $options['headers'])); - $this->assertInstanceOf('\Generator', $options['body']); + $this->assertInstanceOf(\Generator::class, $options['body']); $body = implode('', iterator_to_array($options['body'], false)); foreach ($fileContents as $content) { $this->assertStringContainsString($content, $body); @@ -201,7 +201,7 @@ protected function expectClientToNotSendRequestWithFiles(HttpClientInterface $cl ->method('request') ->with('POST', 'http://example.com/', $this->callback(function ($options) use ($fileContents) { $this->assertStringContainsString('Content-Type: multipart/form-data', implode('', $options['headers'])); - $this->assertInstanceOf('\Generator', $options['body']); + $this->assertInstanceOf(\Generator::class, $options['body']); $body = implode('', iterator_to_array($options['body'], false)); foreach ($fileContents as $content) { $this->assertStringNotContainsString($content, $body); From 003b6e0038018f9a230ae053b04ce2dcc126997d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 11 Jan 2021 09:47:58 +0100 Subject: [PATCH 06/10] Use ::class keyword when possible --- Client.php | 4 ++-- Tests/AbstractBrowserTest.php | 16 ++++++++-------- Tests/CookieJarTest.php | 10 +++++----- Tests/CookieTest.php | 6 +++--- Tests/HistoryTest.php | 6 +++--- Tests/TestClient.php | 2 +- Tests/TestHttpClient.php | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Client.php b/Client.php index 7e95ebc4..b20ccdc8 100644 --- a/Client.php +++ b/Client.php @@ -117,7 +117,7 @@ public function getMaxRedirects() */ public function insulate($insulated = true) { - if ($insulated && !class_exists('Symfony\\Component\\Process\\Process')) { + if ($insulated && !class_exists(\Symfony\Component\Process\Process::class)) { throw new \LogicException('Unable to isolate requests as the Symfony Process Component is not installed.'); } @@ -527,7 +527,7 @@ protected function filterResponse($response) */ protected function createCrawlerFromContent($uri, $content, $type) { - if (!class_exists('Symfony\Component\DomCrawler\Crawler')) { + if (!class_exists(Crawler::class)) { return null; } diff --git a/Tests/AbstractBrowserTest.php b/Tests/AbstractBrowserTest.php index ca3d18a9..716ad880 100644 --- a/Tests/AbstractBrowserTest.php +++ b/Tests/AbstractBrowserTest.php @@ -89,7 +89,7 @@ public function testGetResponse() $client->request('GET', 'http://example.com/'); $this->assertSame('foo', $client->getResponse()->getContent(), '->getCrawler() returns the Response of the last request'); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse(), '->getCrawler() returns the Response of the last request'); + $this->assertInstanceOf(Response::class, $client->getResponse(), '->getCrawler() returns the Response of the last request'); } /** @@ -300,7 +300,7 @@ public function testClickLinkNotFound() $client->clickLink('foo'); $this->fail('->clickLink() throws a \InvalidArgumentException if the link could not be found'); } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '->clickLink() throws a \InvalidArgumentException if the link could not be found'); + $this->assertInstanceOf(\InvalidArgumentException::class, $e, '->clickLink() throws a \InvalidArgumentException if the link could not be found'); } } @@ -359,7 +359,7 @@ public function testSubmitFormNotFound() ], 'POST'); $this->fail('->submitForm() throws a \InvalidArgumentException if the form could not be found'); } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '->submitForm() throws a \InvalidArgumentException if the form could not be found'); + $this->assertInstanceOf(\InvalidArgumentException::class, $e, '->submitForm() throws a \InvalidArgumentException if the form could not be found'); } } @@ -410,7 +410,7 @@ public function testFollowRedirect() $client->followRedirect(); $this->fail('->followRedirect() throws a \LogicException if the request was not redirected'); } catch (\Exception $e) { - $this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected'); + $this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request was not redirected'); } $client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected'])); @@ -440,7 +440,7 @@ public function testFollowRedirect() $client->followRedirect(); $this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code'); } catch (\Exception $e) { - $this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code'); + $this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code'); } } @@ -470,7 +470,7 @@ public function testFollowRedirectWithMaxRedirects() $client->followRedirect(); $this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached'); } catch (\Exception $e) { - $this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached'); + $this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached'); } $client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected'])); @@ -753,7 +753,7 @@ public function testInsulatedRequests() $client->request('GET', 'http://www.example.com/foo/foobar'); $this->fail('->request() throws a \RuntimeException if the script has an error'); } catch (\Exception $e) { - $this->assertInstanceOf('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error'); + $this->assertInstanceOf(\RuntimeException::class, $e, '->request() throws a \RuntimeException if the script has an error'); } } @@ -841,7 +841,7 @@ public function testInternalRequest() 'NEW_SERVER_KEY' => 'new-server-key-value', ]); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Request', $client->getInternalRequest()); + $this->assertInstanceOf(\Symfony\Component\BrowserKit\Request::class, $client->getInternalRequest()); } /** diff --git a/Tests/CookieJarTest.php b/Tests/CookieJarTest.php index d88f0234..414f5dc6 100644 --- a/Tests/CookieJarTest.php +++ b/Tests/CookieJarTest.php @@ -77,8 +77,8 @@ public function testUpdateFromSetCookie() $cookieJar->set(new Cookie('bar', 'bar')); $cookieJar->updateFromSetCookie($setCookies); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $cookieJar->get('foo')); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $cookieJar->get('bar')); + $this->assertInstanceOf(Cookie::class, $cookieJar->get('foo')); + $this->assertInstanceOf(Cookie::class, $cookieJar->get('bar')); $this->assertEquals('foo', $cookieJar->get('foo')->getValue(), '->updateFromSetCookie() updates cookies from a Set-Cookie header'); $this->assertEquals('bar', $cookieJar->get('bar')->getValue(), '->updateFromSetCookie() keeps existing cookies'); } @@ -103,9 +103,9 @@ public function testUpdateFromSetCookieWithMultipleCookies() $barCookie = $cookieJar->get('bar', '/', '.blog.symfony.com'); $phpCookie = $cookieJar->get('PHPSESSID'); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $fooCookie); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $barCookie); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $phpCookie); + $this->assertInstanceOf(Cookie::class, $fooCookie); + $this->assertInstanceOf(Cookie::class, $barCookie); + $this->assertInstanceOf(Cookie::class, $phpCookie); $this->assertEquals('foo', $fooCookie->getValue()); $this->assertEquals('bar', $barCookie->getValue()); $this->assertEquals('id', $phpCookie->getValue()); diff --git a/Tests/CookieTest.php b/Tests/CookieTest.php index 6318cae2..72f69e06 100644 --- a/Tests/CookieTest.php +++ b/Tests/CookieTest.php @@ -103,7 +103,7 @@ public function testFromStringWithUrl() public function testFromStringThrowsAnExceptionIfCookieIsNotValid() { - $this->expectException('InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); Cookie::fromString('foo'); } @@ -116,7 +116,7 @@ public function testFromStringIgnoresInvalidExpiresDate() public function testFromStringThrowsAnExceptionIfUrlIsNotValid() { - $this->expectException('InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); Cookie::fromString('foo=bar', 'foobar'); } @@ -199,7 +199,7 @@ public function testIsExpired() public function testConstructException() { - $this->expectException('UnexpectedValueException'); + $this->expectException(\UnexpectedValueException::class); $this->expectExceptionMessage('The cookie expiration time "string" is not valid.'); new Cookie('foo', 'bar', 'string'); } diff --git a/Tests/HistoryTest.php b/Tests/HistoryTest.php index aa09b05b..8f3cfae1 100644 --- a/Tests/HistoryTest.php +++ b/Tests/HistoryTest.php @@ -55,7 +55,7 @@ public function testCurrent() $history->current(); $this->fail('->current() throws a \LogicException if the history is empty'); } catch (\Exception $e) { - $this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is empty'); + $this->assertInstanceOf(\LogicException::class, $e, '->current() throws a \LogicException if the history is empty'); } $history->add(new Request('http://www.example.com/', 'get')); @@ -72,7 +72,7 @@ public function testBack() $history->back(); $this->fail('->back() throws a \LogicException if the history is already on the first page'); } catch (\Exception $e) { - $this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is already on the first page'); + $this->assertInstanceOf(\LogicException::class, $e, '->current() throws a \LogicException if the history is already on the first page'); } $history->add(new Request('http://www.example1.com/', 'get')); @@ -91,7 +91,7 @@ public function testForward() $history->forward(); $this->fail('->forward() throws a \LogicException if the history is already on the last page'); } catch (\Exception $e) { - $this->assertInstanceOf('LogicException', $e, '->forward() throws a \LogicException if the history is already on the last page'); + $this->assertInstanceOf(\LogicException::class, $e, '->forward() throws a \LogicException if the history is already on the last page'); } $history->back(); diff --git a/Tests/TestClient.php b/Tests/TestClient.php index 0efa48b9..64e4937e 100644 --- a/Tests/TestClient.php +++ b/Tests/TestClient.php @@ -43,7 +43,7 @@ protected function doRequest($request): Response protected function getScript($request) { - $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); + $r = new \ReflectionClass(Response::class); $path = $r->getFileName(); return <<getFileName(); return << Date: Mon, 11 Jan 2021 11:11:08 +0100 Subject: [PATCH 07/10] Use ::class keyword when possible --- AbstractBrowser.php | 4 ++-- Tests/AbstractBrowserTest.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/AbstractBrowser.php b/AbstractBrowser.php index 4ccccf55..977dd28a 100644 --- a/AbstractBrowser.php +++ b/AbstractBrowser.php @@ -111,7 +111,7 @@ public function getMaxRedirects() */ public function insulate(bool $insulated = true) { - if ($insulated && !class_exists('Symfony\\Component\\Process\\Process')) { + if ($insulated && !class_exists(\Symfony\Component\Process\Process::class)) { throw new \LogicException('Unable to isolate requests as the Symfony Process Component is not installed.'); } @@ -503,7 +503,7 @@ protected function filterResponse($response) */ protected function createCrawlerFromContent(string $uri, string $content, string $type) { - if (!class_exists('Symfony\Component\DomCrawler\Crawler')) { + if (!class_exists(Crawler::class)) { return null; } diff --git a/Tests/AbstractBrowserTest.php b/Tests/AbstractBrowserTest.php index 127f1b44..4e2697f5 100644 --- a/Tests/AbstractBrowserTest.php +++ b/Tests/AbstractBrowserTest.php @@ -45,7 +45,7 @@ public function testGetRequest() public function testGetRequestNull() { - $this->expectException('Symfony\Component\BrowserKit\Exception\BadMethodCallException'); + $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getRequest()".'); $client = $this->getBrowser(); @@ -82,7 +82,7 @@ public function testGetResponse() public function testGetResponseNull() { - $this->expectException('Symfony\Component\BrowserKit\Exception\BadMethodCallException'); + $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getResponse()".'); $client = $this->getBrowser(); @@ -91,7 +91,7 @@ public function testGetResponseNull() public function testGetInternalResponseNull() { - $this->expectException('Symfony\Component\BrowserKit\Exception\BadMethodCallException'); + $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalResponse()".'); $client = $this->getBrowser(); @@ -118,7 +118,7 @@ public function testGetCrawler() public function testGetCrawlerNull() { - $this->expectException('Symfony\Component\BrowserKit\Exception\BadMethodCallException'); + $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getCrawler()".'); $client = $this->getBrowser(); @@ -831,7 +831,7 @@ public function testInternalRequest() public function testInternalRequestNull() { - $this->expectException('Symfony\Component\BrowserKit\Exception\BadMethodCallException'); + $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalRequest()".'); $client = $this->getBrowser(); From cd17e93af25cbb9551f7c74b53f807777fa6d3c8 Mon Sep 17 00:00:00 2001 From: Simon Berger Date: Sun, 24 Jan 2021 23:22:56 +0100 Subject: [PATCH 08/10] Changed private static array-properties to const --- Cookie.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cookie.php b/Cookie.php index e0232e51..77b330c0 100644 --- a/Cookie.php +++ b/Cookie.php @@ -22,7 +22,7 @@ class Cookie * Handles dates as defined by RFC 2616 section 3.3.1, and also some other * non-standard, but common formats. */ - private static $dateFormats = [ + private const DATE_FORMATS = [ 'D, d M Y H:i:s T', 'D, d-M-y H:i:s T', 'D, d-M-Y H:i:s T', @@ -92,7 +92,7 @@ public function __toString() if (null !== $this->expires) { $dateTime = \DateTime::createFromFormat('U', $this->expires, new \DateTimeZone('GMT')); - $cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0])); + $cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::DATE_FORMATS[0])); } if ('' !== $this->domain) { @@ -208,7 +208,7 @@ private static function parseDate(string $dateValue): ?string $dateValue = substr($dateValue, 1, -1); } - foreach (self::$dateFormats as $dateFormat) { + foreach (self::DATE_FORMATS as $dateFormat) { if (false !== $date = \DateTime::createFromFormat($dateFormat, $dateValue, new \DateTimeZone('GMT'))) { return $date->format('U'); } From f6f060bdc473c3f3b1f00e2ebdeb3d02eda77f82 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Fri, 22 Jan 2021 13:09:22 +0100 Subject: [PATCH 09/10] Use createMock() and use import instead of FQCN --- Tests/AbstractBrowserTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/AbstractBrowserTest.php b/Tests/AbstractBrowserTest.php index 716ad880..1e4b51fa 100644 --- a/Tests/AbstractBrowserTest.php +++ b/Tests/AbstractBrowserTest.php @@ -15,6 +15,7 @@ use Symfony\Component\BrowserKit\Client; use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\History; +use Symfony\Component\BrowserKit\Request; use Symfony\Component\BrowserKit\Response; class AbstractBrowserTest extends TestCase @@ -841,7 +842,7 @@ public function testInternalRequest() 'NEW_SERVER_KEY' => 'new-server-key-value', ]); - $this->assertInstanceOf(\Symfony\Component\BrowserKit\Request::class, $client->getInternalRequest()); + $this->assertInstanceOf(Request::class, $client->getInternalRequest()); } /** From 8d0688f6f7c733ff4096d64656c8a3b320d9a1f8 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 27 Jan 2021 13:50:07 +0100 Subject: [PATCH 10/10] Use import instead of FQCN --- Tests/AbstractBrowserTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Tests/AbstractBrowserTest.php b/Tests/AbstractBrowserTest.php index 622aaf8c..b71f5454 100644 --- a/Tests/AbstractBrowserTest.php +++ b/Tests/AbstractBrowserTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\BrowserKit\CookieJar; +use Symfony\Component\BrowserKit\Exception\BadMethodCallException; use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\Request; use Symfony\Component\BrowserKit\Response; @@ -46,7 +47,7 @@ public function testGetRequest() public function testGetRequestNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getRequest()".'); $client = $this->getBrowser(); @@ -83,7 +84,7 @@ public function testGetResponse() public function testGetResponseNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getResponse()".'); $client = $this->getBrowser(); @@ -92,7 +93,7 @@ public function testGetResponseNull() public function testGetInternalResponseNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalResponse()".'); $client = $this->getBrowser(); @@ -119,7 +120,7 @@ public function testGetCrawler() public function testGetCrawlerNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getCrawler()".'); $client = $this->getBrowser(); @@ -832,7 +833,7 @@ public function testInternalRequest() public function testInternalRequestNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalRequest()".'); $client = $this->getBrowser();