Skip to content

Commit 946c361

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: Use ::class keyword when possible
2 parents 761a38a + d671872 commit 946c361

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
@@ -88,7 +88,7 @@ public function testGetResponse()
8888
$client->request('GET', 'http://example.com/');
8989

9090
$this->assertSame('foo', $client->getResponse()->getContent(), '->getCrawler() returns the Response of the last request');
91-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse(), '->getCrawler() returns the Response of the last request');
91+
$this->assertInstanceOf(Response::class, $client->getResponse(), '->getCrawler() returns the Response of the last request');
9292
}
9393

9494
public function testGetResponseNull()
@@ -296,7 +296,7 @@ public function testClickLinkNotFound()
296296
$client->clickLink('foo');
297297
$this->fail('->clickLink() throws a \InvalidArgumentException if the link could not be found');
298298
} catch (\Exception $e) {
299-
$this->assertInstanceOf('InvalidArgumentException', $e, '->clickLink() throws a \InvalidArgumentException if the link could not be found');
299+
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '->clickLink() throws a \InvalidArgumentException if the link could not be found');
300300
}
301301
}
302302

@@ -355,7 +355,7 @@ public function testSubmitFormNotFound()
355355
], 'POST');
356356
$this->fail('->submitForm() throws a \InvalidArgumentException if the form could not be found');
357357
} catch (\Exception $e) {
358-
$this->assertInstanceOf('InvalidArgumentException', $e, '->submitForm() throws a \InvalidArgumentException if the form could not be found');
358+
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '->submitForm() throws a \InvalidArgumentException if the form could not be found');
359359
}
360360
}
361361

@@ -406,7 +406,7 @@ public function testFollowRedirect()
406406
$client->followRedirect();
407407
$this->fail('->followRedirect() throws a \LogicException if the request was not redirected');
408408
} catch (\Exception $e) {
409-
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected');
409+
$this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request was not redirected');
410410
}
411411

412412
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
@@ -436,7 +436,7 @@ public function testFollowRedirect()
436436
$client->followRedirect();
437437
$this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
438438
} catch (\Exception $e) {
439-
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
439+
$this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
440440
}
441441
}
442442

@@ -466,7 +466,7 @@ public function testFollowRedirectWithMaxRedirects()
466466
$client->followRedirect();
467467
$this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
468468
} catch (\Exception $e) {
469-
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
469+
$this->assertInstanceOf(\LogicException::class, $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
470470
}
471471

472472
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
@@ -749,7 +749,7 @@ public function testInsulatedRequests()
749749
$client->request('GET', 'http://www.example.com/foo/foobar');
750750
$this->fail('->request() throws a \RuntimeException if the script has an error');
751751
} catch (\Exception $e) {
752-
$this->assertInstanceOf('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
752+
$this->assertInstanceOf(\RuntimeException::class, $e, '->request() throws a \RuntimeException if the script has an error');
753753
}
754754
}
755755

@@ -837,7 +837,7 @@ public function testInternalRequest()
837837
'NEW_SERVER_KEY' => 'new-server-key-value',
838838
]);
839839

840-
$this->assertInstanceOf('Symfony\Component\BrowserKit\Request', $client->getInternalRequest());
840+
$this->assertInstanceOf(\Symfony\Component\BrowserKit\Request::class, $client->getInternalRequest());
841841
}
842842

843843
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)