-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMDTest.php
41 lines (36 loc) · 1.03 KB
/
MDTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* This file is part of the PHPFUI package
*
* (c) Bruce Wells
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source
* code
*/
class MDTest extends \PHPFUI\HTMLUnitTester\Extensions
{
public function testMarkdownFiles() : void
{
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/../vendor'));
$parser = new \PHPFUI\InstaDoc\MarkDownParser();
$ignoreDirectories = ['devbridge', ];
foreach ($iterator as $file)
{
foreach ($ignoreDirectories as $directory)
{
if (\str_contains($file->getPathname(), $directory))
{
continue 2;
}
}
$fileName = \strtolower($file->getFilename());
if ($file->isFile() && \str_ends_with($fileName, '.md'))
{
$html = $parser->fileText($file->getPathname());
$this->assertNotWarningHtml($html, "File {$file->getPathname()} has HTML warnings");
$this->assertValidHtml($html, "File {$file->getPathname()} has HTML errors");
}
}
}
}