@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function getFilepath() { |
29 | 29 | $path = Yii::getAlias('@graphImgPath'); |
30 | 30 | $filename = $this->user->getIdHash() . ".png"; |
31 | - return $path. '/' . $filename; |
|
31 | + return $path . '/' . $filename; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return string the encoded image |
62 | 62 | */ |
63 | 63 | public function create(array $checkins, bool $toDisk = false) { |
64 | - if($toDisk) { |
|
64 | + if ($toDisk) { |
|
65 | 65 | // wipe out the current image, if it exists |
66 | 66 | $this->destroy(); |
67 | 67 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | |
82 | 82 | // Setup dates as labels on the X-axis |
83 | 83 | $graph->xaxis->SetTickLabels(array_keys($checkins)); |
84 | - $graph->xaxis->HideTicks(false,false); |
|
84 | + $graph->xaxis->HideTicks(false, false); |
|
85 | 85 | |
86 | 86 | $graph->yaxis->scale->SetAutoMin(0); |
87 | 87 | $graph->yaxis->HideLine(false); |
88 | - $graph->yaxis->HideTicks(false,false); |
|
88 | + $graph->yaxis->HideTicks(false, false); |
|
89 | 89 | $graph->xaxis->SetLabelAngle(45); |
90 | 90 | $graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 10); |
91 | 91 | $graph->yaxis->SetFont(FF_ARIAL, FS_NORMAL, 15); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | |
94 | 94 | // format the data into something nicer |
95 | 95 | $accum = []; |
96 | - foreach($checkins as $checkin_sum) { |
|
97 | - for($i = 1; $i <= 7; $i ++) { |
|
96 | + foreach ($checkins as $checkin_sum) { |
|
97 | + for ($i = 1; $i <= 7; $i++) { |
|
98 | 98 | $accum[$i][] = array_key_exists($i, $checkin_sum) ? $checkin_sum[$i]['count'] : 0; |
99 | 99 | } |
100 | 100 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | // Create the bar plots |
103 | 103 | $plots = []; |
104 | 104 | $category = Yii::$container->get(\common\interfaces\CategoryInterface::class); |
105 | - foreach($accum as $category_key => $category_data) { |
|
105 | + foreach ($accum as $category_key => $category_data) { |
|
106 | 106 | $bplot = new BarPlot($category_data); |
107 | 107 | $color = $category::$colors[$category_key]['color']; |
108 | 108 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $graph->Add($gbbplot); |
118 | 118 | |
119 | 119 | $graph->legend->SetColumns(3); |
120 | - $graph->legend->SetPos(0.5,0.98,'center','bottom'); // position it at the center, just above the bottom edge |
|
120 | + $graph->legend->SetPos(0.5, 0.98, 'center', 'bottom'); // position it at the center, just above the bottom edge |
|
121 | 121 | |
122 | 122 | $img = $graph->Stroke(_IMG_HANDLER); |
123 | 123 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | imagepng($img); |
126 | 126 | $img_data = ob_get_clean(); |
127 | 127 | |
128 | - if($toDisk) { |
|
128 | + if ($toDisk) { |
|
129 | 129 | $filepath = $this->getFilepath(); |
130 | - if(!is_dir(dirname($filepath))) { |
|
130 | + if (!is_dir(dirname($filepath))) { |
|
131 | 131 | mkdir(dirname($filepath), 0766, true); |
132 | 132 | } |
133 | 133 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
25 | 25 | $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion'); |
26 | 26 | |
27 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
27 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
28 | 28 | return new \common\components\Time('America/Los_Angeles'); |
29 | 29 | }); |
30 | 30 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function testGetLocalTime() |
49 | 49 | { |
50 | - $this->specify('getLocalTime should function correctly', function () { |
|
50 | + $this->specify('getLocalTime should function correctly', function() { |
|
51 | 51 | expect("getLocalTime should work with user's set time", $this->assertEquals($this->time->getLocalTime(), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s"))); |
52 | 52 | expect('getLocalTime should work with a custom timezone', $this->assertEquals($this->time->getLocalTime("UTC"), (new DateTime("now"))->format("Y-m-d H:i:s"))); |
53 | 53 | }); |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | |
56 | 56 | public function testConvertLocalToUTC() |
57 | 57 | { |
58 | - $this->specify('convertLocalToUTC should function correctly', function () { |
|
58 | + $this->specify('convertLocalToUTC should function correctly', function() { |
|
59 | 59 | $la_tz = (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s"); |
60 | 60 | |
61 | 61 | expect('convertLocalToUTC should convert a Los Angeles tz to UTC with the included time', $this->assertEquals($this->time->convertLocalToUTC($la_tz), (new DateTime("now"))->format("Y-m-d H:i:s"))); |
62 | 62 | expect('convertLocalToUTC should convert a Los Angeles tz to UTC without the included time', $this->assertEquals($this->time->convertLocalToUTC($la_tz, false), (new DateTime("now"))->format("Y-m-d"))); |
63 | 63 | // with UTC |
64 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
64 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
65 | 65 | return new \common\components\Time('UTC'); |
66 | 66 | }); |
67 | 67 | $time = $this->container->get('common\interfaces\TimeInterface'); |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | |
75 | 75 | public function testConvertUTCToLocal() |
76 | 76 | { |
77 | - $this->specify('convertUTCToLocal should function correctly', function () { |
|
77 | + $this->specify('convertUTCToLocal should function correctly', function() { |
|
78 | 78 | $utc_tz = (new DateTime("now"))->format("Y-m-d H:i:s"); |
79 | 79 | |
80 | 80 | expect('convertUTCToLocal should convert a UTC tz to Los Angeles with the included timezone', $this->assertEquals((new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format(DateTime::ATOM), $this->time->convertUTCToLocal($utc_tz))); |
81 | 81 | expect('convertUTCToLocal should convert a UTC tz to Los Angeles without the included timezone', $this->assertEquals($this->time->convertUTCToLocal($utc_tz, false), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s"))); |
82 | 82 | |
83 | 83 | // with UTC |
84 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
84 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
85 | 85 | return new \common\components\Time('UTC'); |
86 | 86 | }); |
87 | 87 | $time = $this->container->get('common\interfaces\TimeInterface'); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public function testGetLocalDate() |
96 | 96 | { |
97 | - $this->specify('getLocalDate should function correctly', function () { |
|
97 | + $this->specify('getLocalDate should function correctly', function() { |
|
98 | 98 | expect("getLocalDate should correctly get the user's local date", $this->assertEquals($this->time->getLocalDate(), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d"))); |
99 | 99 | expect("getLocalDate should correctly get the local date of a specified timezone", $this->assertEquals($this->time->getLocalDate("UTC"), (new DateTime("now", new DateTimeZone("UTC")))->format("Y-m-d"))); |
100 | 100 | }); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | expect('getUTCBookends should return false if there is a space at the end of the time string', $this->assertFalse($this->time->getUTCBookends('2016-05-30 00:00:00 '))); |
117 | 117 | expect('getUTCBookends should return UTC bookend times from the Los_Angeles tz', $this->assertEquals($this->time->getUTCBookends('2016-05-30'), ['2016-05-30 07:00:00', '2016-05-31 06:59:59'])); |
118 | 118 | // with UTC |
119 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
119 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
120 | 120 | return new \common\components\Time('UTC'); |
121 | 121 | }); |
122 | 122 | $time = $this->container->get('common\interfaces\TimeInterface'); |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | $tz = 'America/Los_Angeles'; |
204 | 204 | $this->time->timezone = 'America/Los_Angeles'; |
205 | 205 | |
206 | - $today = new \DateTime("now + 1 day", new \DateTimeZone($tz)); // we do an extra day to include today as the last day |
|
206 | + $today = new \DateTime("now + 1 day", new \DateTimeZone($tz)); // we do an extra day to include today as the last day |
|
207 | 207 | $should_be_today = $this->time->getDateTimesInPeriod()->getEndDate(); |
208 | 208 | expect('getDateTimesInPeriod should return a list of \DatePeriods, the last being for today', $this->assertEquals($today->format('Y-m-d H'), $should_be_today->format('Y-m-d H'))); |
209 | 209 | |
210 | - $start = new \DateTime("30 days ago", new \DateTimeZone($tz)); |
|
210 | + $start = new \DateTime("30 days ago", new \DateTimeZone($tz)); |
|
211 | 211 | $should_be_start = $this->time->getDateTimesInPeriod()->getStartDate(); |
212 | 212 | expect('getDateTimesInPeriod should return a list of \DatePeriods, the first being for 30 days ago (by default)', $this->assertEquals($start->format('Y-m-d H'), $should_be_start->format('Y-m-d H'))); |
213 | 213 | } |
@@ -71,11 +71,11 @@ |
||
71 | 71 | ]); ?> |
72 | 72 | <?= $form->field($profile, 'timezone')->dropDownList(array_combine($timezones, $timezones)); ?> |
73 | 73 | <?= $form->field($profile, 'expose_graph')->checkbox() ?> |
74 | - <?php if($profile->expose_graph): ?> |
|
74 | + <?php if ($profile->expose_graph): ?> |
|
75 | 75 | <div class='alert alert-success behaviors-graph-info'>Your behaviors graph can be found at:<br /> <a id="behaviors-graph-link" target="_blank" href="<?=$graph_url?>"><?=$graph_url?></a></div> |
76 | 76 | <?php endif; ?> |
77 | 77 | <?= $form->field($profile, 'send_email')->checkbox() ?> |
78 | - <div id='send_email_fields' <?php if(!$profile->send_email) { ?>style="display: none;"<?php } ?>> |
|
78 | + <div id='send_email_fields' <?php if (!$profile->send_email) { ?>style="display: none;"<?php } ?>> |
|
79 | 79 | <?= $form->field($profile, 'email_category')->dropdownList(Category::getCategories(), ['data-toggle' => 'tooltip', 'data-placement' => 'left', 'data-trigger' => 'hover', 'data-delay' => '{"show": 500, "hide": 100}', 'title' => 'Want to send an email with every check-in? Try setting this to "Restoration"']) ?> |
80 | 80 | <?= $form->field($profile, 'partner_email1')->input('email'); ?> |
81 | 81 | <?= $form->field($profile, 'partner_email2')->input('email'); ?> |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * @codeCoverageIgnore |
|
64 | - */ |
|
63 | + * @codeCoverageIgnore |
|
64 | + */ |
|
65 | 65 | public function attributeLabels() { |
66 | 66 | return [ |
67 | 67 | 'partner_email1' => "Partner Email #1", |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | // generate behaviors graph image |
95 | 95 | $checkins_last_month = (Yii::$container->get(\common\interfaces\UserBehaviorInterface::class)) |
96 | - ->getCheckInBreakdown(); |
|
96 | + ->getCheckInBreakdown(); |
|
97 | 97 | |
98 | 98 | // if they haven't done a check-in in the last month this will explode |
99 | 99 | // because $checkins_last_month is an empty array |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $graph = Yii::$container |
86 | 86 | ->get(\common\components\Graph::class, [$this->user]); |
87 | 87 | |
88 | - if($this->timezone) { |
|
88 | + if ($this->timezone) { |
|
89 | 89 | $user->timezone = $this->timezone; |
90 | 90 | } |
91 | - if($this->expose_graph) { |
|
91 | + if ($this->expose_graph) { |
|
92 | 92 | $user->expose_graph = true; |
93 | 93 | |
94 | 94 | // generate behaviors graph image |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | // if they haven't done a check-in in the last month this will explode |
99 | 99 | // because $checkins_last_month is an empty array |
100 | - if($checkins_last_month) { |
|
100 | + if ($checkins_last_month) { |
|
101 | 101 | $graph->create($checkins_last_month, true); |
102 | 102 | } |
103 | 103 | } else { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $graph->destroy(); |
107 | 107 | } |
108 | 108 | |
109 | - if($this->send_email) { |
|
109 | + if ($this->send_email) { |
|
110 | 110 | $user->send_email = true; |
111 | 111 | $user->email_category = $this->email_category; |
112 | 112 | $user->partner_email1 = $this->partner_email1; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function signup() { |
91 | 91 | $user = $this->user->findByEmail($this->email); |
92 | - if(!$user) { |
|
92 | + if (!$user) { |
|
93 | 93 | // this is a brand new user |
94 | 94 | $this->user = $this->setFields($this->user); |
95 | 95 | $this->user->save(); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * this is a user that for whatever reason is trying to sign up again |
104 | 104 | * with the same email address. |
105 | 105 | */ |
106 | - if(!$user->isTokenConfirmed()) { |
|
106 | + if (!$user->isTokenConfirmed()) { |
|
107 | 107 | /* |
108 | 108 | * they've never verified their account. We don't care if their |
109 | 109 | * verification token is current or expired. We're resetting their |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $user->generateAuthKey(); |
132 | 132 | $user->generateVerifyEmailToken(); |
133 | 133 | |
134 | - if($user->send_email) { |
|
134 | + if ($user->send_email) { |
|
135 | 135 | $user->send_email = true; |
136 | 136 | $user->email_category = $this->email_category; |
137 | 137 | $user->partner_email1 = $this->partner_email1; |
@@ -4,8 +4,8 @@ |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | // In the console environment, some path aliases may not exist. Please define these: |
7 | - Yii::setAlias('@webroot', __DIR__ . '/../web'); |
|
8 | - Yii::setAlias('@web', '/'); |
|
7 | + Yii::setAlias('@webroot', __DIR__ . '/../web'); |
|
8 | + Yii::setAlias('@web', '/'); |
|
9 | 9 | |
10 | 10 | $mainConf = require Yii::getAlias('@site/config/main.php'); |
11 | 11 | $converter = $mainConf['components']['assetManager']['converter']; |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | parent::setUp(); |
95 | 95 | } |
96 | 96 | |
97 | - public function testAttributeLabels() |
|
98 | - { |
|
97 | + public function testAttributeLabels() |
|
98 | + { |
|
99 | 99 | $this->specify('attributeLabels should function properly', function () { |
100 | 100 | $model = $this->container->get('\site\models\CheckinForm'); |
101 | 101 | expect('attributeLabels should be correct', $this->assertEquals($model->attributeLabels(), [ |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $this->specify('setBehaviors should function properly', function () { |
116 | 116 | $model = $this->container->get('\site\models\CheckinForm'); |
117 | 117 | |
118 | - $model->setBehaviors($this->behaviors); |
|
118 | + $model->setBehaviors($this->behaviors); |
|
119 | 119 | expect('behaviors1 should be correct', $this->assertEquals($model->behaviors1, [ 0 => 7 ])); |
120 | 120 | expect('behaviors2 should be correct', $this->assertEquals($model->behaviors2, [ 0 => 12, 1 => 13, 2 => 17, 3 => 18 ])); |
121 | 121 | expect('behaviors3 should be correct', $this->assertEquals($model->behaviors3, [ 0 => 28, 1 => 38, 2 => 46 ])); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | expect('behaviors6 should be correct', $this->assertEquals($model->behaviors6, [ 0 => 104 ])); |
125 | 125 | expect('behaviors7 should be correct', $this->assertEquals($model->behaviors7, [ 0 => 128 ])); |
126 | 126 | |
127 | - $model->setBehaviors($this->behaviors); |
|
127 | + $model->setBehaviors($this->behaviors); |
|
128 | 128 | expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors1, [ 0 => 7 ])); |
129 | 129 | expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors2, [ 0 => 12, 1 => 13, 2 => 17, 3 => 18 ])); |
130 | 130 | expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors3, [ 0 => 28, 1 => 38, 2 => 46 ])); |
@@ -135,64 +135,64 @@ discard block |
||
135 | 135 | }); |
136 | 136 | } |
137 | 137 | |
138 | - public function testValidateBehaviors() |
|
139 | - { |
|
138 | + public function testValidateBehaviors() |
|
139 | + { |
|
140 | 140 | $this->specify('validateBehaviors should function properly', function () { |
141 | 141 | $model = $this->container->get('\site\models\CheckinForm'); |
142 | - $model->setBehaviors($this->behaviors); |
|
142 | + $model->setBehaviors($this->behaviors); |
|
143 | 143 | expect('validation should be good', $this->assertTrue($model->validate())); |
144 | 144 | |
145 | 145 | $model->behaviors1[0] = 'bad'; |
146 | 146 | expect('validation should be bad', $this->assertFalse($model->validate())); |
147 | 147 | }); |
148 | - } |
|
148 | + } |
|
149 | 149 | |
150 | - public function testCompileBehaviors() |
|
151 | - { |
|
150 | + public function testCompileBehaviors() |
|
151 | + { |
|
152 | 152 | $this->specify('compileBehaviors should function properly', function () { |
153 | 153 | $model = $this->container->get('\site\models\CheckinForm'); |
154 | - $model->setBehaviors($this->behaviors); |
|
154 | + $model->setBehaviors($this->behaviors); |
|
155 | 155 | expect('compiling behaviors should be return a correct array', $this->assertEquals($model->compileBehaviors(), [ |
156 | - 0 => 7, |
|
157 | - 1 => 12, |
|
158 | - 2 => 13, |
|
159 | - 3 => 17, |
|
160 | - 4 => 18, |
|
161 | - 5 => 28, |
|
162 | - 6 => 38, |
|
163 | - 7 => 46, |
|
164 | - 8 => 47, |
|
165 | - 9 => 56, |
|
166 | - 10 => 62, |
|
167 | - 11 => 78, |
|
168 | - 12 => 79, |
|
169 | - 13 => 104, |
|
170 | - 14 => 128, |
|
171 | - ])); |
|
156 | + 0 => 7, |
|
157 | + 1 => 12, |
|
158 | + 2 => 13, |
|
159 | + 3 => 17, |
|
160 | + 4 => 18, |
|
161 | + 5 => 28, |
|
162 | + 6 => 38, |
|
163 | + 7 => 46, |
|
164 | + 8 => 47, |
|
165 | + 9 => 56, |
|
166 | + 10 => 62, |
|
167 | + 11 => 78, |
|
168 | + 12 => 79, |
|
169 | + 13 => 104, |
|
170 | + 14 => 128, |
|
171 | + ])); |
|
172 | 172 | |
173 | 173 | $model = $this->container->get('\site\models\CheckinForm'); |
174 | - $model->setBehaviors($this->behaviors); |
|
174 | + $model->setBehaviors($this->behaviors); |
|
175 | 175 | $model->behaviors1[0] = null; |
176 | 176 | $model->behaviors2[0] = null; |
177 | 177 | $model->behaviors3[0] = null; |
178 | 178 | expect('compiling behaviors should strip out any falsy values', $this->assertEquals($model->compileBehaviors(), [ |
179 | - 2 => 13, |
|
180 | - 3 => 17, |
|
181 | - 4 => 18, |
|
182 | - 6 => 38, |
|
183 | - 7 => 46, |
|
184 | - 8 => 47, |
|
185 | - 9 => 56, |
|
186 | - 10 => 62, |
|
187 | - 11 => 78, |
|
188 | - 12 => 79, |
|
189 | - 13 => 104, |
|
190 | - 14 => 128, |
|
191 | - ])); |
|
179 | + 2 => 13, |
|
180 | + 3 => 17, |
|
181 | + 4 => 18, |
|
182 | + 6 => 38, |
|
183 | + 7 => 46, |
|
184 | + 8 => 47, |
|
185 | + 9 => 56, |
|
186 | + 10 => 62, |
|
187 | + 11 => 78, |
|
188 | + 12 => 79, |
|
189 | + 13 => 104, |
|
190 | + 14 => 128, |
|
191 | + ])); |
|
192 | 192 | |
193 | 193 | $model = $this->container->get('\site\models\CheckinForm'); |
194 | - $model->setBehaviors([]); |
|
194 | + $model->setBehaviors([]); |
|
195 | 195 | expect('compiling behaviors should return an empty array when no behaviors are set', $this->assertEmpty($model->compileBehaviors())); |
196 | 196 | }); |
197 | - } |
|
197 | + } |
|
198 | 198 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | protected function setUp() { |
89 | 89 | $this->container = new \yii\di\Container; |
90 | 90 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
91 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
91 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
92 | 92 | return new \common\components\Time('America/Los_Angeles'); |
93 | 93 | }); |
94 | 94 | parent::setUp(); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | public function testAttributeLabels() |
98 | 98 | { |
99 | - $this->specify('attributeLabels should function properly', function () { |
|
99 | + $this->specify('attributeLabels should function properly', function() { |
|
100 | 100 | $model = $this->container->get('\site\models\CheckinForm'); |
101 | 101 | expect('attributeLabels should be correct', $this->assertEquals($model->attributeLabels(), [ |
102 | 102 | 'behaviors1' => 'Restoration', |
@@ -112,32 +112,32 @@ discard block |
||
112 | 112 | |
113 | 113 | public function testSetBehaviors() |
114 | 114 | { |
115 | - $this->specify('setBehaviors should function properly', function () { |
|
115 | + $this->specify('setBehaviors should function properly', function() { |
|
116 | 116 | $model = $this->container->get('\site\models\CheckinForm'); |
117 | 117 | |
118 | 118 | $model->setBehaviors($this->behaviors); |
119 | - expect('behaviors1 should be correct', $this->assertEquals($model->behaviors1, [ 0 => 7 ])); |
|
120 | - expect('behaviors2 should be correct', $this->assertEquals($model->behaviors2, [ 0 => 12, 1 => 13, 2 => 17, 3 => 18 ])); |
|
121 | - expect('behaviors3 should be correct', $this->assertEquals($model->behaviors3, [ 0 => 28, 1 => 38, 2 => 46 ])); |
|
122 | - expect('behaviors4 should be correct', $this->assertEquals($model->behaviors4, [ 0 => 47, 1 => 56, 2 => 62 ])); |
|
123 | - expect('behaviors5 should be correct', $this->assertEquals($model->behaviors5, [ 0 => 78, 1 => 79 ])); |
|
124 | - expect('behaviors6 should be correct', $this->assertEquals($model->behaviors6, [ 0 => 104 ])); |
|
125 | - expect('behaviors7 should be correct', $this->assertEquals($model->behaviors7, [ 0 => 128 ])); |
|
119 | + expect('behaviors1 should be correct', $this->assertEquals($model->behaviors1, [0 => 7])); |
|
120 | + expect('behaviors2 should be correct', $this->assertEquals($model->behaviors2, [0 => 12, 1 => 13, 2 => 17, 3 => 18])); |
|
121 | + expect('behaviors3 should be correct', $this->assertEquals($model->behaviors3, [0 => 28, 1 => 38, 2 => 46])); |
|
122 | + expect('behaviors4 should be correct', $this->assertEquals($model->behaviors4, [0 => 47, 1 => 56, 2 => 62])); |
|
123 | + expect('behaviors5 should be correct', $this->assertEquals($model->behaviors5, [0 => 78, 1 => 79])); |
|
124 | + expect('behaviors6 should be correct', $this->assertEquals($model->behaviors6, [0 => 104])); |
|
125 | + expect('behaviors7 should be correct', $this->assertEquals($model->behaviors7, [0 => 128])); |
|
126 | 126 | |
127 | 127 | $model->setBehaviors($this->behaviors); |
128 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors1, [ 0 => 7 ])); |
|
129 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors2, [ 0 => 12, 1 => 13, 2 => 17, 3 => 18 ])); |
|
130 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors3, [ 0 => 28, 1 => 38, 2 => 46 ])); |
|
131 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors4, [ 0 => 47, 1 => 56, 2 => 62 ])); |
|
132 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors5, [ 0 => 78, 1 => 79 ])); |
|
133 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors6, [ 0 => 104 ])); |
|
134 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors7, [ 0 => 128 ])); |
|
128 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors1, [0 => 7])); |
|
129 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors2, [0 => 12, 1 => 13, 2 => 17, 3 => 18])); |
|
130 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors3, [0 => 28, 1 => 38, 2 => 46])); |
|
131 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors4, [0 => 47, 1 => 56, 2 => 62])); |
|
132 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors5, [0 => 78, 1 => 79])); |
|
133 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors6, [0 => 104])); |
|
134 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals($model->behaviors7, [0 => 128])); |
|
135 | 135 | }); |
136 | 136 | } |
137 | 137 | |
138 | 138 | public function testValidateBehaviors() |
139 | 139 | { |
140 | - $this->specify('validateBehaviors should function properly', function () { |
|
140 | + $this->specify('validateBehaviors should function properly', function() { |
|
141 | 141 | $model = $this->container->get('\site\models\CheckinForm'); |
142 | 142 | $model->setBehaviors($this->behaviors); |
143 | 143 | expect('validation should be good', $this->assertTrue($model->validate())); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | public function testCompileBehaviors() |
151 | 151 | { |
152 | - $this->specify('compileBehaviors should function properly', function () { |
|
152 | + $this->specify('compileBehaviors should function properly', function() { |
|
153 | 153 | $model = $this->container->get('\site\models\CheckinForm'); |
154 | 154 | $model->setBehaviors($this->behaviors); |
155 | 155 | expect('compiling behaviors should be return a correct array', $this->assertEquals($model->compileBehaviors(), [ |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $model->answer_2c = 'answering question c'; |
86 | 86 | |
87 | 87 | expect('behaviorToAnswers should return the answer properties related to the behavior number supplied', $this->assertEquals($model->behaviorToAnswers(1), [ |
88 | - 'a' => 'answering question a', |
|
89 | - 'b' => 'answering question b', |
|
90 | - 'c' => 'answering question c' |
|
91 | - ])); |
|
88 | + 'a' => 'answering question a', |
|
89 | + 'b' => 'answering question b', |
|
90 | + 'c' => 'answering question c' |
|
91 | + ])); |
|
92 | 92 | |
93 | 93 | expect('behaviorToAnswers should return the the empty set when there are no answers associated with the supplied behavior number', $this->assertEmpty($model->behaviorToAnswers(7))); |
94 | 94 | }); |
@@ -117,60 +117,60 @@ discard block |
||
117 | 117 | $this->fakeModel(13, 281, 8), |
118 | 118 | $this->fakeModel(28, 284, 8) |
119 | 119 | ]), [ [ |
120 | - 'behavior_id' => 280, |
|
120 | + 'behavior_id' => 280, |
|
121 | 121 | 'category_id' => 8, |
122 | - 'user_bhvr_id' => 7, |
|
123 | - 'question_id' => 1, |
|
124 | - 'answer' => 'processing emotions', |
|
125 | - ], [ |
|
126 | - 'behavior_id' => 280, |
|
122 | + 'user_bhvr_id' => 7, |
|
123 | + 'question_id' => 1, |
|
124 | + 'answer' => 'processing emotions', |
|
125 | + ], [ |
|
126 | + 'behavior_id' => 280, |
|
127 | 127 | 'category_id' => 8, |
128 | - 'user_bhvr_id' => 7, |
|
129 | - 'question_id' => 2, |
|
130 | - 'answer' => 'processing emotions', |
|
131 | - ], [ |
|
132 | - 'behavior_id' => 280, |
|
128 | + 'user_bhvr_id' => 7, |
|
129 | + 'question_id' => 2, |
|
130 | + 'answer' => 'processing emotions', |
|
131 | + ], [ |
|
132 | + 'behavior_id' => 280, |
|
133 | 133 | 'category_id' => 8, |
134 | - 'user_bhvr_id' => 7, |
|
135 | - 'question_id' => 3, |
|
136 | - 'answer' => 'processing emotions', |
|
137 | - ], [ |
|
138 | - 'behavior_id' => 281, |
|
134 | + 'user_bhvr_id' => 7, |
|
135 | + 'question_id' => 3, |
|
136 | + 'answer' => 'processing emotions', |
|
137 | + ], [ |
|
138 | + 'behavior_id' => 281, |
|
139 | 139 | 'category_id' => 8, |
140 | - 'user_bhvr_id' => 13, |
|
141 | - 'question_id' => 1, |
|
142 | - 'answer' => 'processing emotions', |
|
143 | - ], [ |
|
144 | - 'behavior_id' => 281, |
|
140 | + 'user_bhvr_id' => 13, |
|
141 | + 'question_id' => 1, |
|
142 | + 'answer' => 'processing emotions', |
|
143 | + ], [ |
|
144 | + 'behavior_id' => 281, |
|
145 | 145 | 'category_id' => 8, |
146 | - 'user_bhvr_id' => 13, |
|
147 | - 'question_id' => 2, |
|
148 | - 'answer' => 'processing emotions', |
|
149 | - ], [ |
|
150 | - 'behavior_id' => 281, |
|
146 | + 'user_bhvr_id' => 13, |
|
147 | + 'question_id' => 2, |
|
148 | + 'answer' => 'processing emotions', |
|
149 | + ], [ |
|
150 | + 'behavior_id' => 281, |
|
151 | 151 | 'category_id' => 8, |
152 | - 'user_bhvr_id' => 13, |
|
153 | - 'question_id' => 3, |
|
154 | - 'answer' => 'processing emotions', |
|
155 | - ], [ |
|
156 | - 'behavior_id' => 284, |
|
152 | + 'user_bhvr_id' => 13, |
|
153 | + 'question_id' => 3, |
|
154 | + 'answer' => 'processing emotions', |
|
155 | + ], [ |
|
156 | + 'behavior_id' => 284, |
|
157 | 157 | 'category_id' => 8, |
158 | - 'user_bhvr_id' => 28, |
|
159 | - 'question_id' => 1, |
|
160 | - 'answer' => 'processing emotions', |
|
161 | - ], [ |
|
162 | - 'behavior_id' => 284, |
|
158 | + 'user_bhvr_id' => 28, |
|
159 | + 'question_id' => 1, |
|
160 | + 'answer' => 'processing emotions', |
|
161 | + ], [ |
|
162 | + 'behavior_id' => 284, |
|
163 | 163 | 'category_id' => 8, |
164 | - 'user_bhvr_id' => 28, |
|
165 | - 'question_id' => 2, |
|
166 | - 'answer' => 'processing emotions', |
|
167 | - ], [ |
|
168 | - 'behavior_id' => 284, |
|
164 | + 'user_bhvr_id' => 28, |
|
165 | + 'question_id' => 2, |
|
166 | + 'answer' => 'processing emotions', |
|
167 | + ], [ |
|
168 | + 'behavior_id' => 284, |
|
169 | 169 | 'category_id' => 8, |
170 | - 'user_bhvr_id' => 28, |
|
171 | - 'question_id' => 3, |
|
172 | - 'answer' => 'processing emotions', |
|
173 | - ]])); |
|
170 | + 'user_bhvr_id' => 28, |
|
171 | + 'question_id' => 3, |
|
172 | + 'answer' => 'processing emotions', |
|
173 | + ]])); |
|
174 | 174 | }); |
175 | 175 | } |
176 | 176 |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser'); |
18 | 18 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
19 | 19 | $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion'); |
20 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
20 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
21 | 21 | return new \common\components\Time('America/Los_Angeles'); |
22 | 22 | }); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function testAttributeLabels() |
26 | 26 | { |
27 | - $this->specify('setBehaviors should function properly', function () { |
|
27 | + $this->specify('setBehaviors should function properly', function() { |
|
28 | 28 | $model = $this->container->get('\site\models\QuestionForm'); |
29 | 29 | expect('attributeLabels should be correct', $this->assertEquals($model->attributeLabels(), [ |
30 | 30 | 'user_behavior_id1' => 'Restoration', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $model = $this->container->get('\site\models\QuestionForm'); |
44 | 44 | $validator = $model->getBhvrValidator(); |
45 | 45 | |
46 | - $this->specify('getBhvrValidator should function properly', function () use($model, $validator) { |
|
46 | + $this->specify('getBhvrValidator should function properly', function() use($model, $validator) { |
|
47 | 47 | expect('getBhvrValidator should return false when nothing is set on the form', $this->assertFalse($validator($model, "user_behavior_id1"))); |
48 | 48 | expect('getBhvrValidator should return false when nothing is set on the form', $this->assertFalse($validator($model, "user_behavior_id7"))); |
49 | 49 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->fakeModel(7, 280, 8), |
117 | 117 | $this->fakeModel(13, 281, 8), |
118 | 118 | $this->fakeModel(28, 284, 8) |
119 | - ]), [ [ |
|
119 | + ]), [[ |
|
120 | 120 | 'behavior_id' => 280, |
121 | 121 | 'category_id' => 8, |
122 | 122 | 'user_bhvr_id' => 7, |
@@ -25,12 +25,12 @@ |
||
25 | 25 | <th>Behavior</th> |
26 | 26 | <th>Category</th> |
27 | 27 | </tr> |
28 | - <?php foreach($top_behaviors as $key => $row) { |
|
28 | + <?php foreach ($top_behaviors as $key => $row) { |
|
29 | 29 | $num = $key + 1; |
30 | - print "<tr>". |
|
31 | - "<td>{$row['count']}</td>". |
|
32 | - "<td>{$row['behavior']['name']}</td>". |
|
33 | - "<td>{$row['category']['name']}</td>". |
|
30 | + print "<tr>" . |
|
31 | + "<td>{$row['count']}</td>" . |
|
32 | + "<td>{$row['behavior']['name']}</td>" . |
|
33 | + "<td>{$row['category']['name']}</td>" . |
|
34 | 34 | "</tr>"; |
35 | 35 | } |
36 | 36 | ?> |