|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* Mission Plugin Tests |
|
6
|
|
|
* |
|
7
|
|
|
* these tests are integrated into the system unit tests (see start.php) |
|
8
|
|
|
* the functions that are tested are in a library, which is registered and loaded (see start.php) |
|
9
|
|
|
* |
|
10
|
|
|
* these tests test that the plugin is installed and activated |
|
11
|
|
|
* these tests DO NOT access the database |
|
12
|
|
|
* |
|
13
|
|
|
* to run the tests integrated into the core tests: |
|
14
|
|
|
* - Administration page | Develop | Tools | Unit Tests | (press Run) |
|
15
|
|
|
* -- or -- |
|
16
|
|
|
* - http://127.0.0.1/gcconnex/engine/tests/suite.php |
|
17
|
|
|
* |
|
18
|
|
|
* to run independently of the core tests: |
|
19
|
|
|
* - requires install and activate ufcoe_testable plugin from |
|
20
|
|
|
* git clone [email protected]:ufcoe/Elgg-ufcoe_testable.git ufcoe_testable |
|
21
|
|
|
* - Administration page | Develop | Plugin Tests | (click Micro Missions Run tests!) |
|
22
|
|
|
* -- or -- |
|
23
|
|
|
* - http://127.0.0.1/gcconnex/testable/run/missions |
|
24
|
|
|
*/ |
|
25
|
|
|
class MissionPluginTest extends ElggCoreUnitTest { |
|
26
|
|
|
|
|
27
|
|
|
public function testMissionActionsMustBeRegistered() { |
|
28
|
|
|
//global $CONFIG; |
|
29
|
|
|
|
|
30
|
|
|
$this->assertTrue(array_key_exists('missions/post-mission-first-form', _elgg_services()->actions->getAllActions())); |
|
31
|
|
|
$this->assertTrue(array_key_exists('missions/post-mission-second-form', _elgg_services()->actions->getAllActions())); |
|
32
|
|
|
$this->assertTrue(array_key_exists('missions/post-mission-third-form', _elgg_services()->actions->getAllActions())); |
|
33
|
|
|
$this->assertTrue(array_key_exists('missions/delete-mission', _elgg_services()->actions->getAllActions())); |
|
34
|
|
|
$this->assertTrue(array_key_exists('missions/search-simple', _elgg_services()->actions->getAllActions())); |
|
35
|
|
|
$this->assertTrue(array_key_exists('missions/advanced-search-form', _elgg_services()->actions->getAllActions())); |
|
36
|
|
|
$this->assertTrue(array_key_exists('missions/application-form', _elgg_services()->actions->getAllActions())); |
|
37
|
|
|
$this->assertTrue(array_key_exists('missions/accept-invite', _elgg_services()->actions->getAllActions())); |
|
38
|
|
|
$this->assertTrue(array_key_exists('missions/decline-invite', _elgg_services()->actions->getAllActions())); |
|
39
|
|
|
$this->assertTrue(array_key_exists('missions/invite-user', _elgg_services()->actions->getAllActions())); |
|
40
|
|
|
$this->assertTrue(array_key_exists('missions/remove-applicant', _elgg_services()->actions->getAllActions())); |
|
41
|
|
|
$this->assertTrue(array_key_exists('missions/change-mission-form', _elgg_services()->actions->getAllActions())); |
|
42
|
|
|
//$this->assertTrue(array_key_exists('missions/remove-pending-invites', _elgg_services()->actions->getAllActions())); |
|
43
|
|
|
$this->assertTrue(array_key_exists('missions/opt-from-main', _elgg_services()->actions->getAllActions())); |
|
44
|
|
|
$this->assertTrue(array_key_exists('missions/cancel-mission', _elgg_services()->actions->getAllActions())); |
|
45
|
|
|
$this->assertTrue(array_key_exists('missions/complete-mission', _elgg_services()->actions->getAllActions())); |
|
46
|
|
|
$this->assertTrue(array_key_exists('missions/feedback-form', _elgg_services()->actions->getAllActions())); |
|
47
|
|
|
$this->assertTrue(array_key_exists('missions/refine-my-missions-form', _elgg_services()->actions->getAllActions())); |
|
48
|
|
|
$this->assertTrue(array_key_exists('missions/reopen-mission', _elgg_services()->actions->getAllActions())); |
|
49
|
|
|
|
|
50
|
|
|
$this->assertTrue(array_key_exists('missions/admin-form', _elgg_services()->actions->getAllActions())); |
|
51
|
|
|
$this->assertTrue(array_key_exists('missions/change-entities-per-page', _elgg_services()->actions->getAllActions())); |
|
52
|
|
|
$this->assertTrue(array_key_exists('missions/duplicate-mission', _elgg_services()->actions->getAllActions())); |
|
53
|
|
|
$this->assertTrue(array_key_exists('missions/endorse-user', _elgg_services()->actions->getAllActions())); |
|
54
|
|
|
$this->assertTrue(array_key_exists('missions/graph-data-form', _elgg_services()->actions->getAllActions())); |
|
55
|
|
|
$this->assertTrue(array_key_exists('missions/graph-interval-form', _elgg_services()->actions->getAllActions())); |
|
56
|
|
|
$this->assertTrue(array_key_exists('missions/mission-invite-selector', _elgg_services()->actions->getAllActions())); |
|
57
|
|
|
$this->assertTrue(array_key_exists('missions/mission-offer', _elgg_services()->actions->getAllActions())); |
|
58
|
|
|
$this->assertTrue(array_key_exists('missions/post-mission-skill-match', _elgg_services()->actions->getAllActions())); |
|
59
|
|
|
$this->assertTrue(array_key_exists('missions/pre-create-opportunity', _elgg_services()->actions->getAllActions())); |
|
60
|
|
|
$this->assertTrue(array_key_exists('missions/remove-department-from-graph', _elgg_services()->actions->getAllActions())); |
|
61
|
|
|
$this->assertTrue(array_key_exists('missions/wire-post', _elgg_services()->actions->getAllActions())); |
|
62
|
|
|
|
|
63
|
|
|
$this->assertTrue(elgg_action_exists('missions/post-mission-first-form')); |
|
64
|
|
|
$this->assertTrue(elgg_action_exists('missions/post-mission-second-form')); |
|
65
|
|
|
$this->assertTrue(elgg_action_exists('missions/post-mission-third-form')); |
|
66
|
|
|
$this->assertTrue(elgg_action_exists('missions/delete-mission')); |
|
67
|
|
|
$this->assertTrue(elgg_action_exists('missions/search-simple')); |
|
68
|
|
|
$this->assertTrue(elgg_action_exists('missions/advanced-search-form')); |
|
69
|
|
|
$this->assertTrue(elgg_action_exists('missions/application-form')); |
|
70
|
|
|
$this->assertTrue(elgg_action_exists('missions/accept-invite')); |
|
71
|
|
|
$this->assertTrue(elgg_action_exists('missions/decline-invite')); |
|
72
|
|
|
$this->assertTrue(elgg_action_exists('missions/invite-user')); |
|
73
|
|
|
$this->assertTrue(elgg_action_exists('missions/remove-applicant')); |
|
74
|
|
|
$this->assertTrue(elgg_action_exists('missions/change-mission-form')); |
|
75
|
|
|
//$this->assertTrue(elgg_action_exists('missions/remove-pending-invites')); |
|
76
|
|
|
$this->assertTrue(elgg_action_exists('missions/opt-from-main')); |
|
77
|
|
|
$this->assertTrue(elgg_action_exists('missions/cancel-mission')); |
|
78
|
|
|
$this->assertTrue(elgg_action_exists('missions/complete-mission')); |
|
79
|
|
|
$this->assertTrue(elgg_action_exists('missions/feedback-form')); |
|
80
|
|
|
$this->assertTrue(elgg_action_exists('missions/refine-my-missions-form')); |
|
81
|
|
|
$this->assertTrue(elgg_action_exists('missions/reopen-mission')); |
|
82
|
|
|
|
|
83
|
|
|
$this->assertTrue(elgg_action_exists('missions/admin-form')); |
|
84
|
|
|
$this->assertTrue(elgg_action_exists('missions/change-entities-per-page')); |
|
85
|
|
|
$this->assertTrue(elgg_action_exists('missions/duplicate-mission')); |
|
86
|
|
|
$this->assertTrue(elgg_action_exists('missions/endorse-user')); |
|
87
|
|
|
$this->assertTrue(elgg_action_exists('missions/graph-data-form')); |
|
88
|
|
|
$this->assertTrue(elgg_action_exists('missions/graph-interval-form')); |
|
89
|
|
|
$this->assertTrue(elgg_action_exists('missions/mission-invite-selector')); |
|
90
|
|
|
$this->assertTrue(elgg_action_exists('missions/mission-offer')); |
|
91
|
|
|
$this->assertTrue(elgg_action_exists('missions/post-mission-skill-match')); |
|
92
|
|
|
$this->assertTrue(elgg_action_exists('missions/pre-create-opportunity')); |
|
93
|
|
|
$this->assertTrue(elgg_action_exists('missions/remove-department-from-graph')); |
|
94
|
|
|
$this->assertTrue(elgg_action_exists('missions/wire-post')); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function testMissionEntityMustBeRegistered() { |
|
98
|
|
|
$entities = get_registered_entity_types(); |
|
99
|
|
|
$this->assertTrue(in_array("mission", $entities['object'])); |
|
100
|
|
|
$this->assertTrue(in_array("mission-feedback", $entities['object'])); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function testMissionViewtypesMustBeRegistered() { |
|
104
|
|
|
$this->assertTrue(elgg_view_exists('missions/element-select')); |
|
105
|
|
|
$this->assertTrue(elgg_view_exists('missions/add-skill')); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/*public function testMissionMenuMustBeRegistered() { |
|
109
|
|
|
$this->assertTrue(elgg_is_menu_item_registered('user_menu', 'mission_main')); |
|
110
|
|
|
}*/ |
|
111
|
|
|
|
|
112
|
|
|
/*public function testMissionPageHandlerMustBeRegistered() { |
|
113
|
|
|
//global $CONFIG; |
|
114
|
|
|
$expected = 'missions_main_page_handler'; |
|
115
|
|
|
$actual = _elgg_services()->hooks->hasHandler('pagehandler', $expected); |
|
116
|
|
|
$this->assertTrue($actual); |
|
117
|
|
|
}*/ |
|
118
|
|
|
|
|
119
|
|
|
public function testLanguageStringsMustBeLoaded_En() { |
|
120
|
|
|
$expected = ",A,B,C"; |
|
121
|
|
|
$actual = elgg_get_plugin_setting('language_string', 'missions'); |
|
122
|
|
|
$this->assertIdentical($expected, $actual); |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
public function testDayStringsMustBeLoaded_En() { |
|
126
|
|
|
$expected = 'missions:mon,missions:tue,missions:wed,missions:thu,missions:fri,missions:sat,missions:sun'; |
|
127
|
|
|
$actual = elgg_get_plugin_setting('day_string', 'missions'); |
|
128
|
|
|
$this->assertIdentical($expected, $actual); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
public function testHourStringsMustBeLoaded() { |
|
132
|
|
|
$expected = ",00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23"; |
|
133
|
|
|
$actual = elgg_get_plugin_setting('hour_string', 'missions'); |
|
134
|
|
|
$this->assertIdentical($expected, $actual); |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
public function testMinuteStringsMustBeLoaded() { |
|
138
|
|
|
$expected = ",00,15,30,45"; |
|
139
|
|
|
$actual = elgg_get_plugin_setting('minute_string', 'missions'); |
|
140
|
|
|
$this->assertIdentical($expected, $actual); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
public function testSecurityStringsMustBeLoaded() { |
|
144
|
|
|
$expected = ",missions:reliability,missions:enhanced_reliability,missions:secret,missions:top_secret"; |
|
145
|
|
|
$actual = elgg_get_plugin_setting('security_string', 'missions'); |
|
146
|
|
|
$this->assertIdentical($expected, $actual); |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
public function testTimezoneStringsMustBeLoaded_En() { |
|
150
|
|
|
$expected = ",missions:timezone:three_half,missions:timezone:four,missions:timezone:five,missions:timezone:six,missions:timezone:seven,missions:timezone:eight,missions:timezone:nine"; |
|
151
|
|
|
$actual = elgg_get_plugin_setting('timezone_string', 'missions'); |
|
152
|
|
|
$this->assertIdentical($expected, $actual); |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
public function testTimeRateStringsMustBeLoaded() { |
|
156
|
|
|
$expected = "missions:total,missions:per_day,missions:per_week,missions:per_month"; |
|
157
|
|
|
$actual = elgg_get_plugin_setting('time_rate_string', 'missions'); |
|
158
|
|
|
$this->assertIdentical($expected, $actual); |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
public function testOpportunityTypeStringsMustBeLoaded_En() { |
|
162
|
|
|
$expected = "missions:micro_mission,missions:job_swap,missions:mentoring,missions:shadowing,missions:peer_coaching,missions:skill_sharing,missions:job_sharing"; |
|
163
|
|
|
$actual = elgg_get_plugin_setting('opportunity_type_string', 'missions'); |
|
164
|
|
|
$this->assertIdentical($expected, $actual); |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
public function testProvinceStringsMustBeLoaded_En() { |
|
168
|
|
|
$expected = "missions:alberta,missions:british_columbia,missions:manitoba,missions:new_brunswick,missions:newfoundland_and_labrador,missions:northwest_territories,missions:nova_scotia,missions:nunavut,missions:ontario,missions:prince_edward_island,missions:quebec,missions:saskatchewan,missions:yukon,missions:national_capital_region"; |
|
169
|
|
|
$actual = elgg_get_plugin_setting('province_string', 'missions'); |
|
170
|
|
|
$this->assertIdentical($expected, $actual); |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
public function testProgramAreaStringsMustBeLoaded_En() { |
|
174
|
|
|
$expected = ",missions:science,missions:information_technology,missions:administration,missions:human_resources,missions:finance,missions:legal_regulatory,missions:security_enforcement,missions:communications,missions:policy,missions:client_service"; |
|
175
|
|
|
$actual = elgg_get_plugin_setting('program_area_string', 'missions'); |
|
176
|
|
|
$this->assertIdentical($expected, $actual); |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
public function testDeclineReasonStringsMustBeLoaded_En() { |
|
180
|
|
|
$expected = ",missions:decline:workload,missions:decline:interest,missions:decline:engagement,missions:decline:approval,missions:other"; |
|
181
|
|
|
$actual = elgg_get_plugin_setting('decline_reason_string', 'missions'); |
|
182
|
|
|
$this->assertIdentical($expected, $actual); |
|
183
|
|
|
} |
|
184
|
|
|
} |