Odyssey
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TestCompassSingleNodeSelection Class Reference
Inheritance diagram for TestCompassSingleNodeSelection:

Public Member Functions

 setUp ()
 
 test_top_level_user_activity_node_without_wrapper ()
 
 test_top_level_user_activity_node_with_full_wrapper ()
 
 test_top_level_secure_email_node_without_wrapper ()
 
 test_top_level_secure_email_node_with_full_wrapper ()
 
 test_single_nested_node_user_info_without_wrapper ()
 
 test_single_nested_node_user_info_with_full_wrapper ()
 
 test_single_nested_node_failed_login_without_wrapper ()
 
 test_single_nested_node_failed_login_with_full_wrapper ()
 
 test_single_nested_node_last_login_without_wrapper ()
 
 test_single_nested_node_last_login_with_full_wrapper ()
 

Protected Member Functions

 mockJson ()
 
 topLevelUserActivityNode ()
 
 topLevelUserActivityNodeWithWrapper ()
 
 topLevelSecureEmailNode ()
 
 topLevelSecureEmailNodeWithWrapper ()
 
 singleNestedNodeUserInfo ()
 
 fullSingleNestedNodeUserInfo ()
 
 singleNestedNodeFailedLogin ()
 
 singleNestedNodeWithWrapperFailedLogin ()
 
 singleNestedNodeLastLogin ()
 
 singleNestedNodeWithWrapperLastLogin ()
 

Protected Attributes

 $CompassObj = null
 
 $HB_ENV
 
 $json = ''
 
 $json_path = 'banking/library/menu-creators/compass-menu-config.json'
 

Detailed Description

Unit test for the Compass Menu functionality, a WIP. Test that the single node selection works, whether top level or nested selections. AssertSame() used over assertEquals() because it is more strict(ish,) unit compares both type and value.

Definition at line 14 of file TestCompassSingleNodeSelection.php.

Member Function Documentation

◆ fullSingleNestedNodeUserInfo()

TestCompassSingleNodeSelection::fullSingleNestedNodeUserInfo ( )
protected

Expected response when we request a single nested node with the full_node param true. $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'dropdown-user-menu-ul-li', true);

Returns
string

Definition at line 280 of file TestCompassSingleNodeSelection.php.

281  {
282  return ' <li id="dropdown-user-menu-ul-li">
283  <div class="col-xs-12">
284  <div id="update-email" class="k-block hcu-alert-block">
285  <div id="email-alert-icon-block" class="hcu-alert-block-icon">
286 <i id="email-alert-icon" class="fa fa-2x fa-envelope"></i></div>
287 &nbsp;
288  <div id="email-message-block-text" class="hcu-alert-block-text">
289 <span id="email-message-title">Current email is</span><br>
290 <label id="email-message-label"> <p id="email-message-p">
291 mike@homecu.net</p>
292 </label></div>
293 <hr>
294 <a id="update-email-link" href="http://localhost:8000/banking/hcuProfileEmail.prg?cu=SCRUBCU">
295 Update Now</a></div>
296 </div>
297 </li>
298 ';
299  }

◆ mockJson()

TestCompassSingleNodeSelection::mockJson ( )
protected

Mock the JSON returned from hcuFunctions.i->CompassMenuJson().

Returns
string

Definition at line 185 of file TestCompassSingleNodeSelection.php.

186  {
187  return ' {"logout":{"display":"Sign Out","icon":"power-off","action":"exit","script":"hcuLogout.prg"},'
188  . '"activity":{"display":"User Activity","icon":"bell","count":0,"menuid":"33","script":'
189  . '"hcuUserActivity.prg","action":"menu"},"messages":{"display":"Secure Message","icon":'
190  . '"comments","count":"0","menuid":"47","script":"hcuSecureMail.prg","action":"menu"},'
191  . '"status":{"display":"Login Status","icon":"tasks","count":0,"endpoint":"http:\/\/localhost:'
192  . '8000\/banking\/hcuAccountStatus.prg?cu=SCRUBCU","action":"popup","prior":{"title":'
193  . '"Last Successful Login","date":"Tue Nov 12, 2019 09:17am","level":"info"},"fail":'
194  . '{"title":"Last Failed Login","date":"Tue Nov 12, 2019 09:00am","level":"info"},'
195  . '"system":{"title":"Account Status as of ","date":"Fri May 23, 2008 04:32pm","level":'
196  . '"info"}},"user":{"display":"User Info","icon":"user","count":0,"action":"popup",'
197  . '"email":{"title":"Current email is","message":"mike@homecu.net","icon":"envelope",'
198  . '"level":"info","link":"Update Now","url":"http:\/\/localhost:8000\/banking\/'
199  . 'hcuProfileEmail.prg?cu=SCRUBCU","script":"hcuProfileEmail.prg","menuid":"52","action":"menu"}}}';
200 
201  }

