Hostname example

use Symfony\Component\Validator\Constraints\HostnameValidator;
use Symfony\Component\Validator\Exception\UnexpectedValueException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

/** * @author Dmitrii Poddubnyi <dpoddubny@gmail.com> */
class HostnameValidatorTest extends ConstraintValidatorTestCase
{
    public function testNullIsValid()
    {
        $this->validator->validate(null, new Hostname());

        $this->assertNoViolation();
    }

    public function testEmptyStringIsValid()
    {
        $this->validator->validate('', new Hostname());

        $this->assertNoViolation();
    }

    
Home | Imprint | This part of the site doesn't use cookies.