Files
cacti/tests/Unit/GlobalPathConstantsTest.php
T
TheWitnessandCopilot 9d8bf959f5 fix: Fixing Unit tests (#6790)
* fix: Fixing Unit tests

* fix: Include helper remove the defines

* Enable Pest tests for validation

* Update tests/Unit/ScriptsHardeningTest.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/Helpers/CactiStubs.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/Unit/SsHstatsTest.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update rector.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tests/Unit/HtmlEscapeTest.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: Remove comments that are no longer required

* fix: Move xdebug to the correct location

* fix: Be consistent with includes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-07 12:57:00 -05:00

52 lines
1.9 KiB
PHP

<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2026 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDtool-based Graphing Solution |
+-------------------------------------------------------------------------+
*/
require_once dirname(__DIR__) . '/Helpers/CactiStubs.php';
require_once dirname(__DIR__, 2) . '/include/global.php';
/**
* Test for PR #6702: Verify CACTI_PATH_MIBS constant is defined
*/
test('CACTI_PATH_MIBS constant is defined in global_path.php', function () {
// Simulate config array that would be set before including global_path.php
global $config;
expect(defined('CACTI_PATH_MIBS'))
->toBeTrue('CACTI_PATH_MIBS constant should be defined');
});
test('CACTI_PATH_MIBS uses mibs_path from config', function () {
global $config;
$expectedPath = CACTI_PATH_BASE . '/mibs';
expect(CACTI_PATH_MIBS)
->toBe($expectedPath, 'CACTI_PATH_MIBS should match config mibs_path');
});
test('CACTI_PATH_MIBS constant matches other CACTI_PATH_ patterns', function () {
global $config;
// Verify it follows the same pattern as other path constants
expect(defined('CACTI_PATH_MIBS'))
->toBeTrue()
->and(defined('CACTI_PATH_BASE'))
->toBeTrue('Other CACTI_PATH_ constants should also be defined')
->and(CACTI_PATH_MIBS)
->toBeString()
->and(strlen(CACTI_PATH_MIBS))
->toBeGreaterThan(0, 'CACTI_PATH_MIBS should not be empty');
});