!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/alt/php54/usr/share/pear/test/Security/Symfony/Component/Security/Http/Tests/Authentication/   drwxr-xr-x
Free 293.91 GB of 429.69 GB (68.4%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     SimpleAuthenticationHandlerTest.php (8.37 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * 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;

use 
Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
use 
Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
use 
Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use 
Symfony\Component\Security\Http\Authentication\SimpleAuthenticationHandler;

class 
SimpleAuthenticationHandlerTest extends \PHPUnit_Framework_TestCase
{
    private 
$successHandler;

    private 
$failureHandler;

    private 
$request;

    private 
$token;

    private 
$authenticationException;

    private 
$response;

    public function 
setUp()
    {
        
$this->successHandler $this->getMock('Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface');
        
$this->failureHandler $this->getMock('Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface');

        
$this->request $this->getMock('Symfony\Component\HttpFoundation\Request');
        
$this->token $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
        
$this->authenticationException $this->getMock('Symfony\Component\Security\Core\Exception\AuthenticationException');

        
$this->response $this->getMock('Symfony\Component\HttpFoundation\Response');
    }

    public function 
testOnAuthenticationSuccessFallsBackToDefaultHandlerIfSimpleIsNotASuccessHandler()
    {
        
$authenticator $this->getMock('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface');

        
$this->successHandler->expects($this->once())
            ->
method('onAuthenticationSuccess')
            ->
with($this->request$this->token)
            ->
will($this->returnValue($this->response));

        
$handler = new SimpleAuthenticationHandler($authenticator$this->successHandler$this->failureHandler);
        
$result $handler->onAuthenticationSuccess($this->request$this->token);

        
$this->assertSame($this->response$result);
    }

    public function 
testOnAuthenticationSuccessCallsSimpleAuthenticator()
    {
        
$this->successHandler->expects($this->never())
            ->
method('onAuthenticationSuccess');

        
$authenticator $this->getMockForAbstractClass('Symfony\Component\Security\Http\Tests\TestSuccessHandlerInterface');
        
$authenticator->expects($this->once())
            ->
method('onAuthenticationSuccess')
            ->
with($this->request$this->token)
            ->
will($this->returnValue($this->response));

        
$handler = new SimpleAuthenticationHandler($authenticator$this->successHandler$this->failureHandler);
        
$result $handler->onAuthenticationSuccess($this->request$this->token);

        
$this->assertSame($this->response$result);
    }

    
/**
     * @expectedException        \UnexpectedValueException
     * @expectedExceptionMessage onAuthenticationSuccess method must return null to use the default success handler, or a Response object
     */
    
public function testOnAuthenticationSuccessThrowsAnExceptionIfNonResponseIsReturned()
    {
        
$this->successHandler->expects($this->never())
            ->
method('onAuthenticationSuccess');

        
$authenticator $this->getMockForAbstractClass('Symfony\Component\Security\Http\Tests\TestSuccessHandlerInterface');
        
$authenticator->expects($this->once())
            ->
method('onAuthenticationSuccess')
            ->
with($this->request$this->token)
            ->
will($this->returnValue(new \stdClass()));

        
$handler = new SimpleAuthenticationHandler($authenticator$this->successHandler$this->failureHandler);
        
$handler->onAuthenticationSuccess($this->request$this->token);
    }

    public function 
testOnAuthenticationSuccessFallsBackToDefaultHandlerIfNullIsReturned()
    {
        
$this->successHandler->expects($this->once())
            ->
method('onAuthenticationSuccess')
            ->
with($this->request$this->token)
            ->
will($this->returnValue($this->response));

        
$authenticator $this->getMockForAbstractClass('Symfony\Component\Security\Http\Tests\TestSuccessHandlerInterface');
        
$authenticator->expects($this->once())
            ->
method('onAuthenticationSuccess')
            ->
with($this->request$this->token)
            ->
will($this->returnValue(null));

        
$handler = new SimpleAuthenticationHandler($authenticator$this->successHandler$this->failureHandler);
        
$result $handler->onAuthenticationSuccess($this->request$this->token);

        
$this->assertSame($this->response$result);
    }

    public function 
testOnAuthenticationFailureFallsBackToDefaultHandlerIfSimpleIsNotAFailureHandler()
    {
        
$authenticator $this->getMock('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface');

        
$this->failureHandler->expects($this->once())
            ->
method('onAuthenticationFailure')
            ->
with($this->request$this->authenticationException)
            ->
will($this->returnValue($this->response));

        
$handler = new SimpleAuthenticationHandler($authenticator$this->successHandler$this->failureHandler);
        
$result $handler->onAuthenticationFailure($this->request$this->authenticationException);

        
$this->assertSame($this->response$result);
    }

    public function 
testOnAuthenticationFailureCallsSimpleAuthenticator()
    {
        
$this->failureHandler->expects($this->never())
            ->
method('onAuthenticationFailure');

        
$authenticator $this->getMockForAbstractClass('Symfony\Component\Security\Http\Tests\TestFailureHandlerInterface');
        
$authenticator->expects($this->once())
            ->
method('onAuthenticationFailure')
            ->
with($this->request$this->authenticationException)
            ->
will($this->returnValue($this->response));

        
$handler = new SimpleAuthenticationHandler($authenticator$this->successHandler$this->failureHandler);
        
$result $handler->onAuthenticationFailure($this->request$this->authenticationException);

        
$this->assertSame($this->response$result);
    }

    
/**
     * @expectedException        \UnexpectedValueException
     * @expectedExceptionMessage onAuthenticationFailure method must return null to use the default failure handler, or a Response object
     */
    
public function testOnAuthenticationFailureThrowsAnExceptionIfNonResponseIsReturned()
    {
        
$this->failureHandler->expects($this->never())
            ->
method('onAuthenticationFailure');

        
$authenticator $this->getMockForAbstractClass('Symfony\Component\Security\Http\Tests\TestFailureHandlerInterface');
        
$authenticator->expects($this->once())
            ->
method('onAuthenticationFailure')
            ->
with($this->request$this->authenticationException)
            ->
will($this->returnValue(new \stdClass()));

        
$handler = new SimpleAuthenticationHandler($authenticator$this->successHandler$this->failureHandler);
        
$handler->onAuthenticationFailure($this->request$this->authenticationException);
    }

    public function 
testOnAuthenticationFailureFallsBackToDefaultHandlerIfNullIsReturned()
    {
        
$this->failureHandler->expects($this->once())
            ->
method('onAuthenticationFailure')
            ->
with($this->request$this->authenticationException)
            ->
will($this->returnValue($this->response));

        
$authenticator $this->getMockForAbstractClass('Symfony\Component\Security\Http\Tests\TestFailureHandlerInterface');
        
$authenticator->expects($this->once())
            ->
method('onAuthenticationFailure')
            ->
with($this->request$this->authenticationException)
            ->
will($this->returnValue(null));

        
$handler = new SimpleAuthenticationHandler($authenticator$this->successHandler$this->failureHandler);
        
$result $handler->onAuthenticationFailure($this->request$this->authenticationException);

        
$this->assertSame($this->response$result);
    }
}

interface 
TestSuccessHandlerInterface extends AuthenticationSuccessHandlerInterfaceSimpleAuthenticatorInterface
{
}

interface 
TestFailureHandlerInterface extends AuthenticationFailureHandlerInterfaceSimpleAuthenticatorInterface
{
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0046 ]--