示例#1
0
 /**
  * Checks if the magic $listOfAllowedHostnames attribute contains the whitelisted
  * hostnames.
  *
  * This attribute can be referenced in failure messages via %allowedHostnames%.
  */
 public function testListOfAllowedHostnamesAttributeContainsAllowedHostnames()
 {
     $this->validator->setAllowedHostnames(array('github.com', 'google.de'));
     $list = $this->validator->listOfAllowedHostnames;
     $this->assertInternalType('string', $list);
     $this->assertContains('github.com', $list);
     $this->assertContains('google.de', $list);
 }
示例#2
0
 /**
  * Sets hostnames that are allowed in the url.
  *
  * @param array(string) $hostnames
  * @return Mol_Form_Element_Url Provides a fluent interface.
  */
 public function setAllowedHostnames(array $hostnames)
 {
     $this->_urlValidator->setAllowedHostnames($hostnames);
     $this->setAttrib(self::HOSTNAMES_ATTRIBUTE, $this->toHostnamesAttribute($hostnames));
     return $this;
 }