-
-
Notifications
You must be signed in to change notification settings - Fork 529
/
Copy pathmodDashboardTest.php
62 lines (59 loc) · 1.97 KB
/
modDashboardTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
* This file is part of the MODX Revolution package.
*
* Copyright (c) MODX, LLC
*
* For complete copyright and license information, see the COPYRIGHT and LICENSE
* files found in the top-level directory of this distribution.
*
* @package modx-test
*/
/**
* Tests related to the modDashboard class.
*
* @package modx-test
* @subpackage modx
* @group Model
* @group Dashboard
* @group modDashboard
*/
class modDashboardTest extends MODxTestCase {
/**
* Load some utility classes this case uses
* @return void
*/
public function setUp(): void
{
parent::setUp();
$this->modx->loadClass('modDashboard');
$this->modx->loadClass('modManagerController',MODX_CORE_PATH.'model/modx/',true,true);
$this->modx->loadClass('modManagerControllerDeprecated',MODX_CORE_PATH.'model/modx/',true,true);
require_once MODX_MANAGER_PATH.'controllers/default/welcome.class.php';
}
/**
* Ensure the static getDefaultDashboard method works, returning the default dashboard for the user
*/
public function testGetDefaultDashboard() {
/** @var modDashboard $dashboard */
$dashboard = modDashboard::getDefaultDashboard($this->modx);
$this->assertInstanceOf('modDashboard',$dashboard);
}
/**
* Ensure the rendering of the dashboard works properly
*/
public function testRender() {
/** @var modManagerController $controller Fake running the welcome controller */
$controller = new WelcomeManagerController($this->modx,array(
'namespace' => 'core',
'namespace_name' => 'core',
'namespace_path' => MODX_MANAGER_PATH,
'lang_topics' => 'dashboards',
'controller' => 'system/dashboards',
));
/** @var modDashboard $dashboard */
$dashboard = modDashboard::getDefaultDashboard($this->modx);
$output = $dashboard->render($controller);
$this->assertNotEmpty($output);
}
}