예제 #1
0
 /**
  * Sets the allowed hostnames.
  *
  * Example:
  *
  *     $element->setHostnames(array('example.com', 'example.org));
  *
  * If an empty array is provided then the current hostname
  * restrictions are removed.
  *
  * @param array(string) $hostnames
  * @return Mol_Form_Element_EmailAddress Provides a fluent interface.
  */
 public function setAllowedHostnames(array $hostnames)
 {
     $suffixes = $this->toSuffixes($hostnames);
     $this->_hostnameValidator->setSuffixes($suffixes);
     $this->setAttrib(self::HOSTNAMES_ATTRIBUTE, $this->toHostnamesAttribute($hostnames));
     return $this;
 }
예제 #2
0
 /**
  * Ensures that isValid() accepts all string if the list of suffixes
  * is empty.
  */
 public function testIsValidAcceptsValueIfListOfAcceptedSuffixesIsEmpty()
 {
     $this->validator->setSuffixes(array());
     $this->assertTrue($this->validator->isValid('image.jpg'));
 }