Skip to content

Commit

Permalink
Merge branch 'Narno-success-selector'
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelroecker committed Jul 14, 2016
2 parents e0575cf + a4cefc5 commit 39f9e84
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
.idea
composer.phar
composer.lock
composer-test.lock
Expand Down
22 changes: 13 additions & 9 deletions src/GlW3CValidator.php
Expand Up @@ -36,6 +36,7 @@ class GlW3CValidator
private $types = [
'html' => [
'validator' => '/',
'selector' => '.success',
'resulttag' => '#results',
'field' => 'file',
'css' => [
Expand All @@ -44,6 +45,7 @@ class GlW3CValidator
],
'css' => [
'validator' => '/validator',
'selector' => '#congrats',
'resulttag' => '#results_container',
'field' => 'file',
'css' => [
Expand Down Expand Up @@ -87,6 +89,7 @@ public function __construct(
/**
* @param string $w3curl
* @param string $validator
* @param string $selector
* @param string $field
* @param string $htmltag
* @param string $file
Expand All @@ -95,7 +98,7 @@ public function __construct(
*
* @return string
*/
private function sendToW3C($w3curl, $validator, $field, $htmltag, $file, $title, $csslist)
private function sendToW3C($w3curl, $validator, $selector, $field, $htmltag, $file, $title, $csslist)
{
$client = new Client();

Expand All @@ -121,7 +124,7 @@ private function sendToW3C($w3curl, $validator, $field, $htmltag, $file, $title,

$html = new GlHtml($html);

if ($html->get(".success")) {
if ($html->get($selector)) {
return null;
}

Expand Down Expand Up @@ -166,13 +169,14 @@ private function validateFile(SplFileInfo $fileinfo)
$ext = $fileinfo->getExtension();
$title = strtr($fileinfo->getRelativePathname(), ["\\" => "/"]);
$view = $this->sendToW3C(
$this->types[$ext]['w3curl'],
$this->types[$ext]['validator'],
$this->types[$ext]['field'],
$this->types[$ext]['resulttag'],
strtr($fileinfo->getRealPath(), ["\\" => "/"]),
$title,
$this->types[$ext]['css']
$this->types[$ext]['w3curl'],
$this->types[$ext]['validator'],
$this->types[$ext]['selector'],
$this->types[$ext]['field'],
$this->types[$ext]['resulttag'],
strtr($fileinfo->getRealPath(), ["\\" => "/"]),
$title,
$this->types[$ext]['css']
);

if ($view === null) {
Expand Down
2 changes: 1 addition & 1 deletion tests/GlValidatorTest.php
Expand Up @@ -131,7 +131,7 @@ function (SplFileInfo $file) use (&$count) {
"w3c_css_glicer.html"
];

$this->assertNotEquals(NULL, $result["test1/css/glicer.css"]);
$this->assertEquals(NULL, $result["test1/css/glicer.css"]);
$this->assertEquals(NULL,$result["test1/index.html"]);
$this->assertNotEquals(NULL, $result["test2/css/glicer.css"]);
$this->assertNotEquals(NULL, $result["test2/index.html"]);
Expand Down

0 comments on commit 39f9e84

Please sign in to comment.