Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 39181f4

Browse filesBrowse files
committed
Use class const in test
1 parent 039fe6a commit 39181f4
Copy full SHA for 39181f4

File tree

Expand file treeCollapse file tree

3 files changed

+15
-13
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+15
-13
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
2121
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
2222
use Symfony\Component\EventDispatcher\EventDispatcher;
23+
use Symfony\Component\HttpKernel\KernelInterface;
2324

2425
class WebProfilerExtensionTest extends TestCase
2526
{
@@ -51,7 +52,7 @@ protected function setUp(): void
5152
{
5253
parent::setUp();
5354

54-
$this->kernel = $this->getMockBuilder(\Symfony\Component\HttpKernel\KernelInterface::class)->getMock();
55+
$this->kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
5556

5657
$this->container = new ContainerBuilder();
5758
$this->container->register('error_handler.error_renderer.html', HtmlErrorRenderer::class)->setPublic(true);

‎src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
use Symfony\Component\Console\Tests\Fixtures\DummyOutput;
2121

2222
/**
23-
* Console logger test.
24-
*
2523
* @author Kévin Dunglas <dunglas@gmail.com>
2624
* @author Jordi Boggiano <j.boggiano@seld.be>
2725
*/
@@ -157,9 +155,9 @@ public function testContextReplacement()
157155
public function testObjectCastToString()
158156
{
159157
if (method_exists($this, 'createPartialMock')) {
160-
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
158+
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
161159
} else {
162-
$dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
160+
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
163161
}
164162
$dummy->method('__toString')->willReturn('DUMMY');
165163

‎src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
+11-8Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
1919
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
2020
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
21+
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2122
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
23+
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
24+
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
2225
use Symfony\Component\Security\Http\AccessMapInterface;
2326
use Symfony\Component\Security\Http\Event\LazyResponseEvent;
2427
use Symfony\Component\Security\Http\Firewall\AccessListener;
@@ -27,7 +30,7 @@ class AccessListenerTest extends TestCase
2730
{
2831
public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
2932
{
30-
$this->expectException(\Symfony\Component\Security\Core\Exception\AccessDeniedException::class);
33+
$this->expectException(AccessDeniedException::class);
3134
$request = new Request();
3235

3336
$accessMap = $this->getMockBuilder(AccessMapInterface::class)->getMock();
@@ -38,7 +41,7 @@ public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess()
3841
->willReturn([['foo' => 'bar'], null])
3942
;
4043

41-
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
44+
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
4245
$token
4346
->expects($this->any())
4447
->method('isAuthenticated')
@@ -82,14 +85,14 @@ public function testHandleWhenTheTokenIsNotAuthenticated()
8285
->willReturn([['foo' => 'bar'], null])
8386
;
8487

85-
$notAuthenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
88+
$notAuthenticatedToken = $this->getMockBuilder(TokenInterface::class)->getMock();
8689
$notAuthenticatedToken
8790
->expects($this->any())
8891
->method('isAuthenticated')
8992
->willReturn(false)
9093
;
9194

92-
$authenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
95+
$authenticatedToken = $this->getMockBuilder(TokenInterface::class)->getMock();
9396
$authenticatedToken
9497
->expects($this->any())
9598
->method('isAuthenticated')
@@ -146,7 +149,7 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest()
146149
->willReturn([null, null])
147150
;
148151

149-
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
152+
$token = $this->getMockBuilder(TokenInterface::class)->getMock();
150153
$token
151154
->expects($this->never())
152155
->method('isAuthenticated')
@@ -201,7 +204,7 @@ public function testHandleWhenAccessMapReturnsEmptyAttributes()
201204

202205
public function testHandleWhenTheSecurityTokenStorageHasNoToken()
203206
{
204-
$this->expectException(\Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException::class);
207+
$this->expectException(AuthenticationCredentialsNotFoundException::class);
205208
$tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
206209
$tokenStorage
207210
->expects($this->any())
@@ -241,7 +244,7 @@ public function testHandleMWithultipleAttributesShouldBeHandledAsAnd()
241244
->willReturn([['foo' => 'bar', 'bar' => 'baz'], null])
242245
;
243246

244-
$authenticatedToken = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class)->getMock();
247+
$authenticatedToken = $this->getMockBuilder(TokenInterface::class)->getMock();
245248
$authenticatedToken
246249
->expects($this->any())
247250
->method('isAuthenticated')
@@ -263,7 +266,7 @@ public function testHandleMWithultipleAttributesShouldBeHandledAsAnd()
263266
$tokenStorage,
264267
$accessDecisionManager,
265268
$accessMap,
266-
$this->createMock('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')
269+
$this->createMock(AuthenticationManagerInterface::class)
267270
);
268271

269272
$listener(new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MASTER_REQUEST));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.