Update README and metadata for version 1.1.1; add discovery test for plugin class loading

This commit is contained in:
interlope committed 2026-11-01 18:41:20 +01:00
1 parent 3dfd367814
commit 41e623d5d1
5 files changed
+60 -3

No files matched your search

+5
View File
@@ -40,7 +40,11 @@ class Plugin {
public function workspace() { global $dir; return $dir . 'workspace/'; }
public function post() {}
}
$declaredBeforePlugin = get_declared_classes();
require dirname(__DIR__) . '/plugin.php';
if (array_values(array_diff(get_declared_classes(), $declaredBeforePlugin)) !== ['pluginBluditGithub']) {
throw new RuntimeException('Only the plugin class may be declared during Bludit discovery.');
}
class TestIndex { public $count = 0; public function exists($key) { return in_array($key, ['network', 'uncategorized'], true); } public function reindex() { $this->count++; return true; } }
class TestLog { public function add($args) {} }
class Theme {
@@ -90,6 +94,7 @@ $site = new class { public function sortBy() { return 'date'; } public function
$L = new class { public function g($s) { return $s; } public function getunicodeChars() { return []; } public function currentLanguage() { return 'en'; } };
Session::set('username', 'admin');
$plugin = new TestPlugin();
$plugin->init();
try {
// Parser and filesystem boundaries.
foreach (['../bad', 'a/b', '', 'x%2fy', 'x\\y'] as $slug) { rejects(function () use ($slug) { BluditGithubImport::slug($slug); }, 'folder name'); }