1: <?php
2: use Azalea\Selenium\App\ApplicationTestCase;
3: use Azalea\Selenium\App\Customers;
4: use Azalea\Selenium\App\Patients;
5: use Azalea\Selenium\App\Providers;
6: use Azalea\Selenium\App\Users;
7:
8: class PatientProviderAccessTest extends ApplicationTestCase
9: {
10: public function supportsCustomer($cus_id)
11: {
12: // Azalea EHR customer only
13: return (Customers::isEhrCustomer($cus_id));
14: }
15:
16: /**
17: * Summary:
18: * An administrator user with all patient provider access can access
19: * the patient records a patient belonging to each provider.
20: */
21: public function testAdminWithAccessToAllProviders()
22: {
23: $app = $this->login(Users::RUTH_BELL, Users::PASSWORD);
24:
25: // Open patient Clement Bradtke (Provider Lacey McClure)
26: // Expected result: Access is granted
27: $app->patients->open(265891);
28: $this->assertNoErrorPopups();
29:
30: // Open patient Rashawn Crist (Provider Berry Carter)
31: // Expected result: Access is granted
32: $app->patients->open(265900);
33: $this->assertNoErrorPopups();
34:
35: // Open patient Pearline Gottlieb (Provider Cordelia Wolff)
36: // Expected result: Access is granted
37: $app->patients->open(265896);
38: $this->assertNoErrorPopups();
39:
40: // Open patient Agnes Schimmel (Provider Roma Wilkinson)
41: // Expected result: Access is granted
42: $app->patients->open(265892);
43: $this->assertNoErrorPopups();
44: }
45:
46: /**
47: * Summary:
48: * A user with patient provider access to one provider can only
49: * access patient records for patients belonging to that provider.
50: */
51: public function testUserWithAccessToOneProvider()
52: {
53: $app = $this->login(Users::THEO_FIFIELD, Users::PASSWORD);
54:
55: // Open patient Rashawn Crist (Provider Berry Carter)
56: // Expected result: Access is granted
57: $app->patients->open(265900);
58: $this->assertNoErrorPopups();
59:
60: // Open patient Clement Bradtke (Provider Lacey McClure)
61: // Expected result: Blocked by Provider Access
62: $app->patients->open(265891);
63: $this->assertAccessDenied();
64: $app->popup->closeAll();
65:
66: // Open patient Pearline Gottlieb (Provider Cordelia Wolff)
67: // Expected result: Blocked by Provider Access
68: $app->patients->open(265896);
69: $this->assertAccessDenied();
70: $app->popup->closeAll();
71:
72: // Open patient Agnes Schimmel (Provider Roma Wilkinson)
73: // Expected result: Blocked by Provider Access
74: $app->patients->open(265892);
75: $this->assertAccessDenied();
76: $app->popup->closeAll();
77: }
78:
79: /**
80: * Summary:
81: * A user with patient provider access to multiple providers can only
82: * access patient records for patients belonging to that provider.
83: */
84: public function testUserWithAccessToMultipleProviders()
85: {
86: $app = $this->login(Users::KATHERINE_IZZO, Users::PASSWORD);
87:
88: // Open patient Rashawn Crist (Provider Berry Carter)
89: $app->patients->open(265900);
90: $this->assertAccessDenied();
91: $app->popup->closeAll();
92:
93: // Open patient Clement Bradtke (Provider Lacey McClure)
94: // Expected result: Blocked by Provider Access
95: $app->patients->open(265891);
96: $this->assertAccessDenied();
97: $app->popup->closeAll();
98:
99: // Open patient Pearline Gottlieb (Provider Cordelia Wolff)
100: // Expected result: Access is granted
101: $app->patients->open(265896);
102: $this->assertNoErrorPopups();
103:
104: // Open patient Agnes Schimmel (Provider Roma Wilkinson)
105: // Expected result: Access is granted
106: $app->patients->open(265892);
107: $this->assertNoErrorPopups();
108: }
109:
110: /**
111: * Assert if provider access denied error is not showing.
112: */
113: protected function assertAccessDenied()
114: {
115: $this->assertErrorPopup("Provider Access: You do not have access to patients from this provider.");
116: }
117: }
118:
119: ?>