Skip to content

Commit

Permalink
Use late static binding to show the correct class as parser with the …
Browse files Browse the repository at this point in the history
…BaseJavascriptParser
  • Loading branch information
bbrala committed Feb 5, 2018
1 parent 681bfde commit 09f22ec
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Parsers/Behat.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function run(Repository $repository, Result\ValidationInterface $validati
$line->getCommit()->getAuthorName(),
$line->getCommit()->getAuthorEmail(),
$line->getCommit()->getCommitterDate()->getTimestamp(),
self::class
static::class
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Parsers/Codeception/Cept.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function run(Repository $repository, Result\ValidationInterface $validati
$line->getCommit()->getAuthorName(),
$line->getCommit()->getAuthorEmail(),
$line->getCommit()->getCommitterDate()->getTimestamp(),
self::class
static::class
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Parsers/Codeception/Cest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function run(Repository $repository, Result\ValidationInterface $validati
$line->getCommit()->getAuthorName(),
$line->getCommit()->getAuthorEmail(),
$line->getCommit()->getCommitterDate()->getTimestamp(),
self::class
static::class
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Parsers/JavaScript/BaseJavaScriptParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function run(Repository $repository, Result\ValidationInterface $validati
$line->getCommit()->getAuthorName(),
$line->getCommit()->getAuthorEmail(),
$line->getCommit()->getCommitterDate()->getTimestamp(),
self::class
static::class
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Parsers/PhpUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function run(Repository $repository, Result\ValidationInterface $validati
$line->getCommit()->getAuthorName(),
$line->getCommit()->getAuthorEmail(),
$line->getCommit()->getCommitterDate()->getTimestamp(),
self::class
static::class
);
}
}
Expand Down
5 changes: 5 additions & 0 deletions tests/Parsers/BaseParserTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ protected function setUp()
* @param ParserInterface $parser
* @param array $expectedFiles What files do we expect as result
* @param int $expectedCount How many tests should be counted
* @return Result[]
*/
protected function runParserTest($parser, $expectedFiles, $expectedCount)
{
Expand All @@ -33,6 +34,8 @@ protected function runParserTest($parser, $expectedFiles, $expectedCount)
foreach ($results as $result) {
static::assertInstanceOf(Result::class, $result);

static::assertEquals(get_class($parser), $result->getParser());

if (in_array($result->getFilename(), $expectedFiles)) {
$count++;
}
Expand All @@ -42,5 +45,7 @@ protected function runParserTest($parser, $expectedFiles, $expectedCount)
$count,
'Check if file list has ' . $expectedCount . ' results.'
);

return $results;
}
}

0 comments on commit 09f22ec

Please sign in to comment.