Files
iTop/test/application/DashboardLayoutTest.php
Pierre Goiffon 8578d18e7f Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts:
#	core/cmdbsource.class.inc.php
#	core/config.class.inc.php
#	core/displayablegraph.class.inc.php
#	core/log.class.inc.php
#	datamodels/2.x/itop-config-mgmt/dictionaries/tr.dict.itop-config-mgmt.php
#	datamodels/2.x/itop-knownerror-mgmt/dictionaries/tr.dict.itop-knownerror-mgmt.php
#	datamodels/2.x/itop-service-mgmt/dictionaries/tr.dict.itop-service-mgmt.php
#	datamodels/2.x/itop-tickets/tr.dict.itop-tickets.php
#	datamodels/2.x/itop-welcome-itil/tr.dict.itop-welcome-itil.php
#	dictionaries/tr.dictionary.itop.core.php
#	dictionaries/tr.dictionary.itop.ui.php
#	pages/UI.php
#	setup/itopdesignformat.class.inc.php
#	test/core/LogAPITest.php
#	test/integration/iTopModulesPhpVersionChecklistTest.php
#	test/postbuild_integration/SetupCssIntegrityChecklistTest.php
#	test/postbuild_integration/iTopModuleXmlInstallationChecklistTest.php
#	test/status/StatusTest.php
2022-01-10 16:15:00 +01:00

70 lines
2.4 KiB
PHP

<?php
/**
* Copyright (C) 2013-2021 Combodo SARL
*
* This file is part of iTop.
*
* iTop 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, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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
*/
use Combodo\iTop\Test\UnitTest\ItopTestCase;
/**
* @covers utils
*/
class DashboardLayoutTest extends ItopTestCase
{
public function setUp()
{
parent::setUp();
require_once APPROOT.'application/dashboardlayout.class.inc.php';
}
/**
* @return array
*/
public function GetDashletCoordinatesProvider()
{
return array(
'OneColLayout-Cell0' => array('DashboardLayoutOneCol', 0, array(0, 0)),
'OneColLayout-Cell1' => array('DashboardLayoutOneCol', 1, array(0, 1)),
'TwoColsLayout-Cell0' => array('DashboardLayoutTwoCols', 0, array(0, 0)),
'TwoColsLayout-Cell1' => array('DashboardLayoutTwoCols', 1, array(1, 0)),
'TwoColsLayout-Cell2' => array('DashboardLayoutTwoCols', 2, array(0, 1)),
'TwoColsLayout-Cell3' => array('DashboardLayoutTwoCols', 3, array(1, 1)),
'ThreeColsLayout-Cell0' => array('DashboardLayoutThreeCols', 0, array(0, 0)),
'ThreeColsLayout-Cell1' => array('DashboardLayoutThreeCols', 1, array(1, 0)),
'ThreeColsLayout-Cell2' => array('DashboardLayoutThreeCols', 2, array(2, 0)),
'ThreeColsLayout-Cell3' => array('DashboardLayoutThreeCols', 3, array(0, 1)),
'ThreeColsLayout-Cell4' => array('DashboardLayoutThreeCols', 4, array(1, 1)),
'ThreeColsLayout-Cell5' => array('DashboardLayoutThreeCols', 5, array(2, 1)),
);
}
/**
* @param string $sDashboardLayoutClass
* @param int $iCellIdx
* @param array $aExpectedCoordinates
* @dataProvider GetDashletCoordinatesProvider
* @since N°2735
*/
public function testGetDashletCoordinates($sDashboardLayoutClass, $iCellIdx, $aExpectedCoordinates)
{
$oDashboardLayout = new $sDashboardLayoutClass();
$aDashletCoordinates = $oDashboardLayout->GetDashletCoordinates($iCellIdx);
$this->assertEquals($aExpectedCoordinates,$aDashletCoordinates);
}
}