Skip to content

Commit d671872

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: Use ::class keyword when possible
2 parents c6b117e + d436825 commit d671872

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

Tests/AbstractBrowserTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testGetResponse()
7777
$client->request('GET', 'http://example.com/');
7878

7979
$this->assertSame('foo', $client->getResponse()->getContent(), '->getCrawler() returns the Response of the last request');
80-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse(), '->getCrawler() returns the Response of the last request');
80+
$this->assertInstanceOf(Response::class, $client->getResponse(), '->getCrawler() returns the Response of the last request');
8181
}
8282

8383
public function testGetResponseNull()
@@ -285,7 +285,7 @@ public function testClickLinkNotFound()
285285
$client->clickLink('foo');
286286
$this->fail('->clickLink() throws a \InvalidArgumentException if the link could not be found');
287287
} catch (\Exception $e) {
288-
$this->assertInstanceOf('InvalidArgumentException', $e, '->clickLink() throws a \InvalidArgumentException if the link could not be found');
288+
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '->clickLink() throws a \InvalidArgumentException if the link could not be found');
289289
}
290290
}
291291

@@ -344,7 +344,7 @@ public function testSubmitFormNotFound()
344344
], 'POST');
345345
$this->fail('->submitForm() throws a \InvalidArgumentException if the form could not be found');
346346
} catch (\Exception $e) {
347-
$this->assertInstanceOf('InvalidArgumentException', $e, '->submitForm() throws a \InvalidArgumentException if the form could not be found');
347+
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '->submitForm() throws a \InvalidArgumentException if the form could not be found');
348348
}
349349
}
350350

@@ -395,7 +395,7 @@ public function testFollowRedirect()
395395
$client->followRedirect();
396396
$this->fail('->followRedirect() throws a \LogicException if the request was not redirected');
397397
} catch (\Exception $e) {
398-
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected');
398+
$this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request was not redirected');
399399
}
400400

401401
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
@@ -425,7 +425,7 @@ public function testFollowRedirect()
425425
$client->followRedirect();
426426
$this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
427427
} catch (\Exception $e) {
428-
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
428+
$this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
429429
}
430430
}
431431

@@ -455,7 +455,7 @@ public function testFollowRedirectWithMaxRedirects()
455455
$client->followRedirect();
456456
$this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
457457
} catch (\Exception $e) {
458-
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
458+
$this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
459459
}
460460

461461
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
@@ -738,7 +738,7 @@ public function testInsulatedRequests()
738738
$client->request('GET', 'http://www.example.com/foo/foobar');
739739
$this->fail('->request() throws a \RuntimeException if the script has an error');
740740
} catch (\Exception $e) {
741-
$this->assertInstanceOf('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
741+
$this->assertInstanceOf(\RuntimeException::class, $e, '->request() throws a \RuntimeException if the script has an error');
742742
}
743743
}
744744

@@ -826,7 +826,7 @@ public function testInternalRequest()
826826
'NEW_SERVER_KEY' => 'new-server-key-value',
827827
]);
828828

829-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Request', $client->getInternalRequest());
829+
$this->assertInstanceOf(\Symfony\Component\BrowserKit\Request::class, $client->getInternalRequest());
830830
}
831831

832832
public function testInternalRequestNull()

Tests/CookieJarTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public function testUpdateFromSetCookie()
7777
$cookieJar->set(new Cookie('bar', 'bar'));
7878
$cookieJar->updateFromSetCookie($setCookies);
7979

80-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $cookieJar->get('foo'));
81-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $cookieJar->get('bar'));
80+
$this->assertInstanceOf(Cookie::class, $cookieJar->get('foo'));
81+
$this->assertInstanceOf(Cookie::class, $cookieJar->get('bar'));
8282
$this->assertEquals('foo', $cookieJar->get('foo')->getValue(), '->updateFromSetCookie() updates cookies from a Set-Cookie header');
8383
$this->assertEquals('bar', $cookieJar->get('bar')->getValue(), '->updateFromSetCookie() keeps existing cookies');
8484
}
@@ -103,9 +103,9 @@ public function testUpdateFromSetCookieWithMultipleCookies()
103103
$barCookie = $cookieJar->get('bar', '/', '.blog.symfony.com');
104104
$phpCookie = $cookieJar->get('PHPSESSID');
105105

