public function testSetGetDomainsToIgnore()
 {
     $domainsToIgnore = array('foo', 'bar');
     $configuration = new Configuration();
     $configuration->setDomainsToIgnore($domainsToIgnore);
     $this->assertEquals($domainsToIgnore, $configuration->getDomainsToIgnore());
 }
Exemplo n.º 2
0
 /**
  * 
  * @param array $configurationValues
  * @return \webignition\CssValidatorWrapper\Wrapper
  * @throws \InvalidArgumentException
  */
 public function createConfiguration($configurationValues)
 {
     if (!is_array($configurationValues) || empty($configurationValues)) {
         throw new \InvalidArgumentException('A non-empty array of configuration values must be passed to create configuration', 2);
     }
     if (!isset($configurationValues['url-to-validate'])) {
         throw new \InvalidArgumentException('Configruation value "url-to-validate" not set', self::INVALID_ARGUMENT_EXCEPTION_URL_TO_VALIDATE_NOT_SET);
     }
     $configuration = new Configuration();
     $configuration->setUrlToValidate($configurationValues['url-to-validate']);
     if (isset($configurationValues['java-executable-path'])) {
         $configuration->setJavaExecutablePath($configurationValues['java-executable-path']);
     }
     if (isset($configurationValues['css-validator-jar-path'])) {
         $configuration->setCssValidatorJarPath($configurationValues['css-validator-jar-path']);
     }
     if (isset($configurationValues['vendor-extension-severity-level'])) {
         $configuration->setVendorExtensionSeverityLevel($configurationValues['vendor-extension-severity-level']);
     }
     if (isset($configurationValues['flags']) && is_array($configurationValues['flags'])) {
         foreach ($configurationValues['flags'] as $flag) {
             $configuration->setFlag($flag);
         }
     }
     if (isset($configurationValues['domains-to-ignore']) && is_array($configurationValues['domains-to-ignore'])) {
         $configuration->setDomainsToIgnore($configurationValues['domains-to-ignore']);
     }
     if (isset($configurationValues['http-client']) && $configurationValues['http-client'] instanceof HttpClient) {
         $configuration->setHttpClient($configurationValues['http-client']);
     }
     if (isset($configurationValues['content-to-validate'])) {
         $configuration->setContentToValidate($configurationValues['content-to-validate']);
     }
     $this->setConfiguration($configuration);
     return $this;
 }