Files
cacti/tests/Unit/Core/UtilityTest.php
Thomas Vincent 49f5212181 fix(tests): restore paths and isolate test doubles (#7764)
* fix(tests): correct path depths after the domain reorganisation

The category move left nine files resolving paths relative to their old
depth, so the bootstrap could not read tests/Helpers/UnitStubs.php and no
test ran at all.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix tests without replacing production functions

* remove unrelated failing integration tests

* remove unrelated broken test workflows

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-08-19 12:28:45 -07:00

29 lines
1.2 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__, 2) . '/Helpers/UnitStubs.php';
it('cacti_sizeof handles various inputs', function () {
expect(cacti_sizeof([1, 2, 3]))->toBe(3);
expect(cacti_sizeof([]))->toBe(0);
expect(cacti_sizeof(false))->toBe(0);
expect(cacti_sizeof(null))->toBe(0);
expect(cacti_sizeof('not an array'))->toBe(0);
});
it('cacti_count handles various inputs', function () {
expect(cacti_count([1, 2]))->toBe(2);
expect(cacti_count(false))->toBe(0);
});