!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/Config/Symfony/Component/Config/Tests/Definition/Builder/   drwxr-xr-x
Free 293.5 GB of 429.69 GB (68.3%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     ArrayNodeDefinitionTest.php (6.74 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\Config\Tests\Definition\Builder;

use 
Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use 
Symfony\Component\Config\Definition\Processor;
use 
Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;
use 
Symfony\Component\Config\Definition\Exception\InvalidDefinitionException;

class 
ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase
{
    public function 
testAppendingSomeNode()
    {
        
$parent = new ArrayNodeDefinition('root');
        
$child = new ScalarNodeDefinition('child');

        
$parent
            
->children()
                ->
scalarNode('foo')->end()
                ->
scalarNode('bar')->end()
            ->
end()
            ->
append($child);

        
$this->assertCount(3$this->getField($parent'children'));
        
$this->assertTrue(in_array($child$this->getField($parent'children')));
    }

    
/**
     * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
     * @dataProvider providePrototypeNodeSpecificCalls
     */
    
public function testPrototypeNodeSpecificOption($method$args)
    {
        
$node = new ArrayNodeDefinition('root');

        
call_user_func_array(array($node$method), $args);

        
$node->getNode();
    }

    public function 
providePrototypeNodeSpecificCalls()
    {
        return array(
            array(
'defaultValue', array(array())),
            array(
'addDefaultChildrenIfNoneSet', array()),
            array(
'requiresAtLeastOneElement', array()),
            array(
'useAttributeAsKey', array('foo'))
        );
    }

    
/**
     * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
     */
    
public function testConcreteNodeSpecificOption()
    {
        
$node = new ArrayNodeDefinition('root');
        
$node
            
->addDefaultsIfNotSet()
            ->
prototype('array')
        ;
        
$node->getNode();
    }

    
/**
     * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
     */
    
public function testPrototypeNodesCantHaveADefaultValueWhenUsingDefaultChildren()
    {
        
$node = new ArrayNodeDefinition('root');
        
$node
            
->defaultValue(array())
            ->
addDefaultChildrenIfNoneSet('foo')
            ->
prototype('array')
        ;
        
$node->getNode();
    }

    public function 
testPrototypedArrayNodeDefaultWhenUsingDefaultChildren()
    {
        
$node = new ArrayNodeDefinition('root');
        
$node
            
->addDefaultChildrenIfNoneSet()
            ->
prototype('array')
        ;
        
$tree $node->getNode();
        
$this->assertEquals(array(array()), $tree->getDefaultValue());
    }

    
/**
     * @dataProvider providePrototypedArrayNodeDefaults
     */
    
public function testPrototypedArrayNodeDefault($args$shouldThrowWhenUsingAttrAsKey$shouldThrowWhenNotUsingAttrAsKey$defaults)
    {
        
$node = new ArrayNodeDefinition('root');
        
$node
            
->addDefaultChildrenIfNoneSet($args)
            ->
prototype('array')
        ;

        try {
            
$tree $node->getNode();
            
$this->assertFalse($shouldThrowWhenNotUsingAttrAsKey);
            
$this->assertEquals($defaults$tree->getDefaultValue());
        } catch (
InvalidDefinitionException $e) {
            
$this->assertTrue($shouldThrowWhenNotUsingAttrAsKey);
        }

        
$node = new ArrayNodeDefinition('root');
        
$node
            
->useAttributeAsKey('attr')
            ->
addDefaultChildrenIfNoneSet($args)
            ->
prototype('array')
        ;

        try {
            
$tree $node->getNode();
            
$this->assertFalse($shouldThrowWhenUsingAttrAsKey);
            
$this->assertEquals($defaults$tree->getDefaultValue());
        } catch (
InvalidDefinitionException $e) {
            
$this->assertTrue($shouldThrowWhenUsingAttrAsKey);
        }
    }

    public function 
providePrototypedArrayNodeDefaults()
    {
        return array(
            array(
nulltruefalse, array(array())),
            array(
2truefalse, array(array(), array())),
            array(
'2'falsetrue, array('2' => array())),
            array(
'foo'falsetrue, array('foo' => array())),
            array(array(
'foo'), falsetrue, array('foo' => array())),
            array(array(
'foo''bar'), falsetrue, array('foo' => array(), 'bar' => array())),
        );
    }

    public function 
testNestedPrototypedArrayNodes()
    {
        
$node = new ArrayNodeDefinition('root');
        
$node
            
->addDefaultChildrenIfNoneSet()
            ->
prototype('array')
                  ->
prototype('array')
        ;
        
$node->getNode();
    }

    public function 
testEnabledNodeDefaults()
    {
        
$node = new ArrayNodeDefinition('root');
        
$node
            
->canBeEnabled()
            ->
children()
                ->
scalarNode('foo')->defaultValue('bar')->end()
        ;

        
$this->assertEquals(array('enabled' => false'foo' => 'bar'), $node->getNode()->getDefaultValue());
    }

    
/**
     * @dataProvider getEnableableNodeFixtures
     */
    
public function testTrueEnableEnabledNode($expected$config$message)
    {
        
$processor = new Processor();
        
$node = new ArrayNodeDefinition('root');
        
$node
            
->canBeEnabled()
            ->
children()
                ->
scalarNode('foo')->defaultValue('bar')->end()
        ;

        
$this->assertEquals(
            
$expected,
            
$processor->process($node->getNode(), $config),
            
$message
        
);
    }

    public function 
getEnableableNodeFixtures()
    {
        return array(
            array(array(
'enabled' => true'foo' => 'bar'), array(true), 'true enables an enableable node'),
            array(array(
'enabled' => true'foo' => 'bar'), array(null), 'null enables an enableable node'),
            array(array(
'enabled' => true'foo' => 'bar'), array(array('enabled' => true)), 'An enableable node can be enabled'),
            array(array(
'enabled' => true'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'),
            array(array(
'enabled' => false'foo' => 'baz'), array(array('foo' => 'baz''enabled' => false)), 'An enableable node can be disabled'),
            array(array(
'enabled' => false'foo' => 'bar'), array(false), 'false disables an enableable node'),
        );
    }

    protected function 
getField($object$field)
    {
        
$reflection = new \ReflectionProperty($object$field);
        
$reflection->setAccessible(true);

        return 
$reflection->getValue($object);
    }
}

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