Files
portal/app/tests/Feature/Bot/HelpTourNamesTest.php
T

21 lines
720 B
PHP

<?php
declare(strict_types=1);
use App\Support\Help\HelpArticleParser;
it('каждый tour из статей resources/help существует в каталоге экскурсий', function () {
$catalog = (string) file_get_contents(resource_path('js/tours/catalog.ts'));
preg_match_all("/name: '([a-z0-9\\-]+)'/", $catalog, $m);
$known = $m[1];
expect($known)->not->toBeEmpty();
$parser = new HelpArticleParser;
foreach (glob(resource_path('help').'/*.md') ?: [] as $file) {
$article = $parser->parse('help/'.basename($file), (string) file_get_contents($file));
if ($article->tour !== null) {
expect($known)->toContain($article->tour);
}
}
});