Source
* @param boolean $button for 'Item pattern' only: use 'Add new data set' button if true, or select from context menu if false
<?php
/*
** 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 Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../../include/CWebTest.php';
require_once dirname(__FILE__).'/../behaviors/CMessageBehavior.php';
define('LOGIN', true);
define('WITHOUT_LOGIN', false);
define('DEFAULT_PAGE', null);
/**
* @backup widget
*
* @dataSource AllItemValueTypes
*
* @onBefore prepareData
*/
class testDashboardPieChartWidget extends testWidgets {
protected static $dashboard_id;
protected static $disposable_dashboard_id;
protected static $item_ids;
const TYPE_ITEM_PATTERN = 'Item pattern';
const TYPE_ITEM_LIST = 'Item list';
const TYPE_DATA_SET_CLONE = 'Clone';
const HOST_NAME_ITEM_LIST = 'pie-chart-item-list';
const HOST_NAME_SCREENSHOTS = 'pie-chart-display';
const PAGE_1 = 'Page 1';
const PAGE_2 = 'Page 2';
/**
* Attach MessageBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [
CMessageBehavior::class,
CTableBehavior::class
];
}
/**
* Create the initial data and set static variables.
*/
public function prepareData() {
// For faster tests set Pie chart as the default widget type.
DB::delete('profiles', ['idx' => 'web.dashboard.last_widget_type', 'userid' => 1]);
DB::insert('profiles', [
[
'profileid' => 99999,