public function testWarningWithVendorSpecificAtRuleErrorsThatShouldBeWarnings()
 {
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('vendor-specific-at-rules.txt'));
     $output = $this->wrapper->validate();
     $this->wrapper->getConfiguration()->setVendorExtensionSeverityLevel(VendorExtensionSeverityLevel::LEVEL_WARN);
     $this->assertEquals(12, $output->getWarningCount());
     $this->assertEquals(1, $output->getErrorCount());
 }
コード例 #2
0
 public function testCurlTimeoutWhenRetrievingCssResourceTwoOfTwo()
 {
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('CssValidatorResponse/1'));
     $output = $this->wrapper->validate();
     $errorsForExceptionedUrl = $output->getErrorsByUrl('http://example.com/assets/css/style2.css');
     $this->assertFalse($output->hasException());
     $this->assertEquals(1, count($errorsForExceptionedUrl));
     $this->assertEquals('curl-error:28', $errorsForExceptionedUrl[0]->getMessage());
 }
コード例 #3
0
 public function testEnabledWithVendorExtensionAtRuleErrorsAndVendorExtensionIssuesAsWarnings()
 {
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('vendor-specific-at-rules.txt'));
     $this->wrapper->getConfiguration()->setFlag(Flags::FLAG_IGNORE_WARNINGS);
     $output = $this->wrapper->validate();
     $this->wrapper->getConfiguration()->setVendorExtensionSeverityLevel(VendorExtensionSeverityLevel::LEVEL_WARN);
     $this->assertEquals(0, $output->getWarningCount());
     $this->assertEquals(1, $output->getErrorCount());
 }
コード例 #4
0
 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://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://example.com/');
     $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'));
 }
コード例 #8
0
 public function testHttp404WhenRetrievingCssResourcesOneAndTwo()
 {
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('CssValidatorResponse/1'));
     $output = $this->wrapper->validate();
     $errorsForStylesheet1 = $output->getErrorsByUrl('http://example.com/assets/css/style1.css');
     $this->assertFalse($output->hasException());
     $this->assertEquals(1, count($errorsForStylesheet1));
     $this->assertEquals('http-error:404', $errorsForStylesheet1[0]->getMessage());
     $errorsForStylesheet2 = $output->getErrorsByUrl('http://example.com/assets/css/style2.css');
     $this->assertFalse($output->hasException());
     $this->assertEquals(1, count($errorsForStylesheet2));
     $this->assertEquals('http-error:404', $errorsForStylesheet2[0]->getMessage());
 }
コード例 #9
0
 public function testSet()
 {
     $this->getHttpClient()->setDefaultOption('auth', ['example_user', 'example_password']);
     $this->wrapper->getConfiguration()->setHttpClient($this->getHttpClient());
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('CssValidatorResponse/1'));
     #
     $output = $this->wrapper->validate();
     $this->assertFalse($output->hasException());
     $this->assertEquals(3, $output->getErrorCount());
     foreach ($output->getMessages() as $message) {
         $this->assertTrue(substr_count($message->getRef(), 'file:/') === 0);
     }
 }
 public function testDoubleQuotesAreEscaped()
 {
     $this->wrapper->setCssValidatorRawOutput($this->getFixture('double-quote-in-ref-url.txt'));
     $output = $this->wrapper->validate();
     $this->assertEquals(1, $output->getErrorCount());
 }