106-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $fooCookie);
107-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $barCookie);
108-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $phpCookie);
106+
$this->assertInstanceOf(Cookie::class, $fooCookie);
107+
$this->assertInstanceOf(Cookie::class, $barCookie);
108+
$this->assertInstanceOf(Cookie::class, $phpCookie);
109109
$this->assertEquals('foo', $fooCookie->getValue());
110110
$this->assertEquals('bar', $barCookie->getValue());
111111
$this->assertEquals('id', $phpCookie->getValue());

Tests/CookieTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function testFromStringWithUrl()
104104

105105
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
106106
{
107-
$this->expectException('InvalidArgumentException');
107+
$this->expectException(\InvalidArgumentException::class);
108108
Cookie::fromString('foo');
109109
}
110110

@@ -117,7 +117,7 @@ public function testFromStringIgnoresInvalidExpiresDate()
117117

118118
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
119119
{
120-
$this->expectException('InvalidArgumentException');
120+
$this->expectException(\InvalidArgumentException::class);
121121
Cookie::fromString('foo=bar', 'foobar');
122122
}
123123

@@ -200,7 +200,7 @@ public function testIsExpired()
200200

201201
public function testConstructException()
202202
{
203-
$this->expectException('UnexpectedValueException');
203+
$this->expectException(\UnexpectedValueException::class);
204204
$this->expectExceptionMessage('The cookie expiration time "string" is not valid.');
205205
new Cookie('foo', 'bar', 'string');
206206
}

Tests/HistoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testCurrent()
5555
$history->current();
5656
$this->fail('->current() throws a \LogicException if the history is empty');
5757
} catch (\Exception $e) {
58-
$this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is empty');
58+
$this->assertInstanceOf(\LogicException::class, $e, '->current() throws a \LogicException if the history is empty');
5959
}
6060

6161
$history->add(new Request('http://www.example.com/', 'get'));
@@ -72,7 +72,7 @@ public function testBack()
7272
$history->back();
7373
$this->fail('->back() throws a \LogicException if the history is already on the first page');
7474
} catch (\Exception $e) {
75-
$this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is already on the first page');
75+
$this->assertInstanceOf(\LogicException::class, $e, '->current() throws a \LogicException if the history is already on the first page');
7676
}
7777

7878
$history->add(new Request('http://www.example1.com/', 'get'));
@@ -91,7 +91,7 @@ public function testForward()
9191
$history->forward();
9292
$this->fail('->forward() throws a \LogicException if the history is already on the last page');
9393
} catch (\Exception $e) {
94-
$this->assertInstanceOf('LogicException', $e, '->forward() throws a \LogicException if the history is already on the last page');
94+
$this->assertInstanceOf(\LogicException::class, $e, '->forward() throws a \LogicException if the history is already on the last page');
9595
}
9696

9797
$history->back();

Tests/TestClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function doRequest($request): Response
4343

4444
protected function getScript($request)
4545
{
46-
$r = new \ReflectionClass('Symfony\Component\BrowserKit\Response');
46+
$r = new \ReflectionClass(Response::class);
4747
$path = $r->getFileName();
4848

4949
return <<<EOF

Tests/TestHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function doRequest($request): Response
6666

6767
protected function getScript($request)
6868
{
69-
$r = new \ReflectionClass('Symfony\Component\BrowserKit\Response');
69+
$r = new \ReflectionClass(Response::class);
7070
$path = $r->getFileName();
7171

7272
return <<<EOF

0 commit comments

Comments
 (0)