Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@..
Decoded Output download
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator\Debug;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
class TraceableAuthenticatorTest extends TestCase
{
public function testGetInfo()
{
$request = new Request();
$passport = new SelfValidatingPassport(new UserBadge('robin', function () {}));
$authenticator = $this->createMock(AuthenticatorInterface::class);
$authenticator
->expects($this->once())
->method('authenticate')
->with($request)
->willReturn($passport);
$traceable = new TraceableAuthenticator($authenticator);
$this->assertSame($passport, $traceable->authenticate($request));
$this->assertSame($passport, $traceable->getInfo()['passport']);
}
public function testGetInfoWithoutAuth()
{
$authenticator = $this->createMock(AuthenticatorInterface::class);
$traceable = new TraceableAuthenticator($authenticator);
$this->assertNull($traceable->getInfo()['passport']);
$this->assertIsArray($traceable->getInfo()['badges']);
$this->assertSame([], $traceable->getInfo()['badges']);
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator\Debug;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
class TraceableAuthenticatorTest extends TestCase
{
public function testGetInfo()
{
$request = new Request();
$passport = new SelfValidatingPassport(new UserBadge('robin', function () {}));
$authenticator = $this->createMock(AuthenticatorInterface::class);
$authenticator
->expects($this->once())
->method('authenticate')
->with($request)
->willReturn($passport);
$traceable = new TraceableAuthenticator($authenticator);
$this->assertSame($passport, $traceable->authenticate($request));
$this->assertSame($passport, $traceable->getInfo()['passport']);
}
public function testGetInfoWithoutAuth()
{
$authenticator = $this->createMock(AuthenticatorInterface::class);
$traceable = new TraceableAuthenticator($authenticator);
$this->assertNull($traceable->getInfo()['passport']);
$this->assertIsArray($traceable->getInfo()['badges']);
$this->assertSame([], $traceable->getInfo()['badges']);
}
}
Function Calls
None |
Stats
MD5 | 90122a9aeeb5b7870b9ba3c329173079 |
Eval Count | 0 |
Decode Time | 88 ms |