◆ setUp()

TestCompassSingleNodeSelection::setUp ( )

Set the properties used by all tests. HB_ENV is an injected dependency for CompassMenu.

Definition at line 40 of file TestCompassSingleNodeSelection.php.

41  {
42  $this->json = $this->mockJson();
43  $this->HB_ENV['MC'] = new hcu_talk_base('en_US');
44  $this->CompassObj = new CompassMenu($this->HB_ENV);
45  }

◆ singleNestedNodeFailedLogin()

TestCompassSingleNodeSelection::singleNestedNodeFailedLogin ( )
protected

This is the response for failed-login without a wrapper. Note it has sub-members tested in another test.

Returns
string

Definition at line 305 of file TestCompassSingleNodeSelection.php.

306  {
307  return ' <div id="failed-login-col-xs" class="col-xs-12">
308  <div id="failed-login-form-group" class="form-group">
309  <div id="failed-login-k-b" class="k-block">
310  <div id="failed-login-summary-block" class="hcu-summary-block">
311  <div id="failed-login-summary-row" class="summary-row">
312  <div id="failed-login-summary-desc" class="summary-desc">
313 <label id="failed-login-summary-desc-label" class="control-label">Last Failed Login</label></div>
314  <div id="failed-login-summary-value" class="summary-value">
315  <p id="failed-login-summary-desc-p" class="form-control-static">
316 Tue Nov 12, 2019 09:00am</p>
317 </div>
318 </div>
319 </div>
320 </div>
321 </div>
322  <div id="last-login" class="form-group">
323  <div id="last-login-k-block" class="k-block">
324  <div id="last-login-summary-block" class="hcu-summary-block">
325  <div id="last-login-summary-row" class="summary-row">
326  <div id="last-login-summary-desc" class="summary-desc">
327 <label id="last-login-summary-desc-label" class="control-label">Last Successful Login</label></div>
328  <div id="last-login-summary-value" class="summary-value">
329  <p id="last-login-summary-value-label" class="form-control-static">
330 Tue Nov 12, 2019 09:17am</p>
331 </div>
332 </div>
333 </div>
334 </div>
335 </div>
336  <div id="acct-status" class="form-group">
337  <div id="acct-status-k-block" class="k-block">
338  <div id="acct-status-summary-block" class="hcu-summary-block">
339  <div id="acct-status-summary-row" class="summary-row">
340  <div id="acct-status-summary-desc" class="summary-desc">
341 <label id="acct-status-summary-desc-label" class="control-label">Account Status as of </label></div>
342  <div id="acct-status-summary-value" class="summary-value">
343  <p id="acct-status-summary-p" class="form-control-static">
344 Fri May 23, 2008 04:32pm</p>
345 </div>
346 </div>
347 </div>
348 </div>
349 </div>
350 </div>
351 ';
352  }

◆ singleNestedNodeLastLogin()

TestCompassSingleNodeSelection::singleNestedNodeLastLogin ( )
protected

This is the response for last login without a wrapper. This is a sub-member of the previous failed-login test; this is a single sub-member of failed-login.

Returns
string

Definition at line 414 of file TestCompassSingleNodeSelection.php.

415  {
416  return ' <div id="last-login-k-block" class="k-block">
417  <div id="last-login-summary-block" class="hcu-summary-block">
418  <div id="last-login-summary-row" class="summary-row">
419  <div id="last-login-summary-desc" class="summary-desc">
420 <label id="last-login-summary-desc-label" class="control-label">Last Successful Login</label></div>
421  <div id="last-login-summary-value" class="summary-value">
422  <p id="last-login-summary-value-label" class="form-control-static">
423 Tue Nov 12, 2019 09:17am</p>
424 </div>
425 </div>
426 </div>
427 </div>
428 ';
429  }

