public function testExecutableCommandIncludesCharsetWhenSpecified()
 {
     $configuration = new Configuration();
     $configuration->setDocumentUri('file:/foo/example.html');
     $configuration->setDocumentCharacterSet('utf8');
     $this->assertEquals('/usr/local/validator/cgi-bin/check output=json charset=utf8 uri=file:/foo/example.html', $configuration->getExecutableCommand());
 }
 protected function getAndStoreValidatorOutput($documentUri)
 {
     $configuration = new Configuration();
     $configuration->setDocumentUri($documentUri);
     $wrapper = $this->getHtmlValidatorWrapper();
     $wrapper->setConfiguration($configuration);
     file_put_contents($this->getCommonFixturesPath() . md5($documentUri) . '.txt', implode("\n", $wrapper->getRawValidatorOutputLines()));
 }
 public function testValidateReturnsHtmlValdiatorOutputObject()
 {
     $configuration = new Configuration();
     $configuration->setDocumentUri('file:/foo/example.html');
     $wrapper = $this->getMockHtmlValidatorWrapper();
     $wrapper->setConfiguration($configuration);
     $wrapper->setHtmlValidatorRawOutput($this->getFixture('0-errors.txt'));
     $this->assertInstanceOf('webignition\\HtmlValidator\\Output\\Output', $wrapper->validate());
 }
 /**
  * 
  * @param array $configurationValues
  * @return \webignition\HtmlValidator\Wrapper\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['documentUri'])) {
         throw new \InvalidArgumentException('Configruation value "documentUri" not set', 3);
     }
     $configuration = new Configuration();
     $configuration->setDocumentUri($configurationValues['documentUri']);
     if (isset($configurationValues['validatorPath'])) {
         $configuration->setValidatorPath($configurationValues['validatorPath']);
     }
     if (isset($configurationValues['documentCharacterSet'])) {
         $configuration->setDocumentCharacterSet($configurationValues['documentCharacterSet']);
     }
     $this->setConfiguration($configuration);
     return $this;
 }
 public function testSetNoValidatorPathGetsDefaultPath()
 {
     $configuration = new Configuration();
     $this->assertEquals(Configuration::DEFAULT_VALIDATOR_PATH, $configuration->getValidatorPath());
 }
 public function testgetReturnsSetValue()
 {
     $charset = 'utf8';
     $configuration = new Configuration();
     $this->assertEquals($charset, $configuration->setDocumentCharacterSet($charset)->getDocumentCharacterSet());
 }
 public function testGetWithoutSettingThrowsInvalidArgumentException()
 {
     $this->setExpectedException('InvalidArgumentException');
     $configuration = new Configuration();
     $configuration->getDocumentUri();
 }