-
-
Notifications
You must be signed in to change notification settings - Fork 529
/
Copy pathmodDashboardWidgetTest.php
66 lines (63 loc) · 2.14 KB
/
modDashboardWidgetTest.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
63
64
65
66
<?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 modDashboardWidget
*/
class modDashboardWidgetTest extends MODxTestCase {
/** @var modDashboardWidget $widget */
public $widget;
/**
* Load some utility classes this case uses
* @return void
*/
public function setUp(): void
{
parent::setUp();
$this->modx->loadClass('modDashboard');
$this->modx->loadClass('modDashboardWidget');
$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';
$this->widget = $this->modx->newObject('modDashboardWidget');
$this->widget->fromArray(array(
'name' => 'w_recentlyeditedresources',
'description' => 'w_recentlyeditedresources_desc',
'type' => 'file',
'size' => 'half',
'content' => '[[++manager_path]]controllers/default/dashboard/widget.grid-rer.php',
'namespace' => 'core',
'lexicon' => 'core:dashboards',
));
}
/**
* Test the content rendering of a widget
*/
public function testGetContent() {
/** @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 */
$output = $this->widget->getContent($controller);
$this->assertNotEmpty($output);
}
}