!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/php55/usr/share/pear/test/TwigBridge/Symfony/Bridge/Twig/Tests/Node/   drwxr-xr-x
Free 291.44 GB of 429.69 GB (67.83%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     SearchAndRenderBlockNodeTest.php (9.77 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\Bridge\Twig\Tests\Node;

use 
Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode;

class 
SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
{
    public function 
testCompileWidget()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
        ));

        
$node = new SearchAndRenderBlockNode('form_widget'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'widget\')',
                
$this->getVariableGetter('form')
             ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileWidgetWithVariables()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
            new \
Twig_Node_Expression_Array(array(
                new \
Twig_Node_Expression_Constant('foo'0),
                new \
Twig_Node_Expression_Constant('bar'0),
            ), 
0),
        ));

        
$node = new SearchAndRenderBlockNode('form_widget'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'widget\', array("foo" => "bar"))',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileLabelWithLabel()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
            new \
Twig_Node_Expression_Constant('my label'0),
        ));

        
$node = new SearchAndRenderBlockNode('form_label'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', array("label" => "my label"))',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileLabelWithNullLabel()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
            new \
Twig_Node_Expression_Constant(null0),
        ));

        
$node = new SearchAndRenderBlockNode('form_label'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
// "label" => null must not be included in the output!
        // Otherwise the default label is overwritten with null.
        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\')',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileLabelWithEmptyStringLabel()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
            new \
Twig_Node_Expression_Constant(''0),
        ));

        
$node = new SearchAndRenderBlockNode('form_label'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
// "label" => null must not be included in the output!
        // Otherwise the default label is overwritten with null.
        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\')',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileLabelWithDefaultLabel()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
        ));

        
$node = new SearchAndRenderBlockNode('form_label'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\')',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileLabelWithAttributes()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
            new \
Twig_Node_Expression_Constant(null0),
            new \
Twig_Node_Expression_Array(array(
                new \
Twig_Node_Expression_Constant('foo'0),
                new \
Twig_Node_Expression_Constant('bar'0),
            ), 
0),
        ));

        
$node = new SearchAndRenderBlockNode('form_label'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
// "label" => null must not be included in the output!
        // Otherwise the default label is overwritten with null.
        // https://github.com/symfony/symfony/issues/5029
        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar"))',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileLabelWithLabelAndAttributes()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
            new \
Twig_Node_Expression_Constant('value in argument'0),
            new \
Twig_Node_Expression_Array(array(
                new \
Twig_Node_Expression_Constant('foo'0),
                new \
Twig_Node_Expression_Constant('bar'0),
                new \
Twig_Node_Expression_Constant('label'0),
                new \
Twig_Node_Expression_Constant('value in attributes'0),
            ), 
0),
        ));

        
$node = new SearchAndRenderBlockNode('form_label'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in argument"))',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileLabelWithLabelThatEvaluatesToNull()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
            new \
Twig_Node_Expression_Conditional(
                
// if
                
new \Twig_Node_Expression_Constant(true0),
                
// then
                
new \Twig_Node_Expression_Constant(null0),
                
// else
                
new \Twig_Node_Expression_Constant(null0),
                
0
            
),
        ));

        
$node = new SearchAndRenderBlockNode('form_label'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
// "label" => null must not be included in the output!
        // Otherwise the default label is overwritten with null.
        // https://github.com/symfony/symfony/issues/5029
        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    public function 
testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
    {
        
$arguments = new \Twig_Node(array(
            new \
Twig_Node_Expression_Name('form'0),
            new \
Twig_Node_Expression_Conditional(
                
// if
                
new \Twig_Node_Expression_Constant(true0),
                
// then
                
new \Twig_Node_Expression_Constant(null0),
                
// else
                
new \Twig_Node_Expression_Constant(null0),
                
0
            
),
            new \
Twig_Node_Expression_Array(array(
                new \
Twig_Node_Expression_Constant('foo'0),
                new \
Twig_Node_Expression_Constant('bar'0),
                new \
Twig_Node_Expression_Constant('label'0),
                new \
Twig_Node_Expression_Constant('value in attributes'0),
            ), 
0),
        ));

        
$node = new SearchAndRenderBlockNode('form_label'$arguments0);

        
$compiler = new \Twig_Compiler(new \Twig_Environment());

        
// "label" => null must not be included in the output!
        // Otherwise the default label is overwritten with null.
        // https://github.com/symfony/symfony/issues/5029
        
$this->assertEquals(
            
sprintf(
                
'$this->env->getExtension(\'form\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in attributes") + (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))',
                
$this->getVariableGetter('form')
            ),
            
trim($compiler->compile($node)->getSource())
        );
    }

    protected function 
getVariableGetter($name)
    {
        if (
version_compare(phpversion(), '5.4.0RC1''>=')) {
            return 
sprintf('(isset($context["%s"]) ? $context["%s"] : null)'$name$name);
        }

        return 
sprintf('$this->getContext($context, "%s")'$name);
    }
}

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