-
-
Notifications
You must be signed in to change notification settings - Fork 529
/
Copy pathmodActionDomTest.php
79 lines (71 loc) · 2.37 KB
/
modActionDomTest.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
67
68
69
70
71
72
73
74
75
76
77
78
79
<?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 modMail class.
*
* @package modx-test
* @subpackage modx
* @group Model
* @group FormCustomization
* @group modActionDom
*/
class modActionDomTest extends MODxTestCase {
public function setUp(): void
{
parent::setUp();
}
/**
* @param string $expected
* @param string $ruleType
* @param string $name
* @param string $value
* @param string $container
* @dataProvider providerApply
*/
public function testApply($expected,$ruleType,$name,$value,$container) {
/** @var modActionDom $rule */
$rule = $this->modx->newObject('modActionDom');
$rule->fromArray(array(
'set' => 0,
'action' => 1,
'xtype' => '',
'active' => true,
'rule' => $ruleType,
'name' => $name,
'value' => $value,
'container' => $container,
'for_parent' => 0,
'rank' => 0,
));
$content = $rule->apply(1);
$this->assertEquals($expected,$content);
}
/**
* @return array
*/
public function providerApply() {
return array(
array('MODx.hideField("modx-panel-resource",["description"]);',
'fieldVisible','description',0,'modx-panel-resource'),
array('MODx.renameLabel("modx-panel-resource",["published"],["Active"]);',
'fieldTitle','published','Active','modx-panel-resource'),
array('MODx.renameTab("modx-resource-settings","Other Settings");',
'tabTitle','modx-resource-settings','Other Settings','modx-resource-tabs'),
array('MODx.hideRegion("modx-resource-tabs","modx-resource-settings");',
'tabVisible','modx-resource-settings',0,'modx-resource-tabs'),
array('MODx.addTab("modx-resource-tabs",{title:"Other Tab",id:"tab-other"});',
'tabNew','tab-other','Other Tab','modx-resource-tabs'),
array('MODx.moveTV(["tv15"],"modx-resource-settings");',
'tvMove','tv15','modx-resource-settings','modx-panel-resource'),
);
}
}