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()); }
public function setUp() { $this->setTestFixturePath(__CLASS__, $this->getName()); $this->setHttpFixtures($this->getHttpFixtures($this->getFixturesDataPath() . '/HttpResponses')); $this->wrapper = $this->getNewCssValidatorWrapper(); $this->wrapper->createConfiguration(array('url-to-validate' => 'http://example.com/', 'http-auth' => array('user' => 'example', 'password' => 'password'), 'http-client' => $this->getHttpClient())); $this->wrapper->getConfiguration()->setCssValidatorJarPath('/home/jon/tools/css-validator/2002/css-validator/css-validator.jar'); $this->wrapper->enableDeferToParentIfNoRawOutput(); }
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()); }
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 testSetContentToValidate() { $content = 'foo'; $wrapper = new Wrapper(); $wrapper->createConfiguration(array('url-to-validate' => 'http://example.com/', 'content-to-validate' => $content)); $this->assertEquals($content, $wrapper->getConfiguration()->getContentToValidate()); }
public function testThreeDomainsOfThreeIgnored() { $this->wrapper->getConfiguration()->setDomainsToIgnore(array('one.cdn.example.com', 'two.cdn.example.com', 'example.com')); $this->assertEquals(0, $this->wrapper->validate()->getErrorCount()); }
public function testWithCssContent() { $this->wrapper->getConfiguration()->setContentToValidate(file_get_contents($this->getFixturesDataPath() . '/WebResourceContent/content.css')); $this->assertEquals(0, $this->wrapper->validate()->getErrorCount()); }
public function testDisableRetryWithUrlEncodingDisabledHasErrorForS1Url() { $this->wrapper->getConfiguration()->getWebResourceService()->getConfiguration()->disableRetryWithUrlEncodingDisabled(); $output = $this->wrapper->validate(); $this->assertEquals(1, count($output->getErrorsByUrl('http://s1.example.com/?%3Fstyle.css'))); }
public function testTest() { $this->wrapper->getConfiguration()->getWebResourceService()->getConfiguration()->enableRetryWithUrlEncodingDisabled(); $output = $this->wrapper->validate(); $this->assertEquals(0, $output->getErrorCount()); }