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 ChartProviderAccessTest extends ApplicationTestCase
9: {
10: public function supportsCustomer($cus_id)
11: {
12:
13: return (Customers::isEhrCustomer($cus_id));
14: }
15:
16: 17: 18: 19: 20:
21: public function testAdminWithAccessToAllProviders()
22: {
23: $app = $this->login(Users::RUTH_BELL, Users::PASSWORD);
24:
25:
26:
27: $app->charts->open(265900, 362595);
28: $this->assertNoErrorPopups();
29:
30:
31:
32: $app->charts->open(265891, 362596);
33: $this->assertNoErrorPopups();
34:
35:
36:
37: $app->charts->open(265896, 362597);
38: $this->assertNoErrorPopups();
39:
40:
41:
42: $app->charts->open(265892, 362598);
43: $this->assertNoErrorPopups();
44: }
45:
46: 47: 48: 49: 50:
51: public function testUserWithAccessToOneProvider()
52: {
53: $app = $this->login(Users::THEO_FIFIELD, Users::PASSWORD);
54:
55:
56:
57: $app->charts->open(265900, 362595);
58: $this->assertNoErrorPopups();
59:
60:
61:
62: $this->updateHash("/charts/c/362596/detail");
63: $this->assertAccessDenied();
64: $app->popup->closeAll();
65:
66:
67:
68: $this->updateHash("/charts/c/362597/detail");
69: $this->assertAccessDenied();
70: $app->popup->closeAll();
71:
72:
73:
74: $this->updateHash("/charts/c/362598/detail");
75: $this->assertAccessDenied();
76: $app->popup->closeAll();
77:
78:
79:
80:
81: $this->updateHash("/charts/c/362599/detail");
82: $this->assertAccessDenied();
83: $app->popup->closeAll();
84: }
85:
86: 87: 88: 89: 90:
91: public function testUserWithAccessToMultipleProviders()
92: {
93: $app = $this->login(Users::KATHERINE_IZZO, Users::PASSWORD);
94:
95:
96:
97: $this->updateHash("/charts/c/362595/detail");
98: $this->assertAccessDenied();
99: $app->popup->closeAll();
100:
101:
102:
103: $this->updateHash("/charts/c/362596/detail");
104: $this->assertAccessDenied();
105: $app->popup->closeAll();
106:
107:
108:
109:
110: $app->charts->open(265896, 362597);
111: $this->assertNoErrorPopups();
112: $patient = $this->getView("patients/patient.json", array("pat_id" => 265896));
113: $this->spinWait(function () use ($patient) {
114: $patient->assertElementVisible(".pat_menu");
115: return true;
116: });
117:
118:
119:
120:
121: $app->charts->open(265892, 362598);
122: $this->assertNoErrorPopups();
123: $patient = $this->getView("patients/patient.json", array("pat_id" => 265892));
124: $this->spinWait(function () use ($patient) {
125: $patient->assertElementVisible(".pat_menu");
126: return true;
127: });
128:
129:
130:
131:
132:
133: $app->charts->open(265900, 362599);
134: $this->assertNoErrorPopups();
135: $patient = $this->getView("patients/patient.json", array("pat_id" => 265900));
136: $this->spinWait(function () use ($patient) {
137: $patient->assertElementNotVisible(".pat_menu");
138: return true;
139: });
140: }
141:
142: 143: 144:
145: protected function assertAccessDenied()
146: {
147: $this->waitForAjax();
148: $this->assertErrorPopup("Provider Access: You do not have access to charts from this provider.");
149: }
150: }
151:
152: ?>