◆ singleNestedNodeUserInfo()

TestCompassSingleNodeSelection::singleNestedNodeUserInfo ( )
protected

Expected response when we request a single nested node with the full_node param absent or false. $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'dropdown-user-menu-ul-li');

Returns
string

Definition at line 256 of file TestCompassSingleNodeSelection.php.

257  {
258  return ' <div class="col-xs-12">
259  <div id="update-email" class="k-block hcu-alert-block">
260  <div id="email-alert-icon-block" class="hcu-alert-block-icon">
261 <i id="email-alert-icon" class="fa fa-2x fa-envelope"></i></div>
262 &nbsp;
263  <div id="email-message-block-text" class="hcu-alert-block-text">
264 <span id="email-message-title">Current email is</span><br>
265 <label id="email-message-label"> <p id="email-message-p">
266 mike@homecu.net</p>
267 </label></div>
268 <hr>
269 <a id="update-email-link" href="http://localhost:8000/banking/hcuProfileEmail.prg?cu=SCRUBCU">
270 Update Now</a></div>
271 </div>
272 ';
273  }

◆ singleNestedNodeWithWrapperFailedLogin()

TestCompassSingleNodeSelection::singleNestedNodeWithWrapperFailedLogin ( )
protected

This is the response for failed-login with the wrapper. Note it has sub-members tested in another test.

Returns
string

Definition at line 358 of file TestCompassSingleNodeSelection.php.

359  {
360  return ' <li id="failed-login">
361  <div id="failed-login-col-xs" class="col-xs-12">
362  <div id="failed-login-form-group" class="form-group">
363  <div id="failed-login-k-b" class="k-block">
364  <div id="failed-login-summary-block" class="hcu-summary-block">
365  <div id="failed-login-summary-row" class="summary-row">
366  <div id="failed-login-summary-desc" class="summary-desc">
367 <label id="failed-login-summary-desc-label" class="control-label">Last Failed Login</label></div>
368  <div id="failed-login-summary-value" class="summary-value">
369  <p id="failed-login-summary-desc-p" class="form-control-static">
370 Tue Nov 12, 2019 09:00am</p>
371 </div>
372 </div>
373 </div>
374 </div>
375 </div>
376  <div id="last-login" class="form-group">
377  <div id="last-login-k-block" class="k-block">
378  <div id="last-login-summary-block" class="hcu-summary-block">
379  <div id="last-login-summary-row" class="summary-row">
380  <div id="last-login-summary-desc" class="summary-desc">
381 <label id="last-login-summary-desc-label" class="control-label">Last Successful Login</label></div>
382  <div id="last-login-summary-value" class="summary-value">
383  <p id="last-login-summary-value-label" class="form-control-static">
384 Tue Nov 12, 2019 09:17am</p>
385 </div>
386 </div>
387 </div>
388 </div>
389 </div>
390  <div id="acct-status" class="form-group">
391  <div id="acct-status-k-block" class="k-block">
392  <div id="acct-status-summary-block" class="hcu-summary-block">
393  <div id="acct-status-summary-row" class="summary-row">
394  <div id="acct-status-summary-desc" class="summary-desc">
395 <label id="acct-status-summary-desc-label" class="control-label">Account Status as of </label></div>
396  <div id="acct-status-summary-value" class="summary-value">
397  <p id="acct-status-summary-p" class="form-control-static">
398 Fri May 23, 2008 04:32pm</p>
399 </div>
400 </div>
401 </div>
402 </div>
403 </div>
404 </div>
405 </li>
406 ';
407  }

◆ singleNestedNodeWithWrapperLastLogin()

TestCompassSingleNodeSelection::singleNestedNodeWithWrapperLastLogin ( )
protected

As above, response for last login with the outer wrapper.

Returns
string

Definition at line 435 of file TestCompassSingleNodeSelection.php.

436  {
437  return ' <div id="last-login" class="form-group">
438  <div id="last-login-k-block" class="k-block">
439  <div id="last-login-summary-block" class="hcu-summary-block">
440  <div id="last-login-summary-row" class="summary-row">
441  <div id="last-login-summary-desc" class="summary-desc">
442 <label id="last-login-summary-desc-label" class="control-label">Last Successful Login</label></div>
443  <div id="last-login-summary-value" class="summary-value">
444  <p id="last-login-summary-value-label" class="form-control-static">
445 Tue Nov 12, 2019 09:17am</p>
446 </div>
447 </div>
448 </div>
449 </div>
450 </div>
451 ';
452  }

