41 lines
1.7 KiB
PHP
41 lines
1.7 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
test('plugin metadata and packaging docs match project rules', function (): void {
|
|
$conf = file_get_contents(PLUGIN_ROOT . '/plugin.conf') ?: '';
|
|
$packing = file_get_contents(PROJECT_ROOT . '/PACKING.md') ?: '';
|
|
|
|
assert_contains('name=mail-login', $conf);
|
|
assert_contains('id=mail-login', $conf);
|
|
assert_contains('type=user', $conf);
|
|
assert_contains('version=1.0.10', $conf);
|
|
assert_contains('user_run_as=root', $conf);
|
|
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/src', $packing);
|
|
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/archives/X.Y.Z/mail-login.tar.gz', $packing);
|
|
});
|
|
|
|
test('package source excludes local-only files and dangerous placeholders', function (): void {
|
|
$package = file_get_contents(PLUGIN_ROOT . '/scripts/package.sh') ?: '';
|
|
assert_contains("--exclude='./.git'", $package);
|
|
assert_contains("--exclude='./tests'", $package);
|
|
assert_contains('mail-login.tar.gz', $package);
|
|
assert_true(is_file(PLUGIN_ROOT . '/scripts/keygen.sh'));
|
|
|
|
$bad = [];
|
|
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PLUGIN_ROOT, FilesystemIterator::SKIP_DOTS));
|
|
foreach ($it as $file) {
|
|
if (!$file->isFile()) {
|
|
continue;
|
|
}
|
|
$relative = substr($file->getPathname(), strlen(PLUGIN_ROOT) + 1);
|
|
if (str_starts_with($relative, '.git/') || str_starts_with($relative, 'tests/')) {
|
|
continue;
|
|
}
|
|
$content = file_get_contents($file->getPathname()) ?: '';
|
|
if (preg_match('/TODO|TBD|FIXME|placeholder|not implemented/i', $content)) {
|
|
$bad[] = $relative;
|
|
}
|
|
}
|
|
assert_same([], $bad);
|
|
});
|