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


Viewing file:     RangeValidatorTest.php (5.93 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\Validator\Tests\Constraints;

use 
Symfony\Component\Validator\Constraints\Range;
use 
Symfony\Component\Validator\Constraints\RangeValidator;

class 
RangeValidatorTest extends \PHPUnit_Framework_TestCase
{
    protected 
$context;
    protected 
$validator;

    protected function 
setUp()
    {
        
$this->context $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), ''false);
        
$this->validator = new RangeValidator();
        
$this->validator->initialize($this->context);
    }

    public function 
testNullIsValid()
    {
        
$this->context->expects($this->never())
            ->
method('addViolation');

        
$this->validator->validate(null, new Range(array('min' => 10'max' => 20)));
    }

    public function 
getTenToTwenty()
    {
        return array(
            array(
10.00001),
            array(
19.99999),
            array(
'10.00001'),
            array(
'19.99999'),
            array(
10),
            array(
20),
            array(
10.0),
            array(
20.0),
        );
    }

    public function 
getLessThanTen()
    {
        return array(
            array(
9.99999),
            array(
'9.99999'),
            array(
5),
            array(
1.0),
        );
    }

    public function 
getMoreThanTwenty()
    {
        return array(
            array(
20.000001),
            array(
'20.000001'),
            array(
21),
            array(
30.0),
        );
    }

    
/**
     * @dataProvider getTenToTwenty
     */
    
public function testValidValuesMin($value)
    {
        
$this->context->expects($this->never())
            ->
method('addViolation');

        
$constraint = new Range(array('min' => 10));
        
$this->validator->validate($value$constraint);
    }

    
/**
     * @dataProvider getTenToTwenty
     */
    
public function testValidValuesMax($value)
    {
        
$this->context->expects($this->never())
            ->
method('addViolation');

        
$constraint = new Range(array('max' => 20));
        
$this->validator->validate($value$constraint);
    }

    
/**
     * @dataProvider getTenToTwenty
     */
    
public function testValidValuesMinMax($value)
    {
        
$this->context->expects($this->never())
            ->
method('addViolation');

        
$constraint = new Range(array('min' => 10'max' => 20));
        
$this->validator->validate($value$constraint);
    }

    
/**
     * @dataProvider getLessThanTen
     */
    
public function testInvalidValuesMin($value)
    {
        
$constraint = new Range(array(
            
'min' => 10,
            
'minMessage' => 'myMessage',
        ));

        
$this->context->expects($this->once())
            ->
method('addViolation')
            ->
with('myMessage'$this->identicalTo(array(
                
'{{ value }}' => $value,
                
'{{ limit }}' => 10,
        )));

        
$this->validator->validate($value$constraint);
    }

    
/**
     * @dataProvider getMoreThanTwenty
     */
    
public function testInvalidValuesMax($value)
    {
        
$constraint = new Range(array(
            
'max' => 20,
            
'maxMessage' => 'myMessage',
        ));

        
$this->context->expects($this->once())
            ->
method('addViolation')
            ->
with('myMessage'$this->identicalTo(array(
                
'{{ value }}' => $value,
                
'{{ limit }}' => 20,
            )));

        
$this->validator->validate($value$constraint);
    }

    
/**
     * @dataProvider getMoreThanTwenty
     */
    
public function testInvalidValuesCombinedMax($value)
    {
        
$constraint = new Range(array(
            
'min' => 10,
            
'max' => 20,
            
'minMessage' => 'myMinMessage',
            
'maxMessage' => 'myMaxMessage',
        ));

        
$this->context->expects($this->once())
            ->
method('addViolation')
            ->
with('myMaxMessage'$this->identicalTo(array(
                
'{{ value }}' => $value,
                
'{{ limit }}' => 20,
            )));

        
$this->validator->validate($value$constraint);
    }

    
/**
     * @dataProvider getLessThanTen
     */
    
public function testInvalidValuesCombinedMin($value)
    {
        
$constraint = new Range(array(
            
'min' => 10,
            
'max' => 20,
            
'minMessage' => 'myMinMessage',
            
'maxMessage' => 'myMaxMessage',
        ));

        
$this->context->expects($this->once())
            ->
method('addViolation')
            ->
with('myMinMessage'$this->identicalTo(array(
            
'{{ value }}' => $value,
            
'{{ limit }}' => 10,
        )));

        
$this->validator->validate($value$constraint);
    }

    public function 
getInvalidValues()
    {
        return array(
            array(
9.999999),
            array(
20.000001),
            array(
'9.999999'),
            array(
'20.000001'),
            array(new \
stdClass()),
        );
    }

    public function 
testMinMessageIsSet()
    {
        
$constraint = new Range(array(
            
'min' => 10,
            
'max' => 20,
            
'minMessage' => 'myMessage',
        ));

        
$this->context->expects($this->once())
            ->
method('addViolation')
            ->
with('myMessage', array(
                
'{{ value }}' => 9,
                
'{{ limit }}' => 10,
            ));

        
$this->validator->validate(9$constraint);
    }

    public function 
testMaxMessageIsSet()
    {
        
$constraint = new Range(array(
            
'min' => 10,
            
'max' => 20,
            
'maxMessage' => 'myMessage',
        ));

        
$this->context->expects($this->once())
            ->
method('addViolation')
            ->
with('myMessage', array(
                
'{{ value }}' => 21,
                
'{{ limit }}' => 20,
            ));

        
$this->validator->validate(21$constraint);
    }
}

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