◆ test_single_nested_node_failed_login_with_full_wrapper()

TestCompassSingleNodeSelection::test_single_nested_node_failed_login_with_full_wrapper ( )

Test that the single node works and returns the full wrapper of the failed login node with a nested element. Note it has three other nested elements, testing covers an inner one below.

Returns
void

Definition at line 139 of file TestCompassSingleNodeSelection.php.

140  {
141  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'failed-login', true);
142  $expected = $this->singleNestedNodeWithWrapperFailedLogin();
143 
144  $this->assertSame($expected, $result);
145  }

◆ test_single_nested_node_failed_login_without_wrapper()

TestCompassSingleNodeSelection::test_single_nested_node_failed_login_without_wrapper ( )

Test that the single node works and returns just the content of the failed login node with a nested element. Note it has three other nested elements, testing covers an inner one below.

Returns
void

Definition at line 126 of file TestCompassSingleNodeSelection.php.

127  {
128  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'failed-login');
129  $expected = $this->singleNestedNodeFailedLogin();
130 
131  $this->assertSame($expected, $result);
132  }

◆ test_single_nested_node_last_login_with_full_wrapper()

TestCompassSingleNodeSelection::test_single_nested_node_last_login_with_full_wrapper ( )

Test that the last-login node, which is nested inside the nested failed-login node, returns the content with the full outer wrapper.

Returns
void

Definition at line 167 of file TestCompassSingleNodeSelection.php.

168  {
169  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'last-login', true);
170  $expected = $this->singleNestedNodeWithWrapperLastLogin();
171 
172  $this->assertSame($expected, $result);
173  }

◆ test_single_nested_node_last_login_without_wrapper()

TestCompassSingleNodeSelection::test_single_nested_node_last_login_without_wrapper ( )

Test that the last-login node, which is nested inside the nested failed-login node, returns just the content without the wrapper.

Returns
void

Definition at line 154 of file TestCompassSingleNodeSelection.php.

155  {
156  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'last-login');
157  $expected = $this->singleNestedNodeLastLogin();
158 
159  $this->assertSame($expected, $result);
160  }

◆ test_single_nested_node_user_info_with_full_wrapper()

TestCompassSingleNodeSelection::test_single_nested_node_user_info_with_full_wrapper ( )

Test that the single node works and returns the full wrapper of the user info node with a nested element.

Returns
void

Definition at line 113 of file TestCompassSingleNodeSelection.php.

114  {
115  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'dropdown-user-menu-ul-li', true);
116  $expected = $this->fullSingleNestedNodeUserInfo();
117 
118  $this->assertSame($expected, $result);
119  }

◆ test_single_nested_node_user_info_without_wrapper()

TestCompassSingleNodeSelection::test_single_nested_node_user_info_without_wrapper ( )

Test that the single node works and returns just the content of the user info node with a nested element. This eliminates the wrapper and just returns its content.

Returns
void

Definition at line 101 of file TestCompassSingleNodeSelection.php.

102  {
103  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'dropdown-user-menu-ul-li');
104  $expected = $this->singleNestedNodeUserInfo();
105 
106  $this->assertSame($expected, $result);
107  }

◆ test_top_level_secure_email_node_with_full_wrapper()

TestCompassSingleNodeSelection::test_top_level_secure_email_node_with_full_wrapper ( )

Test thesecure email top level node with the full wrapper .

Returns
void

Definition at line 88 of file TestCompassSingleNodeSelection.php.

89  {
90  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'secure-email-item', true);
91  $expected = $this->topLevelSecureEmailNodeWithWrapper();
92 
93  $this->assertSame($expected, $result);
94  }

◆ test_top_level_secure_email_node_without_wrapper()

TestCompassSingleNodeSelection::test_top_level_secure_email_node_without_wrapper ( )

Test the secure email top level node without the node wrapper . $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'secure-email-item');

Returns
void

Definition at line 76 of file TestCompassSingleNodeSelection.php.

77  {
78  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'secure-email-item');
79  $expected = $this->topLevelSecureEmailNode();
80 
81  $this->assertSame($expected, $result);
82  }

◆ test_top_level_user_activity_node_with_full_wrapper()

