diff --git a/lib/WeatherMap.class.php b/lib/WeatherMap.class.php index 3e12dc67..2416925e 100644 --- a/lib/WeatherMap.class.php +++ b/lib/WeatherMap.class.php @@ -44,6 +44,12 @@ require_once('WeatherMap.functions.php'); require_once('geometry.php'); +require_once('WeatherMapDataSource.class.php'); +require_once('WeatherMapPreProcessor.class.php'); +require_once('WeatherMapPostProcessor.class.php'); +require_once('WeatherMapBase.class.php'); +require_once('WeatherMapConfigItem.class.php'); +require_once('WeatherMapItem.class.php'); require_once('WeatherMapNode.class.php'); require_once('WeatherMap.notes.php'); require_once('WeatherMapLink.class.php'); @@ -69,243 +75,7 @@ // error_reporting (E_ALL|E_STRICT); error_reporting(E_ALL); -// parameterise the in/out stuff a bit -define('IN',0); -define('OUT',1); -define('WMCHANNELS',2); - -define('CONFIG_TYPE_LITERAL',0); -define('CONFIG_TYPE_COLOR',1); - -// some strings that are used in more than one place -define('FMT_BITS_IN', '{link:this:bandwidth_in:%2k}'); -define('FMT_BITS_OUT', '{link:this:bandwidth_out:%2k}'); -define('FMT_UNFORM_IN', '{link:this:bandwidth_in}'); -define('FMT_UNFORM_OUT', '{link:this:bandwidth_out}'); -define('FMT_PERC_IN', '{link:this:inpercent:%.2f}%'); -define('FMT_PERC_OUT', '{link:this:outpercent:%.2f}%'); - -// the fields within a spine triple -define('X', 0); -define('Y', 1); - -define('DISTANCE', 2); - -// *********************************************** - -// template class for data sources. All data sources extend this class. -// I really wish PHP4 would just die overnight -class WeatherMapDataSource { - // Cacti Integration - /** @var mixed */ - var $local_data_id; - - /** @var array */ - var $down_cache = []; - - // Initialize - called after config has been read (so SETs are processed) - // but just before ReadData. Used to allow plugins to verify their dependencies - // (if any) and bow out gracefully. Return false to signal that the plugin is not - // in a fit state to run at the moment. - /** - * @param WeatherMap $map - * @return bool - */ - function Init(&$map) { - return true; - } - - // called with the TARGET string. Returns true or false, depending on whether it wants to handle this TARGET - // called by map->ReadData() - /** - * @param string $targetstring - * @return bool - */ - function Recognise($targetstring) { - return false; - } - - // the actual ReadData - // returns an array of two values (in,out). -1,-1 if it couldn't get valid data - // configline is passed in, to allow for better error messages - // itemtype and itemname may be used as part of the target (e.g. for TSV source line) - // function ReadData($targetstring, $configline, $itemtype, $itemname, $map) { return ([-1,-1]); } - /** - * @param string $targetstring - * @param WeatherMap $map - * @param WeatherMapItem $item - * @return mixed - */ - function ReadData($targetstring, &$map, &$item) { - return ([-1, -1, 0]); - } - - // pre-register a target + context, to allow a plugin to batch up queries to a slow database, or snmp for example - /** - * @param string $targetstring - * @param WeatherMap $map - * @param WeatherMapItem $item - * @return void - */ - function Register($targetstring, &$map, &$item) { - } - - // called before ReadData, to allow plugins to DO the prefetch of targets known from Register - /** - * @return void - */ - function Prefetch() { - } -} - -// template classes for the pre- and post-processor plugins -class WeatherMapPreProcessor { - /** - * @param WeatherMap $map - * @return bool - */ - function run(&$map) { - return false; - } -} - -class WeatherMapPostProcessor { - /** - * @param WeatherMap $map - * @return bool - */ - function run(&$map) { - return false; - } -} - -// *********************************************** - -// Links, Nodes and the Map object inherit from this class ultimately. -// Just to make some common code common. -class WeatherMapBase { - // Declared for static analysis (dynamically populated at runtime) - /** @var mixed */ - var $name; - - /** @var array */ - var $notes = []; - /** @var array */ - var $hints = []; - /** @var mixed */ - var $inherit_fieldlist; - - /** - * @param string $name - * @param mixed $value - * @return void - */ - function add_note($name,$value) { - wm_debug("Adding note $name='$value' to " . $this->name); - - $this->notes[$name] = $value; - } - - /** - * @param string $name - * @return mixed - */ - function get_note($name) { - if (isset($this->notes[$name])) { - // debug("Found note $name in ".$this->name." with value of ".$this->notes[$name].".\n"); - return ($this->notes[$name]); - } else { - // debug("Looked for note $name in ".$this->name." which doesn't exist.\n"); - return (null); - } - } - - /** - * @param string $name - * @param string $value - * @return void - */ - function add_hint($name,$value) { - wm_debug("Adding hint $name='$value' to " . $this->name); - - $this->hints[$name] = $value; - // warn("Adding hint $name to ".$this->my_type()."/".$this->name."\n"); - } - - /** - * @param string $name - * @param mixed $default Value returned when the hint is not set. - * @return mixed - */ - function get_hint($name, $default = null) { - if (isset($this->hints[$name])) { - // debug("Found hint $name in ".$this->name." with value of ".$this->hints[$name].".\n"); - return ($this->hints[$name]); - } else { - // debug("Looked for hint $name in ".$this->name." which doesn't exist.\n"); - return ($default); - } - } -} - -class WeatherMapConfigItem { - /** @var mixed */ - var $defined_in; - /** @var mixed */ - var $name; - /** @var mixed */ - var $value; - /** @var mixed */ - var $type; -} - -// The 'things on the map' class. More common code (mainly variables, actually) -class WeatherMapItem extends WeatherMapBase { - // Declared for static analysis (dynamically populated at runtime) - /** @var mixed */ - var $a; - /** @var mixed */ - var $b; - /** @var mixed */ - var $name; - /** @var mixed */ - var $notestext; - /** @var mixed */ - var $targets; - /** @var mixed */ - var $x; - /** @var mixed */ - var $y; - - /** @var mixed */ - var $owner; - - /** @var mixed */ - var $configline; - /** @var mixed */ - var $infourl; - /** @var mixed */ - var $overliburl; - /** @var mixed */ - var $overlibwidth; - /** @var mixed */ - var $overlibheight; - /** @var mixed */ - var $overlibcaption; - /** @var mixed */ - var $my_default; - /** @var mixed */ - var $defined_in; - /** @var mixed */ - var $config_override; // used by the editor to allow text-editing - - /** - * @return mixed - */ - function my_type() { - return 'ITEM'; - } -} +require_once('WeatherMap.constants.php'); class WeatherMap extends WeatherMapBase { // Declared for static analysis (dynamically populated at runtime) diff --git a/lib/WeatherMap.constants.php b/lib/WeatherMap.constants.php new file mode 100644 index 00000000..c7731417 --- /dev/null +++ b/lib/WeatherMap.constants.php @@ -0,0 +1,114 @@ +name); + + $this->notes[$name] = $value; + } + + /** + * Return a note, or null when it is not set. + * + * @param string $name + * @return mixed + */ + function get_note($name) { + if (isset($this->notes[$name])) { + // debug("Found note $name in ".$this->name." with value of ".$this->notes[$name].".\n"); + return ($this->notes[$name]); + } else { + // debug("Looked for note $name in ".$this->name." which doesn't exist.\n"); + return (null); + } + } + + /** + * Set a hint, a SET value from the map config. + * + * @param string $name + * @param string $value + * @return void + */ + function add_hint($name,$value) { + wm_debug("Adding hint $name='$value' to " . $this->name); + + $this->hints[$name] = $value; + // warn("Adding hint $name to ".$this->my_type()."/".$this->name."\n"); + } + + /** + * Return a hint, or $default when it is not set. + * + * @param string $name + * @param mixed $default Value returned when the hint is not set. + * @return mixed + */ + function get_hint($name, $default = null) { + if (isset($this->hints[$name])) { + // debug("Found hint $name in ".$this->name." with value of ".$this->hints[$name].".\n"); + return ($this->hints[$name]); + } else { + // debug("Looked for hint $name in ".$this->name." which doesn't exist.\n"); + return ($default); + } + } +} diff --git a/lib/WeatherMapConfigItem.class.php b/lib/WeatherMapConfigItem.class.php new file mode 100644 index 00000000..2ea478fd --- /dev/null +++ b/lib/WeatherMapConfigItem.class.php @@ -0,0 +1,55 @@ +ReadData() + /** + * Report whether this plugin handles the given TARGET string. + * + * @param string $targetstring + * @return bool + */ + function Recognise($targetstring) { + return false; + } + + // the actual ReadData + // returns an array of two values (in,out). -1,-1 if it couldn't get valid data + // configline is passed in, to allow for better error messages + // itemtype and itemname may be used as part of the target (e.g. for TSV source line) + // function ReadData($targetstring, $configline, $itemtype, $itemname, $map) { return ([-1,-1]); } + /** + * Read the in and out values for a target; -1 marks a value that could not be read. + * + * @param string $targetstring + * @param WeatherMap $map + * @param WeatherMapItem $item + * @return array [in, out, data timestamp] + */ + function ReadData($targetstring, &$map, &$item) { + return ([-1, -1, 0]); + } + + // pre-register a target + context, to allow a plugin to batch up queries to a slow database, or snmp for example + /** + * Queue a target ahead of ReadData() so a plugin can batch slow lookups. + * + * @param string $targetstring + * @param WeatherMap $map + * @param WeatherMapItem $item + * @return void + */ + function Register($targetstring, &$map, &$item) { + } + + // called before ReadData, to allow plugins to DO the prefetch of targets known from Register + /** + * Fetch the targets queued by Register() before ReadData() runs. + * + * @return void + */ + function Prefetch() { + } +} diff --git a/lib/WeatherMapItem.class.php b/lib/WeatherMapItem.class.php new file mode 100644 index 00000000..2147a232 --- /dev/null +++ b/lib/WeatherMapItem.class.php @@ -0,0 +1,96 @@ +toBe(3); + + $conf = $dir . '/map.conf'; + $png = $dir . '/map.png'; + $html = $dir . '/map.html'; + + file_put_contents($conf, $config); + + try { + // Bundled fonts and icons resolve against the plugin directory, as under the poller. + chdir($plugin); + + $GLOBALS['weathermap_warncount'] = 0; + + $map = new WeatherMap(); + // Static sources never call RRDtool; any existing executable passes its Init check. + $map->rrdtool = PHP_BINARY; + $map->imageuri = 'map.png'; + + expect($map->ReadConfig($conf))->toBeTrue(); + + $map->ReadData(); + $map->DrawMap($png); + + file_put_contents($html, $map->MakeHTML('wm_e2e_imap')); + + expect($GLOBALS['weathermap_warncount'])->toBe(0); + + expect(is_file($png))->toBeTrue(); + $size = getimagesize($png); + expect($size)->not->toBeFalse(); + expect([$size[0], $size[1], $size[2], $size['mime']])->toBe([660, 180, IMAGETYPE_PNG, 'image/png']); + + expect(is_file($html))->toBeTrue(); + $document = new DOMDocument(); + expect($document->loadHTML(file_get_contents($html), LIBXML_NOERROR | LIBXML_NOWARNING))->toBeTrue(); + + $xpath = new DOMXPath($document); + expect($xpath->query("//img[@id='wmapimage' and @src='map.png' and @usemap='#wm_e2e_imap']")->length)->toBe(1); + expect($xpath->query("//map[@name='wm_e2e_imap']")->length)->toBe(1); + + $hrefs = []; + + foreach ($xpath->query("//map[@name='wm_e2e_imap']/area") as $area) { + $hrefs[substr($area->getAttribute('id'), 0, 5)][$area->getAttribute('href')] = true; + + expect($area->getAttribute('coords'))->toMatch('/^\d+(,\d+)+$/'); + } + + expect(array_keys($hrefs['NODE:']))->toBe(['https://example.invalid/core', 'https://example.invalid/access']); + expect(array_keys($hrefs['LINK:']))->toBe(['https://example.invalid/uplink']); + + expect($map->links['uplink']->inpercent)->toEqualWithDelta(90.0, 0.001); + expect($map->links['uplink']->outpercent)->toEqualWithDelta(20.0, 0.001); + } finally { + chdir($cwd); + + foreach ([$conf, $png, $html] as $file) { + if (is_file($file)) { + unlink($file); + } + } + + rmdir($dir); + } +}); diff --git a/tests/Handoff/DataSourceContractTest.php b/tests/Handoff/DataSourceContractTest.php index 81a65296..b1856a06 100644 --- a/tests/Handoff/DataSourceContractTest.php +++ b/tests/Handoff/DataSourceContractTest.php @@ -9,13 +9,13 @@ describe('data source ReadData return contract', function (): void { it('base WeatherMapDataSource::ReadData() returns a 3-element [-1,-1,0] array', function (): void { - $source = file_get_contents(dirname(__DIR__, 2) . '/lib/WeatherMap.class.php'); + $source = file_get_contents(dirname(__DIR__, 2) . '/lib/WeatherMapDataSource.class.php'); expect($source)->toContain('return ([-1, -1, 0]);'); }); it('does not contain the old 2-element [-1,-1] return in ReadData', function (): void { - $source = file_get_contents(dirname(__DIR__, 2) . '/lib/WeatherMap.class.php'); + $source = file_get_contents(dirname(__DIR__, 2) . '/lib/WeatherMapDataSource.class.php'); // The commented-out old signature is allowed, but no live return with only two elements. $lines = explode("\n", $source); diff --git a/tests/Helpers/DataSourceHarness.php b/tests/Helpers/DataSourceHarness.php index cc27c7d9..6218fc4e 100644 --- a/tests/Helpers/DataSourceHarness.php +++ b/tests/Helpers/DataSourceHarness.php @@ -11,23 +11,18 @@ * Minimum environment needed to load and drive a datasource class. * * The datasource files are the only part of the plugin these tests exercise, so - * the IN/OUT indices and the WeatherMapDataSource base are declared here rather - * than pulling in the 4,500-line WeatherMap.class.php and its Cacti bindings. - * wm_debug() and wm_warn() come from the real WeatherMap.functions.php: that - * file declares them unconditionally, so a local stub would collide with any - * other test that loads it. + * only the engine constants and the real WeatherMapDataSource base are loaded, + * not WeatherMap.class.php and its Cacti bindings. Both are safe to load again + * later in the same process, so a test that also needs the engine can require + * WeatherMap.class.php after this file. wm_debug() and wm_warn() come from the + * real WeatherMap.functions.php: that file declares them unconditionally, so a + * local stub would collide with any other test that loads it. */ require_once __DIR__ . '/../bootstrap-unit.php'; require_once dirname(__DIR__, 2) . '/lib/WeatherMap.functions.php'; - -if (!defined('IN')) { - define('IN', 0); -} - -if (!defined('OUT')) { - define('OUT', 1); -} +require_once dirname(__DIR__, 2) . '/lib/WeatherMap.constants.php'; +require_once dirname(__DIR__, 2) . '/lib/WeatherMapDataSource.class.php'; if (!function_exists('cacti_escapeshellarg')) { function cacti_escapeshellarg($string, $quote = true) { @@ -35,26 +30,6 @@ function cacti_escapeshellarg($string, $quote = true) { } } -if (!class_exists('WeatherMapDataSource')) { - class WeatherMapDataSource { - public $local_data_id; - - public $down_cache = []; - - public function Init(&$map) { - return true; - } - - public function Recognise($targetstring) { - return false; - } - - public function ReadData($targetstring, &$map, &$item) { - return ([-1, -1, 0]); - } - } -} - /** * Build the $item stand-in a datasource ReadData() expects. * diff --git a/tests/Mutation/FixedBugRegressionTest.php b/tests/Mutation/FixedBugRegressionTest.php index 11d650b6..11efed27 100644 --- a/tests/Mutation/FixedBugRegressionTest.php +++ b/tests/Mutation/FixedBugRegressionTest.php @@ -237,14 +237,14 @@ function calc_pct(float $traffic, float $max): float { expect($time)->toBe(0); }); - it('source: WeatherMap.class.php base ReadData() returns [-1,-1,0]', function (): void { - $source = file_get_contents(dirname(__DIR__, 2) . '/lib/WeatherMap.class.php'); + it('source: WeatherMapDataSource.class.php base ReadData() returns [-1,-1,0]', function (): void { + $source = file_get_contents(dirname(__DIR__, 2) . '/lib/WeatherMapDataSource.class.php'); expect($source)->toContain('return ([-1, -1, 0]);'); }); - it('source: WeatherMap.class.php does NOT contain the old 2-element return stub', function (): void { - $source = file_get_contents(dirname(__DIR__, 2) . '/lib/WeatherMap.class.php'); + it('source: WeatherMapDataSource.class.php does NOT contain the old 2-element return stub', function (): void { + $source = file_get_contents(dirname(__DIR__, 2) . '/lib/WeatherMapDataSource.class.php'); // The old stub comment is kept for history; the live function body must not use it. // We check that no un-commented return of exactly [-1,-1] is present. diff --git a/tests/Smoke/PluginFilesSyntaxTest.php b/tests/Smoke/PluginFilesSyntaxTest.php index 41665262..47cfbd8e 100644 --- a/tests/Smoke/PluginFilesSyntaxTest.php +++ b/tests/Smoke/PluginFilesSyntaxTest.php @@ -49,7 +49,14 @@ function wm_smoke_check_syntax(string $path): ?string { $files = [ 'cli/cacti-mapper.php', 'lib/WeatherMap.class.php', + 'lib/WeatherMap.constants.php', 'lib/WeatherMap.functions.php', + 'lib/WeatherMapBase.class.php', + 'lib/WeatherMapConfigItem.class.php', + 'lib/WeatherMapDataSource.class.php', + 'lib/WeatherMapItem.class.php', + 'lib/WeatherMapPostProcessor.class.php', + 'lib/WeatherMapPreProcessor.class.php', 'lib/datasources/WeatherMapDataSource_fping.php', 'lib/datasources/WeatherMapDataSource_rrd.php', 'lib/poller-common.php', diff --git a/tests/Unit/EngineBaseClassDefaultsTest.php b/tests/Unit/EngineBaseClassDefaultsTest.php new file mode 100644 index 00000000..5cdd889c --- /dev/null +++ b/tests/Unit/EngineBaseClassDefaultsTest.php @@ -0,0 +1,50 @@ +Recognise('anything'))->toBeFalse(); + expect($source->ReadData('anything', $map, $item))->toBe([-1, -1, 0]); + }); + + it('runs base pre- and post-processors as no-ops', function (): void { + $map = null; + + expect((new WeatherMapPreProcessor())->run($map))->toBeFalse(); + expect((new WeatherMapPostProcessor())->run($map))->toBeFalse(); + }); + + it('returns stored notes and null for missing ones', function (): void { + $item = new WeatherMapItem(); + $item->notes['colour'] = 'red'; + + expect($item->get_note('colour'))->toBe('red'); + expect($item->get_note('missing'))->toBeNull(); + expect($item->my_type())->toBe('ITEM'); + }); +}); diff --git a/tests/Unit/EngineFileLoadingTest.php b/tests/Unit/EngineFileLoadingTest.php new file mode 100644 index 00000000..160b370a --- /dev/null +++ b/tests/Unit/EngineFileLoadingTest.php @@ -0,0 +1,128 @@ +&1', $lines, $status); + + return [$status, implode("\n", $lines)]; + } finally { + unlink($script); + } +} + +describe('engine files load standalone', function (): void { + it('defines the constants once and tolerates a second load', function (): void { + $lib = var_export(dirname(__DIR__, 2) . '/lib/WeatherMap.constants.php', true); + + [$status, $output] = wm_engine_load_run( + "require $lib;\n" + . "require $lib;\n" + . "echo json_encode(get_defined_constants(true)['user']);\n" + ); + + expect($status)->toBe(0); + expect(json_decode($output, true))->toBe([ + 'IN' => 0, + 'OUT' => 1, + 'WMCHANNELS' => 2, + 'CONFIG_TYPE_LITERAL' => 0, + 'CONFIG_TYPE_COLOR' => 1, + 'FMT_BITS_IN' => '{link:this:bandwidth_in:%2k}', + 'FMT_BITS_OUT' => '{link:this:bandwidth_out:%2k}', + 'FMT_UNFORM_IN' => '{link:this:bandwidth_in}', + 'FMT_UNFORM_OUT' => '{link:this:bandwidth_out}', + 'FMT_PERC_IN' => '{link:this:inpercent:%.2f}%', + 'FMT_PERC_OUT' => '{link:this:outpercent:%.2f}%', + 'X' => 0, + 'Y' => 1, + 'DISTANCE' => 2, + ]); + }); + + it('keeps a constant a caller defined first', function (): void { + $lib = var_export(dirname(__DIR__, 2) . '/lib/WeatherMap.constants.php', true); + + [$status, $output] = wm_engine_load_run("define('IN', 0);\nrequire $lib;\necho IN, OUT;\n"); + + expect($status)->toBe(0); + expect($output)->toBe('01'); + }); + + it('loads each base class file on its own', function (string $file, string $class, ?string $parent): void { + $path = var_export(dirname(__DIR__, 2) . '/lib/' . $file, true); + + [$status, $output] = wm_engine_load_run( + "require_once $path;\n" + . "\$object = new $class();\n" + . "echo get_class(\$object), '|', var_export(get_parent_class(\$object), true);\n" + ); + + expect($status)->toBe(0); + expect($output)->toBe($class . '|' . var_export($parent ?? false, true)); + })->with([ + 'datasource' => ['WeatherMapDataSource.class.php', 'WeatherMapDataSource', null], + 'pre-processor' => ['WeatherMapPreProcessor.class.php', 'WeatherMapPreProcessor', null], + 'post-processor' => ['WeatherMapPostProcessor.class.php', 'WeatherMapPostProcessor', null], + 'base' => ['WeatherMapBase.class.php', 'WeatherMapBase', null], + 'config item' => ['WeatherMapConfigItem.class.php', 'WeatherMapConfigItem', null], + 'item' => ['WeatherMapItem.class.php', 'WeatherMapItem', 'WeatherMapBase'], + ]); + + it('keeps the base class default behaviour', function (): void { + $lib = dirname(__DIR__, 2) . '/lib/'; + + [$status, $output] = wm_engine_load_run( + 'foreach (["WeatherMapDataSource", "WeatherMapPreProcessor", "WeatherMapPostProcessor", "WeatherMapItem"] as $class) {' . "\n" + . "\trequire_once " . var_export($lib, true) . " . \$class . '.class.php';\n" + . "}\n" + . "\$map = null;\n" + . "\$item = null;\n" + . "\$source = new WeatherMapDataSource();\n" + . "\$result = [\$source->Init(\$map), \$source->Recognise('static:1:2'), \$source->ReadData('static:1:2', \$map, \$item), \$source->Register('t', \$map, \$item), \$source->Prefetch()];\n" + . "\$result[] = (new WeatherMapPreProcessor())->run(\$map);\n" + . "\$result[] = (new WeatherMapPostProcessor())->run(\$map);\n" + . "\$result[] = (new WeatherMapItem())->my_type();\n" + . "echo json_encode(\$result);\n" + ); + + expect($status)->toBe(0); + expect(json_decode($output, true))->toBe([true, false, [-1, -1, 0], null, null, false, false, 'ITEM']); + }); + + it('loads the datasource base, then the harness, then the engine in one process', function (): void { + $root = dirname(__DIR__, 2); + + [$status, $output] = wm_engine_load_run( + // The engine finds its plugin directories relative to the working directory, as under the poller. + 'chdir(' . var_export($root, true) . ");\n" + . 'require_once ' . var_export($root . '/lib/WeatherMapDataSource.class.php', true) . ";\n" + . 'require_once ' . var_export($root . '/tests/Helpers/DataSourceHarness.php', true) . ";\n" + . 'require_once ' . var_export($root . '/lib/WeatherMap.class.php', true) . ";\n" + . "\$map = new WeatherMap();\n" + . "echo get_parent_class(\$map), '|', (new ReflectionClass('WeatherMapDataSource'))->getFileName(), '|', IN, OUT;\n" + ); + + expect($status)->toBe(0); + expect($output)->toBe('WeatherMapBase|' . $root . '/lib/WeatherMapDataSource.class.php|01'); + }); +}); diff --git a/tests/bin/patch-coverage.php b/tests/bin/patch-coverage.php index 21b04945..7d5e13c2 100644 --- a/tests/bin/patch-coverage.php +++ b/tests/bin/patch-coverage.php @@ -183,11 +183,10 @@ function changed_lines($base_ref) { // from the isolated unit process, though the table creation is exercised by // WeathermapInstallHooksTest. 'includes/database.php', - // Editor map-mutation actions: every function instantiates the 4,500-line - // WeatherMap engine (new WeatherMap + ReadConfig/WriteConfig), which cannot - // load in the isolated unit process - it redefines the IN/OUT constants and - // collides with the datasource test harness's WeatherMapDataSource stub. The - // editor save/delete workflow is covered by the Browser/E2E suites instead. + // Editor map-mutation actions: every function instantiates the WeatherMap + // engine (new WeatherMap + ReadConfig/WriteConfig) against an on-disk map + // and is excluded from the phpunit.xml coverage source. The editor + // save/delete workflow is covered by the Browser/E2E suites instead. 'lib/editor.actions.php', // CLI mapper: top-level Cacti bootstrap and network discovery that cannot // load in the isolated unit process. The random_int() substitutions are