. * * @package LibreNMS * @link http://librenms.org * @copyright 2018 Neil Lathwood * @author Neil Lathwood */ namespace LibreNMS\Tests; use Symfony\Component\Yaml\Yaml; class DocTest extends TestCase { public function testDocExist() { $mkdocs = Yaml::parse(file_get_contents(__DIR__ . '/../mkdocs.yml')); $dir = __DIR__ . '/../doc/'; $files = str_replace($dir, '', rtrim(`find $dir -name '*.md'`)); // check for missing pages collect(explode(PHP_EOL, $files)) ->diff(collect($mkdocs['pages'])->flatten()) // grab defined pages and diff ->each(function ($missing_doc) { $this->fail("The doc $missing_doc doesn't exist in mkdocs.yml, please add it to the relevant section"); }); } }