TestCompassSingleNodeSelection::test_top_level_user_activity_node_with_full_wrapper ( )

Test the user activity top level node with the full wrapper .

Returns
void

Definition at line 63 of file TestCompassSingleNodeSelection.php.

64  {
65  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'user-activity', true);
66  $expected = $this->topLevelUserActivityNodeWithWrapper();
67 
68  $this->assertSame($expected, $result);
69  }

◆ test_top_level_user_activity_node_without_wrapper()

TestCompassSingleNodeSelection::test_top_level_user_activity_node_without_wrapper ( )

Test the user activity top level node without the node wrapper .

Returns
void

Definition at line 51 of file TestCompassSingleNodeSelection.php.

52  {
53  $result = $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'user-activity');
54  $expected = $this->topLevelUserActivityNode();
55  //echo "\n\n EXPECTED\n\n->$expected<-\n\nACTUAL ->$result<-\n\n";
56  $this->assertSame($expected, $result);
57  }

◆ topLevelSecureEmailNode()

TestCompassSingleNodeSelection::topLevelSecureEmailNode ( )
protected

Expected response when we request the top level secure email node without the full_node param. $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'secure-email-item');

Returns
string

Definition at line 232 of file TestCompassSingleNodeSelection.php.

233  {
234  return '<a id="secure-email-link" href="http://localhost:8000/banking/hcuSecureMail.prg?cu=SCRUBCU" aria-label="Secure Messages" title="Secure Messages">
235 <i class="fa fa-comments fa-fw"></i><span id="secure-email-link-text" class="compass-link-text">Secure Message</span></a>';
236  }

◆ topLevelSecureEmailNodeWithWrapper()

TestCompassSingleNodeSelection::topLevelSecureEmailNodeWithWrapper ( )
protected

Expected response when we request the top level secure email node with the full_node param set to true. $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'secure-email-item', true);

Returns
string

Definition at line 243 of file TestCompassSingleNodeSelection.php.

244  {
245  return ' <li id="secure-email-item" class="hcu-quick-nav-secure-mail">
246 <a id="secure-email-link" href="http://localhost:8000/banking/hcuSecureMail.prg?cu=SCRUBCU" aria-label="Secure Messages" title="Secure Messages">
247 <i class="fa fa-comments fa-fw"></i><span id="secure-email-link-text" class="compass-link-text">Secure Message</span></a></li>
248 ';
249  }

◆ topLevelUserActivityNode()

TestCompassSingleNodeSelection::topLevelUserActivityNode ( )
protected

Expected response when we request the top level user activity node without the full_node param. $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'user-activity');

Returns
string

Definition at line 208 of file TestCompassSingleNodeSelection.php.

209  {
210  return '<a id="user-activity-link" href="http://localhost:8000/banking/hcuUserActivity.prg?cu=SCRUBCU" aria-label="User Activity" title="User Activity">
211 <i class="fa fa-bell fa-fw"></i><span id="activity-link-text" class="compass-link-text">User Activity</span></a>';
212  }

◆ topLevelUserActivityNodeWithWrapper()

TestCompassSingleNodeSelection::topLevelUserActivityNodeWithWrapper ( )
protected

Expected response when we request the top level user activity node with the full_node param set to true. $this->CompassObj->singleCompassMenuNode($this->json_path, $this->json, 'user-activity', true);

Returns
string

Definition at line 219 of file TestCompassSingleNodeSelection.php.

220  {
221  return ' <li id="user-activity" class="hcu-quick-nav-activity">
222 <a id="user-activity-link" href="http://localhost:8000/banking/hcuUserActivity.prg?cu=SCRUBCU" aria-label="User Activity" title="User Activity">
223 <i class="fa fa-bell fa-fw"></i><span id="activity-link-text" class="compass-link-text">User Activity</span></a></li>
224 ';
225  }

Member Data Documentation

◆ $HB_ENV

TestCompassSingleNodeSelection::$HB_ENV
protected
Initial value:
= [
'MC' => null,
'Cu' => 'SCRUBCU',
'Cn' => 'BongoBob',
'Uid' => 19,
'loginpath' => 'http:
'cuquery' => 'cu=SCRUBCU',
]

Definition at line 20 of file TestCompassSingleNodeSelection.php.


The documentation for this class was generated from the following file: