Source
xxxxxxxxxx
self::executeCallbacks($this, $this->getAnnotationTokensByName($method_annotations, 'onBeforeOnce'), true);
<?php
/*
** Zabbix
** Copyright (C) 2001-2025 Zabbix SIA
**
** 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.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once 'vendor/autoload.php';
require_once dirname(__FILE__).'/../../include/defines.inc.php';
require_once dirname(__FILE__).'/../../include/hosts.inc.php';
require_once dirname(__FILE__).'/helpers/CDBHelper.php';
require_once dirname(__FILE__).'/helpers/CConfigHelper.php';
require_once dirname(__FILE__).'/helpers/CAPIHelper.php';
require_once dirname(__FILE__).'/helpers/CDataHelper.php';
require_once dirname(__FILE__).'/helpers/CExceptionHelper.php';
require_once dirname(__FILE__).'/helpers/CTestArrayHelper.php';
require_once dirname(__FILE__).'/helpers/CDateTimeHelper.php';
define('USER_ACTION_ADD', 'add');
define('USER_ACTION_UPDATE', 'update');
define('USER_ACTION_REMOVE', 'remove');
define('STRING_6000', str_repeat('long_string_', 500));
define('STRING_2200', substr(STRING_6000, 0, 2200));
define('STRING_2048', substr(STRING_6000, 0, 2048));
define('STRING_2000', substr(STRING_6000, 0, 2000));
define('STRING_1024', substr(STRING_6000, 0, 1024));
define('STRING_512', substr(STRING_6000, 0, 512));
define('STRING_255', substr(STRING_6000, 0, 255));
define('STRING_128', substr(STRING_6000, 0, 128));
define('STRING_64', substr(STRING_6000, 0, 64));
/**
* Base class of php unit tests.
*/
use PHPUnit\Framework\TestCase;
class CTest extends TestCase {
// Table that should be backed up at the test suite level.
protected static $suite_backup = null;
// Table that should be backed up at the test case level.
protected $case_backup = null;
// Table that should be backed up at the test case level once (for multiple case executions).
protected static $case_backup_once = null;
// zabbix.conf.php should be backed up at the test suite level.
protected static $suite_backup_config = false;
// zabbix.conf.php should be backed up at the test case level.
protected $case_backup_config = false;
// Name of the last executed test.
protected static $last_test_case = null;
// Test case data key.
protected $data_key = null;
// Lists of test case data set keys.
protected static $test_data_sets = [];
// Test case annotations.
protected $annotations = null;
// Test case warnings.
protected static $warnings = [];
// Skip test suite execution.
protected static $skip_suite = false;
// Callbacks that should be executed at the test case level.
protected $case_callbacks = [];
// Callbacks that should be executed at the test suite level.
protected static $suite_callbacks = [
'afterOnce' => [],
'beforeEach' => [],
'afterEach' => [],
'after' => []
];
// Instances counter to keep track of test count.
protected static $instances = 0;
// List of behaviors.
protected $behaviors = null;
/**