Skip to content

Commit 8bd2aa1

Browse files
committed
Use ::class keyword when possible
1 parent 78eeb0d commit 8bd2aa1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Tests/RouterTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class RouterTest extends TestCase
2626

2727
protected function setUp(): void
2828
{
29-
$this->loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock();
29+
$this->loader = $this->getMockBuilder(\Symfony\Component\Config\Loader\LoaderInterface::class)->getMock();
3030
$this->router = new Router($this->loader, 'routing.yml');
3131

3232
$this->cacheDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('router_', true);
@@ -59,7 +59,7 @@ public function testSetOptionsWithSupportedOptions()
5959

6060
public function testSetOptionsWithUnsupportedOptions()
6161
{
62-
$this->expectException('InvalidArgumentException');
62+
$this->expectException(\InvalidArgumentException::class);
6363
$this->expectExceptionMessage('The Router does not support the following options: "option_foo", "option_bar"');
6464
$this->router->setOptions([
6565
'cache_dir' => './cache',
@@ -78,14 +78,14 @@ public function testSetOptionWithSupportedOption()
7878

7979
public function testSetOptionWithUnsupportedOption()
8080
{
81-
$this->expectException('InvalidArgumentException');
81+
$this->expectException(\InvalidArgumentException::class);
8282
$this->expectExceptionMessage('The Router does not support the "option_foo" option');
8383
$this->router->setOption('option_foo', true);
8484
}
8585

8686
public function testGetOptionWithUnsupportedOption()
8787
{
88-
$this->expectException('InvalidArgumentException');
88+
$this->expectException(\InvalidArgumentException::class);
8989
$this->expectExceptionMessage('The Router does not support the "option_foo" option');
9090
$this->router->getOption('option_foo', true);
9191
}
@@ -111,7 +111,7 @@ public function testMatcherIsCreatedIfCacheIsNotConfigured()
111111
->method('load')->with('routing.yml', null)
112112
->willReturn(new RouteCollection());
113113

114-
$this->assertInstanceOf('Symfony\\Component\\Routing\\Matcher\\UrlMatcher', $this->router->getMatcher());
114+
$this->assertInstanceOf(\Symfony\Component\Routing\Matcher\UrlMatcher::class, $this->router->getMatcher());
115115
}
116116

117117
public function testGeneratorIsCreatedIfCacheIsNotConfigured()
@@ -122,12 +122,12 @@ public function testGeneratorIsCreatedIfCacheIsNotConfigured()
122122
->method('load')->with('routing.yml', null)
123123
->willReturn(new RouteCollection());
124124

125-
$this->assertInstanceOf('Symfony\\Component\\Routing\\Generator\\UrlGenerator', $this->router->getGenerator());
125+
$this->assertInstanceOf(\Symfony\Component\Routing\Generator\UrlGenerator::class, $this->router->getGenerator());
126126
}
127127

128128
public function testMatchRequestWithUrlMatcherInterface()
129129
{
130-
$matcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock();
130+
$matcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\UrlMatcherInterface::class)->getMock();
131131
$matcher->expects($this->once())->method('match');
132132

133133
$p = new \ReflectionProperty($this->router, 'matcher');
@@ -139,7 +139,7 @@ public function testMatchRequestWithUrlMatcherInterface()
139139

140140
public function testMatchRequestWithRequestMatcherInterface()
141141
{
142-
$matcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
142+
$matcher = $this->getMockBuilder(\Symfony\Component\Routing\Matcher\RequestMatcherInterface::class)->getMock();
143143
$matcher->expects($this->once())->method('matchRequest');
144144

145145
$p = new \ReflectionProperty($this->router, 'matcher');
@@ -161,7 +161,7 @@ public function testDefaultLocaleIsPassedToGeneratorClass()
161161

162162
$generator = $router->getGenerator();
163163

164-
$this->assertInstanceOf('Symfony\Component\Routing\Generator\UrlGeneratorInterface', $generator);
164+
$this->assertInstanceOf(\Symfony\Component\Routing\Generator\UrlGeneratorInterface::class, $generator);
165165

166166
$p = new \ReflectionProperty($generator, 'defaultLocale');
167167
$p->setAccessible(true);
@@ -181,7 +181,7 @@ public function testDefaultLocaleIsPassedToCompiledGeneratorCacheClass()
181181

182182
$generator = $router->getGenerator();
183183

184-
$this->assertInstanceOf('Symfony\Component\Routing\Generator\UrlGeneratorInterface', $generator);
184+
$this->assertInstanceOf(\Symfony\Component\Routing\Generator\UrlGeneratorInterface::class, $generator);
185185

186186
$p = new \ReflectionProperty($generator, 'defaultLocale');
187187
$p->setAccessible(true);

0 commit comments

Comments
 (0)