public function testSetGetUrlToValidate()
 {
     $urlToValidate = 'http://example.com/';
     $configuration = new Configuration();
     $configuration->setUrlToValidate($urlToValidate);
     $this->assertEquals($urlToValidate, $configuration->getUrlToValidate());
 }
 public function setUp()
 {
     $this->setTestFixturePath(__CLASS__);
     $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath() . '/HttpResponses'));
     $configuration = new Configuration();
     $configuration->setUrlToValidate('http://example.com/');
     $configuration->setHttpClient($this->getHttpClient());
     $this->wrapper = $this->getNewCssValidatorWrapper();
     $this->wrapper->setConfiguration($configuration);
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('domains-to-ignore.txt'));
 }
 public function setUp()
 {
     $this->setTestFixturePath(__CLASS__, $this->getName());
     $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath() . '/HttpResponses'));
     $configuration = new Configuration();
     $configuration->setUrlToValidate('http://example.com/foo"bar');
     $configuration->setHttpClient($this->getHttpClient());
     $configuration->setContentToValidate(file_get_contents($this->getFixturesDataPath() . '/WebResourceContent/rootWebResource.html'));
     $this->wrapper = $this->getNewCssValidatorWrapper();
     $this->wrapper->setConfiguration($configuration);
 }
 public function setUp()
 {
     $this->setTestFixturePath(__CLASS__, $this->getName());
     $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath() . '/HttpResponses'));
     $configuration = new Configuration();
     $configuration->setUrlToValidate('http://en.wikipedia.org/');
     $configuration->setHttpClient($this->getHttpClient());
     $this->wrapper = $this->getNewCssValidatorWrapper();
     $this->wrapper->setConfiguration($configuration);
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('/CssValidatorOutput/1'));
 }
 public function setUp()
 {
     $this->setTestFixturePath(__CLASS__);
     $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath() . '/HttpResponses'));
     $configuration = new Configuration();
     $configuration->setUrlToValidate('http://example.com/');
     $configuration->setHttpClient($this->getHttpClient());
     $this->wrapper = $this->getNewCssValidatorWrapper();
     $this->wrapper->setConfiguration($configuration);
     $this->wrapper->enableDeferToParentIfNoRawOutput();
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('no-messages.txt'));
 }
 public function setUp()
 {
     $this->setTestFixturePath(__CLASS__);
     $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath($this->getName()) . '/HttpResponses'));
     $configuration = new Configuration();
     $configuration->setUrlToValidate('http://grantammons.me/');
     $configuration->setHttpClient($this->getHttpClient());
     $configuration->setContentToValidate(file_get_contents($this->getFixturesDataPath() . '/WebResourceContent/rootWebResource.html'));
     $this->wrapper = $this->getNewCssValidatorWrapper();
     $this->wrapper->setConfiguration($configuration);
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('no-messages.txt'));
     $this->wrapper->enableDeferToParentIfNoRawOutput();
 }
 public function setUp()
 {
     $this->setTestFixturePath(get_class($this));
     $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath() . '/HttpResponses'));
     $cookieJar = new CookieJar();
     foreach ($this->getCookies() as $cookieData) {
         $cookieJar->setCookie(new SetCookie($cookieData));
     }
     $this->getHttpClient()->getEmitter()->attach(new HttpCookieSubscriber($cookieJar));
     $configuration = new Configuration();
     $configuration->setUrlToValidate('http://example.com/');
     $configuration->setHttpClient($this->getHttpClient());
     $this->wrapper = $this->getNewCssValidatorWrapper();
     $this->wrapper->setConfiguration($configuration);
     $this->wrapper->enableDeferToParentIfNoRawOutput();
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('no-messages.txt'));
     $this->wrapper->validate();
 }
 /**
  * 
  * @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;
 }
 public function testWithDefaultValuesAndUrlToTest()
 {
     $configuration = new Configuration();
     $this->assertEquals('java -jar css-validator.jar -output ucn -vextwarning true "http://example.com/" 2>&1', $configuration->setUrlToValidate('http://example.com/')->getExecutableCommand());
 }
 public function testFalseWhenNoUrlToValidate()
 {
     $configuration = new Configuration();
     $this->assertFalse($configuration->setUrlToValidate('')->hasUrlToValidate());
 }