public function testGetValidators()
 {
     $factory = new UrlSchemeValidators();
     $schemes = array('http', 'https', 'ftp', 'dummy');
     $validators = $factory->getValidators($schemes);
     $this->assertEquals(array('http', 'https', 'ftp'), array_keys($validators));
     $this->assertContainsOnlyInstancesOf('ValueValidators\\ValueValidator', $validators);
 }
 /**
  * @param string[] $urlSchemes List of URL schemes, e.g. 'http'
  * @param string|null $prefix a required prefix
  * @param int $maxLength Defaults to 500 characters. Even if URLs are unlimited in theory they
  * should be limited to about 2000. About 500 is a reasonable compromise.
  * @see http://stackoverflow.com/a/417184
  *
  * @return CompositeValidator
  */
 private function getUrlValidator(array $urlSchemes, $prefix = null, $maxLength = 500)
 {
     $validators = array();
     $validators[] = new TypeValidator('string');
     $validators[] = new StringLengthValidator(2, $maxLength);
     $urlValidatorsBuilder = new UrlSchemeValidators();
     $urlValidators = $urlValidatorsBuilder->getValidators($urlSchemes);
     $validators[] = new UrlValidator($urlValidators);
     if ($prefix !== null) {
         // FIXME: It's currently not possible to allow both http and https at this point.
         $validators[] = $this->getPrefixValidator($prefix, 'bad-prefix');
     }
     return new CompositeValidator($validators);
     //Note: each validator is fatal
 }