Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e709469

Browse files
Fix unit tests
1 parent bef7b43 commit e709469

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
18+
use Symfony\Component\HttpKernel\Exception\HttpException;
1819
use Symfony\Component\HttpKernel\HttpKernelInterface;
1920
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
2021
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@@ -30,15 +31,15 @@ class ExceptionListenerTest extends TestCase
3031
/**
3132
* @dataProvider getAuthenticationExceptionProvider
3233
*/
33-
public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException = null)
34+
public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException)
3435
{
3536
$event = $this->createEvent($exception);
3637

3738
$listener = $this->createExceptionListener();
3839
$listener->onKernelException($event);
3940

4041
$this->assertNull($event->getResponse());
41-
$this->assertSame(null === $eventException ? $exception : $eventException, $event->getException());
42+
$this->assertEquals($eventException, $event->getException(), 'Objects are not the same: expected "'.get_class($eventException).'", got "'.get_class($event->getException()).'".');
4243
}
4344

4445
/**
@@ -63,11 +64,11 @@ public function testAuthenticationExceptionWithEntryPoint(\Exception $exception)
6364
public function getAuthenticationExceptionProvider()
6465
{
6566
return array(
66-
array(new AuthenticationException()),
67-
array(new \LogicException('random', 0, $e = new AuthenticationException()), $e),
68-
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), $e),
69-
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), $e),
70-
array(new AuthenticationException('random', 0, new \LogicException())),
67+
array($e = new AuthenticationException(), new HttpException(401, '', $e, array(), 0)),
68+
array(new \LogicException('random', 0, $e = new AuthenticationException()), new HttpException(401, '', $e, array(), 0)),
69+
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), new HttpException(401, 'embed', $e, array(), 0)),
70+
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), new HttpException(401, 'embed', $e, array(), 0)),
71+
array($e = new AuthenticationException('random', 0, new \LogicException()), new HttpException(401, 'random', $e, array(), 0)),
7172
);
7273
}
7374

0 commit comments

Comments
 (0)