public function testUrlValidator()
 {
     $this->assertTrue(UrlValidator::isValid('yandex.ru'));
     $this->assertTrue(UrlValidator::isValid('www.yandex.ru'));
     $this->assertTrue(UrlValidator::isValid('http://yandex.ru'));
     $this->assertTrue(UrlValidator::isValid('https://yandex.ru'));
     $this->assertTrue(UrlValidator::isValid('//yandex.ru'));
     $this->assertTrue(UrlValidator::isValid('yandex.ru?search=test&comment=test'));
     $this->assertTrue(UrlValidator::isValid('/index.php/test?data=1'));
     $this->assertTrue(UrlValidator::isValid('/path/to/page/?data=1'));
     // Negative
     $this->assertFalse(UrlValidator::isValid('http:/yandex.ru'));
     $this->assertFalse(UrlValidator::isValid('http://yandex/'));
     $this->assertFalse(UrlValidator::isValid(''));
 }
 /**
  * @inheritdoc
  * @return string
  */
 public function filter($value)
 {
     $result = null;
     if (is_null($value)) {
         $default = $this->default;
         if (!UrlValidator::isValid($default)) {
             $result = $default;
         } else {
             $result = $default;
         }
     } else {
         if (!UrlValidator::isValid($value)) {
             $default = $this->default;
             if (UrlValidator::isValid($default)) {
                 $result = $default;
             }
         } else {
             $result = $value;
         }
     }
     return $result;
 }