Completed
Push — master ( dda5a0...2d250b )
by Corey
03:06
created
common/tests/unit/components/TimeTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
common/tests/unit/models/UserTest.php 2 patches
Indentation   +624 added lines, -624 removed lines patch added patch discarded remove patch
@@ -19,640 +19,640 @@
 block discarded – undo
19 19
   private $time;
20 20
   private $question;
21 21
 
22
-	public $questionData = [
23
-	[
24
-		'id' => 641,
25
-		'user_id' => 2,
26
-		'behavior_id' => 13,
27
-		'user_behavior_id' => 821,
28
-		'question' => 1,
29
-		'answer' => 'alsgn',
30
-		'date' => '2016-09-10 19:27:43',
31
-		'behavior' => 
32
-		[
33
-			'id' => 13,
34
-			'name' => 'less time/energy for God, meetings, and church',
35
-			'category_id' => 2,
36
-		],
37
-	],
38
-	[
39
-		'id' => 642,
40
-		'user_id' => 2,
41
-		'behavior_id' => 13,
42
-		'user_behavior_id' => 821,
43
-		'question' => 2,
44
-		'answer' => 'loiun',
45
-		'date' => '2016-09-10 19:27:43',
46
-		'behavior' => 
47
-		[
48
-			'id' => 13,
49
-			'name' => 'less time/energy for God, meetings, and church',
50
-			'category_id' => 2,
51
-		],
52
-	],
53
-	[
54
-		'id' => 643,
55
-		'user_id' => 2,
56
-		'behavior_id' => 13,
57
-		'user_behavior_id' => 821,
58
-		'question' => 3,
59
-		'answer' => 'liun',
60
-		'date' => '2016-09-10 19:27:43',
61
-		'behavior' => 
62
-		[
63
-			'id' => 13,
64
-			'name' => 'less time/energy for God, meetings, and church',
65
-			'category_id' => 2,
66
-		],
67
-	],
68
-	[
69
-		'id' => 644,
70
-		'user_id' => 2,
71
-		'behavior_id' => 29,
72
-		'user_behavior_id' => 823,
73
-		'question' => 1,
74
-		'answer' => 'ljnb',
75
-		'date' => '2016-09-10 19:27:43',
76
-		'behavior' => 
77
-		[
78
-			'id' => 29,
79
-			'name' => 'using profanity',
80
-			'category_id' => 3,
81
-		],
82
-	],
83
-	[
84
-		'id' => 645,
85
-		'user_id' => 2,
86
-		'behavior_id' => 29,
87
-		'user_behavior_id' => 823,
88
-		'question' => 2,
89
-		'answer' => 'liunb',
90
-		'date' => '2016-09-10 19:27:43',
91
-		'behavior' => 
92
-		[
93
-			'id' => 29,
94
-			'name' => 'using profanity',
95
-			'category_id' => 3,
96
-		],
97
-	],
98
-	[
99
-		'id' => 646,
100
-		'user_id' => 2,
101
-		'behavior_id' => 29,
102
-		'user_behavior_id' => 823,
103
-		'question' => 3,
104
-		'answer' => 'ilub ',
105
-		'date' => '2016-09-10 19:27:43',
106
-		'behavior' => 
107
-		[
108
-			'id' => 29,
109
-			'name' => 'using profanity',
110
-			'category_id' => 3,
111
-		],
112
-	],
113
-	[
114
-		'id' => 647,
115
-		'user_id' => 2,
116
-		'behavior_id' => 48,
117
-		'user_behavior_id' => 825,
118
-		'question' => 1,
119
-		'answer' => 'liub',
120
-		'date' => '2016-09-10 19:27:43',
121
-		'behavior' => 
122
-		[
123
-			'id' => 48,
124
-			'name' => 'workaholic',
125
-			'category_id' => 4,
126
-		],
127
-	],
128
-	[
129
-		'id' => 648,
130
-		'user_id' => 2,
131
-		'behavior_id' => 48,
132
-		'user_behavior_id' => 825,
133
-		'question' => 2,
134
-		'answer' => 'liub',
135
-		'date' => '2016-09-10 19:27:43',
136
-		'behavior' => 
137
-		[
138
-			'id' => 48,
139
-			'name' => 'workaholic',
140
-			'category_id' => 4,
141
-		],
142
-	],
143
-	[
144
-		'id' => 649,
145
-		'user_id' => 2,
146
-		'behavior_id' => 48,
147
-		'user_behavior_id' => 825,
148
-		'question' => 3,
149
-		'answer' => 'liub ',
150
-		'date' => '2016-09-10 19:27:43',
151
-		'behavior' => 
152
-		[
153
-			'id' => 48,
154
-			'name' => 'workaholic',
155
-			'category_id' => 4,
156
-		],
157
-	],
158
-	[
159
-		'id' => 650,
160
-		'user_id' => 2,
161
-		'behavior_id' => 89,
162
-		'user_behavior_id' => 828,
163
-		'question' => 1,
164
-		'answer' => 'liub',
165
-		'date' => '2016-09-10 19:27:43',
166
-		'behavior' => 
167
-		[
168
-			'id' => 89,
169
-			'name' => 'obsessive (stuck) thoughts',
170
-			'category_id' => 5,
171
-		],
172
-	],
173
-	[
174
-		'id' => 651,
175
-		'user_id' => 2,
176
-		'behavior_id' => 89,
177
-		'user_behavior_id' => 828,
178
-		'question' => 2,
179
-		'answer' => 'liuby',
180
-		'date' => '2016-09-10 19:27:43',
181
-		'behavior' => 
182
-		[
183
-			'id' => 89,
184
-			'name' => 'obsessive (stuck) thoughts',
185
-			'category_id' => 5,
186
-		],
187
-	],
188
-	[
189
-		'id' => 652,
190
-		'user_id' => 2,
191
-		'behavior_id' => 89,
192
-		'user_behavior_id' => 828,
193
-		'question' => 3,
194
-		'answer' => 'uiylb',
195
-		'date' => '2016-09-10 19:27:43',
196
-		'behavior' => 
197
-		[
198
-			'id' => 89,
199
-			'name' => 'obsessive (stuck) thoughts',
200
-			'category_id' => 5,
201
-		],
202
-	],
203
-	[
204
-		'id' => 653,
205
-		'user_id' => 2,
206
-		'behavior_id' => 111,
207
-		'user_behavior_id' => 829,
208
-		'question' => 1,
209
-		'answer' => 'liub',
210
-		'date' => '2016-09-10 19:27:43',
211
-		'behavior' => 
212
-		[
213
-			'id' => 111,
214
-			'name' => 'seeking out old unhealthy people and places',
215
-			'category_id' => 6,
216
-		],
217
-	],
218
-	[
219
-		'id' => 654,
220
-		'user_id' => 2,
221
-		'behavior_id' => 111,
222
-		'user_behavior_id' => 829,
223
-		'question' => 2,
224
-		'answer' => 'liuyb',
225
-		'date' => '2016-09-10 19:27:43',
226
-		'behavior' => 
227
-		[
228
-			'id' => 111,
229
-			'name' => 'seeking out old unhealthy people and places',
230
-			'category_id' => 6,
231
-		],
232
-	],
233
-	[
234
-		'id' => 655,
235
-		'user_id' => 2,
236
-		'behavior_id' => 111,
237
-		'user_behavior_id' => 829,
238
-		'question' => 3,
239
-		'answer' => 'iuyb',
240
-		'date' => '2016-09-10 19:27:43',
241
-		'behavior' => 
242
-		[
243
-			'id' => 111,
244
-			'name' => 'seeking out old unhealthy people and places',
245
-			'category_id' => 6,
246
-		],
247
-	],
248
-	[
249
-		'id' => 656,
250
-		'user_id' => 2,
251
-		'behavior_id' => 122,
252
-		'user_behavior_id' => 831,
253
-		'question' => 1,
254
-		'answer' => 'iuyb',
255
-		'date' => '2016-09-10 19:27:43',
256
-		'behavior' => 
257
-		[
258
-			'id' => 122,
259
-			'name' => 'returning to the place you swore you would never go again',
260
-			'category_id' => 7,
261
-		],
262
-	],
263
-	[
264
-		'id' => 657,
265
-		'user_id' => 2,
266
-		'behavior_id' => 122,
267
-		'user_behavior_id' => 831,
268
-		'question' => 2,
269
-		'answer' => 'iuyb',
270
-		'date' => '2016-09-10 19:27:43',
271
-		'behavior' => 
272
-		[
273
-			'id' => 122,
274
-			'name' => 'returning to the place you swore you would never go again',
275
-			'category_id' => 7,
276
-		],
277
-	],
278
-	[
279
-		'id' => 658,
280
-		'user_id' => 2,
281
-		'behavior_id' => 122,
282
-		'user_behavior_id' => 831,
283
-		'question' => 3,
284
-		'answer' => 'liuyb',
285
-		'date' => '2016-09-10 19:27:43',
286
-		'behavior' => 
287
-		[
288
-			'id' => 122,
289
-			'name' => 'returning to the place you swore you would never go again',
290
-			'category_id' => 7,
291
-		],
292
-	],
22
+  public $questionData = [
23
+  [
24
+    'id' => 641,
25
+    'user_id' => 2,
26
+    'behavior_id' => 13,
27
+    'user_behavior_id' => 821,
28
+    'question' => 1,
29
+    'answer' => 'alsgn',
30
+    'date' => '2016-09-10 19:27:43',
31
+    'behavior' => 
32
+    [
33
+      'id' => 13,
34
+      'name' => 'less time/energy for God, meetings, and church',
35
+      'category_id' => 2,
36
+    ],
37
+  ],
38
+  [
39
+    'id' => 642,
40
+    'user_id' => 2,
41
+    'behavior_id' => 13,
42
+    'user_behavior_id' => 821,
43
+    'question' => 2,
44
+    'answer' => 'loiun',
45
+    'date' => '2016-09-10 19:27:43',
46
+    'behavior' => 
47
+    [
48
+      'id' => 13,
49
+      'name' => 'less time/energy for God, meetings, and church',
50
+      'category_id' => 2,
51
+    ],
52
+  ],
53
+  [
54
+    'id' => 643,
55
+    'user_id' => 2,
56
+    'behavior_id' => 13,
57
+    'user_behavior_id' => 821,
58
+    'question' => 3,
59
+    'answer' => 'liun',
60
+    'date' => '2016-09-10 19:27:43',
61
+    'behavior' => 
62
+    [
63
+      'id' => 13,
64
+      'name' => 'less time/energy for God, meetings, and church',
65
+      'category_id' => 2,
66
+    ],
67
+  ],
68
+  [
69
+    'id' => 644,
70
+    'user_id' => 2,
71
+    'behavior_id' => 29,
72
+    'user_behavior_id' => 823,
73
+    'question' => 1,
74
+    'answer' => 'ljnb',
75
+    'date' => '2016-09-10 19:27:43',
76
+    'behavior' => 
77
+    [
78
+      'id' => 29,
79
+      'name' => 'using profanity',
80
+      'category_id' => 3,
81
+    ],
82
+  ],
83
+  [
84
+    'id' => 645,
85
+    'user_id' => 2,
86
+    'behavior_id' => 29,
87
+    'user_behavior_id' => 823,
88
+    'question' => 2,
89
+    'answer' => 'liunb',
90
+    'date' => '2016-09-10 19:27:43',
91
+    'behavior' => 
92
+    [
93
+      'id' => 29,
94
+      'name' => 'using profanity',
95
+      'category_id' => 3,
96
+    ],
97
+  ],
98
+  [
99
+    'id' => 646,
100
+    'user_id' => 2,
101
+    'behavior_id' => 29,
102
+    'user_behavior_id' => 823,
103
+    'question' => 3,
104
+    'answer' => 'ilub ',
105
+    'date' => '2016-09-10 19:27:43',
106
+    'behavior' => 
107
+    [
108
+      'id' => 29,
109
+      'name' => 'using profanity',
110
+      'category_id' => 3,
111
+    ],
112
+  ],
113
+  [
114
+    'id' => 647,
115
+    'user_id' => 2,
116
+    'behavior_id' => 48,
117
+    'user_behavior_id' => 825,
118
+    'question' => 1,
119
+    'answer' => 'liub',
120
+    'date' => '2016-09-10 19:27:43',
121
+    'behavior' => 
122
+    [
123
+      'id' => 48,
124
+      'name' => 'workaholic',
125
+      'category_id' => 4,
126
+    ],
127
+  ],
128
+  [
129
+    'id' => 648,
130
+    'user_id' => 2,
131
+    'behavior_id' => 48,
132
+    'user_behavior_id' => 825,
133
+    'question' => 2,
134
+    'answer' => 'liub',
135
+    'date' => '2016-09-10 19:27:43',
136
+    'behavior' => 
137
+    [
138
+      'id' => 48,
139
+      'name' => 'workaholic',
140
+      'category_id' => 4,
141
+    ],
142
+  ],
143
+  [
144
+    'id' => 649,
145
+    'user_id' => 2,
146
+    'behavior_id' => 48,
147
+    'user_behavior_id' => 825,
148
+    'question' => 3,
149
+    'answer' => 'liub ',
150
+    'date' => '2016-09-10 19:27:43',
151
+    'behavior' => 
152
+    [
153
+      'id' => 48,
154
+      'name' => 'workaholic',
155
+      'category_id' => 4,
156
+    ],
157
+  ],
158
+  [
159
+    'id' => 650,
160
+    'user_id' => 2,
161
+    'behavior_id' => 89,
162
+    'user_behavior_id' => 828,
163
+    'question' => 1,
164
+    'answer' => 'liub',
165
+    'date' => '2016-09-10 19:27:43',
166
+    'behavior' => 
167
+    [
168
+      'id' => 89,
169
+      'name' => 'obsessive (stuck) thoughts',
170
+      'category_id' => 5,
171
+    ],
172
+  ],
173
+  [
174
+    'id' => 651,
175
+    'user_id' => 2,
176
+    'behavior_id' => 89,
177
+    'user_behavior_id' => 828,
178
+    'question' => 2,
179
+    'answer' => 'liuby',
180
+    'date' => '2016-09-10 19:27:43',
181
+    'behavior' => 
182
+    [
183
+      'id' => 89,
184
+      'name' => 'obsessive (stuck) thoughts',
185
+      'category_id' => 5,
186
+    ],
187
+  ],
188
+  [
189
+    'id' => 652,
190
+    'user_id' => 2,
191
+    'behavior_id' => 89,
192
+    'user_behavior_id' => 828,
193
+    'question' => 3,
194
+    'answer' => 'uiylb',
195
+    'date' => '2016-09-10 19:27:43',
196
+    'behavior' => 
197
+    [
198
+      'id' => 89,
199
+      'name' => 'obsessive (stuck) thoughts',
200
+      'category_id' => 5,
201
+    ],
202
+  ],
203
+  [
204
+    'id' => 653,
205
+    'user_id' => 2,
206
+    'behavior_id' => 111,
207
+    'user_behavior_id' => 829,
208
+    'question' => 1,
209
+    'answer' => 'liub',
210
+    'date' => '2016-09-10 19:27:43',
211
+    'behavior' => 
212
+    [
213
+      'id' => 111,
214
+      'name' => 'seeking out old unhealthy people and places',
215
+      'category_id' => 6,
216
+    ],
217
+  ],
218
+  [
219
+    'id' => 654,
220
+    'user_id' => 2,
221
+    'behavior_id' => 111,
222
+    'user_behavior_id' => 829,
223
+    'question' => 2,
224
+    'answer' => 'liuyb',
225
+    'date' => '2016-09-10 19:27:43',
226
+    'behavior' => 
227
+    [
228
+      'id' => 111,
229
+      'name' => 'seeking out old unhealthy people and places',
230
+      'category_id' => 6,
231
+    ],
232
+  ],
233
+  [
234
+    'id' => 655,
235
+    'user_id' => 2,
236
+    'behavior_id' => 111,
237
+    'user_behavior_id' => 829,
238
+    'question' => 3,
239
+    'answer' => 'iuyb',
240
+    'date' => '2016-09-10 19:27:43',
241
+    'behavior' => 
242
+    [
243
+      'id' => 111,
244
+      'name' => 'seeking out old unhealthy people and places',
245
+      'category_id' => 6,
246
+    ],
247
+  ],
248
+  [
249
+    'id' => 656,
250
+    'user_id' => 2,
251
+    'behavior_id' => 122,
252
+    'user_behavior_id' => 831,
253
+    'question' => 1,
254
+    'answer' => 'iuyb',
255
+    'date' => '2016-09-10 19:27:43',
256
+    'behavior' => 
257
+    [
258
+      'id' => 122,
259
+      'name' => 'returning to the place you swore you would never go again',
260
+      'category_id' => 7,
261
+    ],
262
+  ],
263
+  [
264
+    'id' => 657,
265
+    'user_id' => 2,
266
+    'behavior_id' => 122,
267
+    'user_behavior_id' => 831,
268
+    'question' => 2,
269
+    'answer' => 'iuyb',
270
+    'date' => '2016-09-10 19:27:43',
271
+    'behavior' => 
272
+    [
273
+      'id' => 122,
274
+      'name' => 'returning to the place you swore you would never go again',
275
+      'category_id' => 7,
276
+    ],
277
+  ],
278
+  [
279
+    'id' => 658,
280
+    'user_id' => 2,
281
+    'behavior_id' => 122,
282
+    'user_behavior_id' => 831,
283
+    'question' => 3,
284
+    'answer' => 'liuyb',
285
+    'date' => '2016-09-10 19:27:43',
286
+    'behavior' => 
287
+    [
288
+      'id' => 122,
289
+      'name' => 'returning to the place you swore you would never go again',
290
+      'category_id' => 7,
291
+    ],
292
+  ],
293 293
 ];
294 294
 public $userQuestions = [
295
-	13 => [
296
-		'question' => [
297
-			'id' => 13,
298
-			'title' => 'less time/energy for God, meetings, and church',
299
-		],
300
-		'answers' => [
301
-			[
302
-				'title' => 'How does it affect me? How do I act and feel?',
303
-				'answer' => 'alsgn',
304
-			], [
305
-				'title' => 'How does it affect the important people in my life?',
306
-				'answer' => 'loiun',
307
-			], [
308
-				'title' => 'Why do I do this? What is the benefit for me?',
309
-				'answer' => 'liun',
310
-			],
311
-		],
312
-	],
313
-	29 => [
314
-		'question' => [
315
-			'id' => 29,
316
-			'title' => 'using profanity',
317
-		],
318
-		'answers' => [
319
-			[
320
-				'title' => 'How does it affect me? How do I act and feel?',
321
-				'answer' => 'ljnb',
322
-			], [
323
-				'title' => 'How does it affect the important people in my life?',
324
-				'answer' => 'liunb',
325
-			], [
326
-				'title' => 'Why do I do this? What is the benefit for me?',
327
-				'answer' => 'ilub ',
328
-			],
329
-		],
330
-	],
331
-	48 => [
332
-		'question' => [
333
-			'id' => 48,
334
-			'title' => 'workaholic',
335
-		],
336
-		'answers' => [
337
-			[
338
-				'title' => 'How does it affect me? How do I act and feel?',
339
-				'answer' => 'liub',
340
-			], [
341
-				'title' => 'How does it affect the important people in my life?',
342
-				'answer' => 'liub',
343
-			], [
344
-				'title' => 'Why do I do this? What is the benefit for me?',
345
-				'answer' => 'liub ',
346
-			],
347
-		],
348
-	],
349
-	89 => [
350
-		'question' => [
351
-			'id' => 89,
352
-			'title' => 'obsessive (stuck) thoughts',
353
-		],
354
-		'answers' => [
355
-			[
356
-				'title' => 'How does it affect me? How do I act and feel?',
357
-				'answer' => 'liub',
358
-			], [
359
-				'title' => 'How does it affect the important people in my life?',
360
-				'answer' => 'liuby',
361
-			], [
362
-				'title' => 'Why do I do this? What is the benefit for me?',
363
-				'answer' => 'uiylb',
364
-			],
365
-		],
366
-	],
367
-	111 => [
368
-		'question' => [
369
-			'id' => 111,
370
-			'title' => 'seeking out old unhealthy people and places',
371
-		],
372
-		'answers' => [
373
-			[
374
-				'title' => 'How does it affect me? How do I act and feel?',
375
-				'answer' => 'liub',
376
-			], [
377
-				'title' => 'How does it affect the important people in my life?',
378
-				'answer' => 'liuyb',
379
-			], [
380
-				'title' => 'Why do I do this? What is the benefit for me?',
381
-				'answer' => 'iuyb',
382
-			],
383
-		],
384
-	],
385
-	122 => [
386
-		'question' => [
387
-			'id' => 122,
388
-			'title' => 'returning to the place you swore you would never go again',
389
-		],
390
-		'answers' => [
391
-			[
392
-				'title' => 'How does it affect me? How do I act and feel?',
393
-				'answer' => 'iuyb',
394
-			], [
395
-				'title' => 'How does it affect the important people in my life?',
396
-				'answer' => 'iuyb',
397
-			], [
398
-				'title' => 'Why do I do this? What is the benefit for me?',
399
-				'answer' => 'liuyb',
400
-			],
401
-		],
402
-	],
295
+  13 => [
296
+    'question' => [
297
+      'id' => 13,
298
+      'title' => 'less time/energy for God, meetings, and church',
299
+    ],
300
+    'answers' => [
301
+      [
302
+        'title' => 'How does it affect me? How do I act and feel?',
303
+        'answer' => 'alsgn',
304
+      ], [
305
+        'title' => 'How does it affect the important people in my life?',
306
+        'answer' => 'loiun',
307
+      ], [
308
+        'title' => 'Why do I do this? What is the benefit for me?',
309
+        'answer' => 'liun',
310
+      ],
311
+    ],
312
+  ],
313
+  29 => [
314
+    'question' => [
315
+      'id' => 29,
316
+      'title' => 'using profanity',
317
+    ],
318
+    'answers' => [
319
+      [
320
+        'title' => 'How does it affect me? How do I act and feel?',
321
+        'answer' => 'ljnb',
322
+      ], [
323
+        'title' => 'How does it affect the important people in my life?',
324
+        'answer' => 'liunb',
325
+      ], [
326
+        'title' => 'Why do I do this? What is the benefit for me?',
327
+        'answer' => 'ilub ',
328
+      ],
329
+    ],
330
+  ],
331
+  48 => [
332
+    'question' => [
333
+      'id' => 48,
334
+      'title' => 'workaholic',
335
+    ],
336
+    'answers' => [
337
+      [
338
+        'title' => 'How does it affect me? How do I act and feel?',
339
+        'answer' => 'liub',
340
+      ], [
341
+        'title' => 'How does it affect the important people in my life?',
342
+        'answer' => 'liub',
343
+      ], [
344
+        'title' => 'Why do I do this? What is the benefit for me?',
345
+        'answer' => 'liub ',
346
+      ],
347
+    ],
348
+  ],
349
+  89 => [
350
+    'question' => [
351
+      'id' => 89,
352
+      'title' => 'obsessive (stuck) thoughts',
353
+    ],
354
+    'answers' => [
355
+      [
356
+        'title' => 'How does it affect me? How do I act and feel?',
357
+        'answer' => 'liub',
358
+      ], [
359
+        'title' => 'How does it affect the important people in my life?',
360
+        'answer' => 'liuby',
361
+      ], [
362
+        'title' => 'Why do I do this? What is the benefit for me?',
363
+        'answer' => 'uiylb',
364
+      ],
365
+    ],
366
+  ],
367
+  111 => [
368
+    'question' => [
369
+      'id' => 111,
370
+      'title' => 'seeking out old unhealthy people and places',
371
+    ],
372
+    'answers' => [
373
+      [
374
+        'title' => 'How does it affect me? How do I act and feel?',
375
+        'answer' => 'liub',
376
+      ], [
377
+        'title' => 'How does it affect the important people in my life?',
378
+        'answer' => 'liuyb',
379
+      ], [
380
+        'title' => 'Why do I do this? What is the benefit for me?',
381
+        'answer' => 'iuyb',
382
+      ],
383
+    ],
384
+  ],
385
+  122 => [
386
+    'question' => [
387
+      'id' => 122,
388
+      'title' => 'returning to the place you swore you would never go again',
389
+    ],
390
+    'answers' => [
391
+      [
392
+        'title' => 'How does it affect me? How do I act and feel?',
393
+        'answer' => 'iuyb',
394
+      ], [
395
+        'title' => 'How does it affect the important people in my life?',
396
+        'answer' => 'iuyb',
397
+      ], [
398
+        'title' => 'Why do I do this? What is the benefit for me?',
399
+        'answer' => 'liuyb',
400
+      ],
401
+    ],
402
+  ],
403 403
 ];
404 404
 
405 405
 public $behaviorData = [
406
-	[
407
-		'id' => 820,
408
-		'user_id' => 2,
409
-		'behavior_id' => 7,
410
-		'date' => '2016-09-10 19:26:04',
411
-		'behavior' => [
412
-			'id' => 7,
413
-			'name' => 'making eye contact',
414
-			'category_id' => 1,
415
-			'category' => [
416
-				'id' => 1,
417
-				'name' => 'Restoration',
418
-			],
419
-		],
420
-	], [
421
-		'id' => 821,
422
-		'user_id' => 2,
423
-		'behavior_id' => 13,
424
-		'date' => '2016-09-10 19:26:04',
425
-		'behavior' => [
426
-			'id' => 13,
427
-			'name' => 'less time/energy for God, meetings, and church',
428
-			'category_id' => 2,
429
-			'category' => [
430
-				'id' => 2,
431
-				'name' => 'Forgetting Priorities',
432
-			],
433
-		],
434
-	], [
435
-		'id' => 822,
436
-		'user_id' => 2,
437
-		'behavior_id' => 18,
438
-		'date' => '2016-09-10 19:26:04',
439
-		'behavior' => [
440
-			'id' => 18,
441
-			'name' => 'changes in goals',
442
-			'category_id' => 2,
443
-			'category' => [
444
-				'id' => 2,
445
-				'name' => 'Forgetting Priorities',
446
-			],
447
-		],
448
-	], [
449
-		'id' => 823,
450
-		'user_id' => 2,
451
-		'behavior_id' => 29,
452
-		'date' => '2016-09-10 19:26:04',
453
-		'behavior' => [
454
-			'id' => 29,
455
-			'name' => 'using profanity',
456
-			'category_id' => 3,
457
-			'category' => [
458
-				'id' => 3,
459
-				'name' => 'Anxiety',
460
-			],
461
-		],
462
-	], [
463
-		'id' => 824,
464
-		'user_id' => 2,
465
-		'behavior_id' => 41,
466
-		'date' => '2016-09-10 19:26:04',
467
-		'behavior' => [
468
-			'id' => 41,
469
-			'name' => 'co-dependent rescuing',
470
-			'category_id' => 3,
471
-			'category' => [
472
-				'id' => 3,
473
-				'name' => 'Anxiety',
474
-			],
475
-		],
476
-	], [
477
-		'id' => 825,
478
-		'user_id' => 2,
479
-		'behavior_id' => 48,
480
-		'date' => '2016-09-10 19:26:04',
481
-		'behavior' => [
482
-			'id' => 48,
483
-			'name' => 'workaholic',
484
-			'category_id' => 4,
485
-			'category' => [
486
-				'id' => 4,
487
-				'name' => 'Speeding Up',
488
-			],
489
-		],
490
-	], [
491
-		'id' => 826,
492
-		'user_id' => 2,
493
-		'behavior_id' => 72,
494
-		'date' => '2016-09-10 19:26:04',
495
-		'behavior' => [
496
-			'id' => 72,
497
-			'name' => 'black and white, all or nothing thinking',
498
-			'category_id' => 5,
499
-			'category' => [
500
-				'id' => 5,
501
-				'name' => 'Ticked Off',
502
-			],
503
-		],
504
-	], [
505
-		'id' => 827,
506
-		'user_id' => 2,
507
-		'behavior_id' => 79,
508
-		'date' => '2016-09-10 19:26:04',
509
-		'behavior' => [
510
-			'id' => 79,
511
-			'name' => 'blaming',
512
-			'category_id' => 5,
513
-			'category' => [
514
-				'id' => 5,
515
-				'name' => 'Ticked Off',
516
-			],
517
-		],
518
-	], [
519
-		'id' => 828,
520
-		'user_id' => 2,
521
-		'behavior_id' => 89,
522
-		'date' => '2016-09-10 19:26:04',
523
-		'behavior' => [
524
-			'id' => 89,
525
-			'name' => 'obsessive (stuck) thoughts',
526
-			'category_id' => 5,
527
-			'category' => [
528
-				'id' => 5,
529
-				'name' => 'Ticked Off',
530
-			],
531
-		],
532
-	], [
533
-		'id' => 829,
534
-		'user_id' => 2,
535
-		'behavior_id' => 111,
536
-		'date' => '2016-09-10 19:26:04',
537
-		'behavior' => [
538
-			'id' => 111,
539
-			'name' => 'seeking out old unhealthy people and places',
540
-			'category_id' => 6,
541
-			'category' => [
542
-				'id' => 6,
543
-				'name' => 'Exhausted',
544
-			],
545
-		],
546
-	], [
547
-		'id' => 830,
548
-		'user_id' => 2,
549
-		'behavior_id' => 118,
550
-		'date' => '2016-09-10 19:26:04',
551
-		'behavior' => [
552
-			'id' => 118,
553
-			'name' => 'not returning phone calls',
554
-			'category_id' => 6,
555
-			'category' => [
556
-				'id' => 6,
557
-				'name' => 'Exhausted',
558
-			],
559
-		],
560
-	], [
561
-		'id' => 831,
562
-		'user_id' => 2,
563
-		'behavior_id' => 122,
564
-		'date' => '2016-09-10 19:26:04',
565
-		'behavior' => [
566
-			'id' => 122,
567
-			'name' => 'returning to the place you swore you would never go again',
568
-			'category_id' => 7,
569
-			'category' => [
570
-				'id' => 7,
571
-				'name' => 'Relapse/Moral Failure',
572
-			],
573
-		],
574
-	],
406
+  [
407
+    'id' => 820,
408
+    'user_id' => 2,
409
+    'behavior_id' => 7,
410
+    'date' => '2016-09-10 19:26:04',
411
+    'behavior' => [
412
+      'id' => 7,
413
+      'name' => 'making eye contact',
414
+      'category_id' => 1,
415
+      'category' => [
416
+        'id' => 1,
417
+        'name' => 'Restoration',
418
+      ],
419
+    ],
420
+  ], [
421
+    'id' => 821,
422
+    'user_id' => 2,
423
+    'behavior_id' => 13,
424
+    'date' => '2016-09-10 19:26:04',
425
+    'behavior' => [
426
+      'id' => 13,
427
+      'name' => 'less time/energy for God, meetings, and church',
428
+      'category_id' => 2,
429
+      'category' => [
430
+        'id' => 2,
431
+        'name' => 'Forgetting Priorities',
432
+      ],
433
+    ],
434
+  ], [
435
+    'id' => 822,
436
+    'user_id' => 2,
437
+    'behavior_id' => 18,
438
+    'date' => '2016-09-10 19:26:04',
439
+    'behavior' => [
440
+      'id' => 18,
441
+      'name' => 'changes in goals',
442
+      'category_id' => 2,
443
+      'category' => [
444
+        'id' => 2,
445
+        'name' => 'Forgetting Priorities',
446
+      ],
447
+    ],
448
+  ], [
449
+    'id' => 823,
450
+    'user_id' => 2,
451
+    'behavior_id' => 29,
452
+    'date' => '2016-09-10 19:26:04',
453
+    'behavior' => [
454
+      'id' => 29,
455
+      'name' => 'using profanity',
456
+      'category_id' => 3,
457
+      'category' => [
458
+        'id' => 3,
459
+        'name' => 'Anxiety',
460
+      ],
461
+    ],
462
+  ], [
463
+    'id' => 824,
464
+    'user_id' => 2,
465
+    'behavior_id' => 41,
466
+    'date' => '2016-09-10 19:26:04',
467
+    'behavior' => [
468
+      'id' => 41,
469
+      'name' => 'co-dependent rescuing',
470
+      'category_id' => 3,
471
+      'category' => [
472
+        'id' => 3,
473
+        'name' => 'Anxiety',
474
+      ],
475
+    ],
476
+  ], [
477
+    'id' => 825,
478
+    'user_id' => 2,
479
+    'behavior_id' => 48,
480
+    'date' => '2016-09-10 19:26:04',
481
+    'behavior' => [
482
+      'id' => 48,
483
+      'name' => 'workaholic',
484
+      'category_id' => 4,
485
+      'category' => [
486
+        'id' => 4,
487
+        'name' => 'Speeding Up',
488
+      ],
489
+    ],
490
+  ], [
491
+    'id' => 826,
492
+    'user_id' => 2,
493
+    'behavior_id' => 72,
494
+    'date' => '2016-09-10 19:26:04',
495
+    'behavior' => [
496
+      'id' => 72,
497
+      'name' => 'black and white, all or nothing thinking',
498
+      'category_id' => 5,
499
+      'category' => [
500
+        'id' => 5,
501
+        'name' => 'Ticked Off',
502
+      ],
503
+    ],
504
+  ], [
505
+    'id' => 827,
506
+    'user_id' => 2,
507
+    'behavior_id' => 79,
508
+    'date' => '2016-09-10 19:26:04',
509
+    'behavior' => [
510
+      'id' => 79,
511
+      'name' => 'blaming',
512
+      'category_id' => 5,
513
+      'category' => [
514
+        'id' => 5,
515
+        'name' => 'Ticked Off',
516
+      ],
517
+    ],
518
+  ], [
519
+    'id' => 828,
520
+    'user_id' => 2,
521
+    'behavior_id' => 89,
522
+    'date' => '2016-09-10 19:26:04',
523
+    'behavior' => [
524
+      'id' => 89,
525
+      'name' => 'obsessive (stuck) thoughts',
526
+      'category_id' => 5,
527
+      'category' => [
528
+        'id' => 5,
529
+        'name' => 'Ticked Off',
530
+      ],
531
+    ],
532
+  ], [
533
+    'id' => 829,
534
+    'user_id' => 2,
535
+    'behavior_id' => 111,
536
+    'date' => '2016-09-10 19:26:04',
537
+    'behavior' => [
538
+      'id' => 111,
539
+      'name' => 'seeking out old unhealthy people and places',
540
+      'category_id' => 6,
541
+      'category' => [
542
+        'id' => 6,
543
+        'name' => 'Exhausted',
544
+      ],
545
+    ],
546
+  ], [
547
+    'id' => 830,
548
+    'user_id' => 2,
549
+    'behavior_id' => 118,
550
+    'date' => '2016-09-10 19:26:04',
551
+    'behavior' => [
552
+      'id' => 118,
553
+      'name' => 'not returning phone calls',
554
+      'category_id' => 6,
555
+      'category' => [
556
+        'id' => 6,
557
+        'name' => 'Exhausted',
558
+      ],
559
+    ],
560
+  ], [
561
+    'id' => 831,
562
+    'user_id' => 2,
563
+    'behavior_id' => 122,
564
+    'date' => '2016-09-10 19:26:04',
565
+    'behavior' => [
566
+      'id' => 122,
567
+      'name' => 'returning to the place you swore you would never go again',
568
+      'category_id' => 7,
569
+      'category' => [
570
+        'id' => 7,
571
+        'name' => 'Relapse/Moral Failure',
572
+      ],
573
+    ],
574
+  ],
575 575
 ];
576 576
 
577 577
 public $userBehaviors = [
578
-	1 => [
579
-		'category_name' => 'Restoration',
580
-		'behaviors' => [
581
-			[
582
-				'id' => 7,
583
-				'name' => 'making eye contact',
584
-			],
585
-		],
586
-	],
587
-	2 => [
588
-		'category_name' => 'Forgetting Priorities',
589
-		'behaviors' => [
590
-			[
591
-				'id' => 13,
592
-				'name' => 'less time/energy for God, meetings, and church',
593
-			], [
594
-				'id' => 18,
595
-				'name' => 'changes in goals',
596
-			],
597
-		],
578
+  1 => [
579
+    'category_name' => 'Restoration',
580
+    'behaviors' => [
581
+      [
582
+        'id' => 7,
583
+        'name' => 'making eye contact',
584
+      ],
585
+    ],
586
+  ],
587
+  2 => [
588
+    'category_name' => 'Forgetting Priorities',
589
+    'behaviors' => [
590
+      [
591
+        'id' => 13,
592
+        'name' => 'less time/energy for God, meetings, and church',
593
+      ], [
594
+        'id' => 18,
595
+        'name' => 'changes in goals',
596
+      ],
597
+    ],
598 598
   ],
599 599
   3 => [
600
-		'category_name' => 'Anxiety',
601
-		'behaviors' => [
602
-			[
603
-				'id' => 29,
604
-				'name' => 'using profanity',
605
-			], [
606
-				'id' => 41,
607
-				'name' => 'co-dependent rescuing',
608
-			],
609
-		],
610
-	],
611
-	4 => [
612
-		'category_name' => 'Speeding Up',
613
-		'behaviors' => [
614
-			[
615
-				'id' => 48,
616
-				'name' => 'workaholic',
617
-			],
618
-		],
619
-	],
620
-	5 => [
621
-		'category_name' => 'Ticked Off',
622
-		'behaviors' => [
623
-			[
624
-				'id' => 72,
625
-				'name' => 'black and white, all or nothing thinking',
626
-			], [
627
-				'id' => 79,
628
-				'name' => 'blaming',
629
-			], [
630
-				'id' => 89,
631
-				'name' => 'obsessive (stuck) thoughts',
632
-			],
633
-		],
634
-	],
635
-	6 => [
636
-		'category_name' => 'Exhausted',
637
-		'behaviors' => [
638
-			[
639
-				'id' => 111,
640
-				'name' => 'seeking out old unhealthy people and places',
641
-			], [
642
-				'id' => 118,
643
-				'name' => 'not returning phone calls',
644
-			],
645
-		],
646
-	],
647
-	7 => [
648
-		'category_name' => 'Relapse/Moral Failure',
649
-		'behaviors' => [
650
-			[
651
-				'id' => 122,
652
-				'name' => 'returning to the place you swore you would never go again',
653
-			],
654
-		],
655
-	],
600
+    'category_name' => 'Anxiety',
601
+    'behaviors' => [
602
+      [
603
+        'id' => 29,
604
+        'name' => 'using profanity',
605
+      ], [
606
+        'id' => 41,
607
+        'name' => 'co-dependent rescuing',
608
+      ],
609
+    ],
610
+  ],
611
+  4 => [
612
+    'category_name' => 'Speeding Up',
613
+    'behaviors' => [
614
+      [
615
+        'id' => 48,
616
+        'name' => 'workaholic',
617
+      ],
618
+    ],
619
+  ],
620
+  5 => [
621
+    'category_name' => 'Ticked Off',
622
+    'behaviors' => [
623
+      [
624
+        'id' => 72,
625
+        'name' => 'black and white, all or nothing thinking',
626
+      ], [
627
+        'id' => 79,
628
+        'name' => 'blaming',
629
+      ], [
630
+        'id' => 89,
631
+        'name' => 'obsessive (stuck) thoughts',
632
+      ],
633
+    ],
634
+  ],
635
+  6 => [
636
+    'category_name' => 'Exhausted',
637
+    'behaviors' => [
638
+      [
639
+        'id' => 111,
640
+        'name' => 'seeking out old unhealthy people and places',
641
+      ], [
642
+        'id' => 118,
643
+        'name' => 'not returning phone calls',
644
+      ],
645
+    ],
646
+  ],
647
+  7 => [
648
+    'category_name' => 'Relapse/Moral Failure',
649
+    'behaviors' => [
650
+      [
651
+        'id' => 122,
652
+        'name' => 'returning to the place you swore you would never go again',
653
+      ],
654
+    ],
655
+  ],
656 656
 ];
657 657
 
658 658
 public $exportData = [
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
     $this->container = new \yii\di\Container;
728 728
     $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser');
729 729
     $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior');
730
-    $this->container->set('common\interfaces\TimeInterface', function () {
730
+    $this->container->set('common\interfaces\TimeInterface', function() {
731 731
       return new \common\components\Time('America/Los_Angeles');
732 732
     });
733 733
 
@@ -773,21 +773,21 @@  discard block
 block discarded – undo
773 773
   }
774 774
 
775 775
   public function testParseQuestionData() {
776
-    $this->specify('parseQuestionData should function correctly', function () {
776
+    $this->specify('parseQuestionData should function correctly', function() {
777 777
       expect('parseQuestionData should return the correct structure with expected data', $this->assertEquals($this->user->parseQuestionData($this->questionData), $this->userQuestions));
778 778
       expect('parseQuestionData should return empty with the empty set', $this->assertEmpty($this->user->parseQuestionData([])));
779 779
     });
780 780
   }
781 781
 
782 782
   public function testParseBehaviorData() {
783
-    $this->specify('parseBehaviorData should function correctly', function () {
783
+    $this->specify('parseBehaviorData should function correctly', function() {
784 784
       expect('parseBehaviorData should return the correct structure with expected data', $this->assertEquals($this->user->parseBehaviorData($this->behaviorData), $this->userBehaviors));
785 785
       expect('parseBehaviorData should return empty with the empty set', $this->assertEmpty($this->user->parseBehaviorData([])));
786 786
     });
787 787
   }
788 788
 
789 789
   public function testIsTokenCurrent() {
790
-    $this->specify('isTokenCurrent should function correctly', function () {
790
+    $this->specify('isTokenCurrent should function correctly', function() {
791 791
       $good_token = \Yii::$app
792 792
                       ->getSecurity()
793 793
                       ->generateRandomString() . '_' . time();
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
   public function testConfirmVerifyEmailToken() {
822 822
     $this->user->verify_email_token = 'hello_world';
823 823
     $this->user->confirmVerifyEmailToken();
824
-    expect('confirmVerifyEmailToken should append User::CONFIRMED_STRING to the end of the verify_email_token property', $this->assertEquals($this->user->verify_email_token, 'hello_world'.$this->user::CONFIRMED_STRING));
824
+    expect('confirmVerifyEmailToken should append User::CONFIRMED_STRING to the end of the verify_email_token property', $this->assertEquals($this->user->verify_email_token, 'hello_world' . $this->user::CONFIRMED_STRING));
825 825
   }
826 826
 
827 827
   public function testIsVerified() {
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
       ->disableOriginalConstructor()
916 916
       ->setMethods(['save', 'attributes', 'getCheckinBreakdown'])
917 917
       ->getMock();
918
-    $expected = require(__DIR__.'/../data/expected_getCheckinBreakdown.php');
918
+    $expected = require(__DIR__ . '/../data/expected_getCheckinBreakdown.php');
919 919
     $user_behavior->method('getCheckinBreakdown')->willReturn($expected);
920 920
 
921 921
     $user = $this->getMockBuilder('\common\models\User')
Please login to merge, or discard this patch.
site/views/profile/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@
 block discarded – undo
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'); ?>
Please login to merge, or discard this patch.
site/models/EditProfileForm.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
site/controllers/CheckinController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
40 40
       $form->compiled_behaviors = $form->compileBehaviors();
41 41
 
42
-      if(sizeof($form->compiled_behaviors) === 0) {
42
+      if (sizeof($form->compiled_behaviors) === 0) {
43 43
         return $this->redirect(['view']);
44 44
       }
45 45
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
       return $this->redirect(['questions']);
51 51
     } else {
52
-      $behaviors  = Yii::$container->get(BehaviorInterface::class)::$behaviors;
52
+      $behaviors = Yii::$container->get(BehaviorInterface::class)::$behaviors;
53 53
       return $this->render('index', [
54 54
         'categories'    => Yii::$container->get(CategoryInterface::class)::$categories,
55 55
         'model'         => $form,
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     $date = Yii::$container->get(TimeInterface::class)->getLocalDate();
65 65
 
66 66
     $user_behaviors = $user_behavior->getUserBehaviorsWithCategory($date);
67
-    if(count($user_behaviors) === 0) {
67
+    if (count($user_behaviors) === 0) {
68 68
       return $this->redirect(['view']);
69 69
     }
70 70
 
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
       $form->deleteToday();
75 75
 
76 76
       $behaviors = $user_behavior->findAll($form->getUserBehaviorIds());
77
-      if($result = $form->saveAnswers($behaviors)) {
77
+      if ($result = $form->saveAnswers($behaviors)) {
78 78
 
79
-        if(Yii::$app->user->identity->send_email) {
80
-          if(Yii::$app->user->identity->sendEmailReport($date)) {
79
+        if (Yii::$app->user->identity->send_email) {
80
+          if (Yii::$app->user->identity->sendEmailReport($date)) {
81 81
             Yii::$app->session->setFlash('success', 'Your check-in is complete. A notification has been sent to your report partners.');
82 82
           } else {
83 83
             Yii::$app->session->setFlash('success', 'Your check-in is complete.');
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     $raw_pie_data  = $user_behavior::decorateWithCategory($user_behavior->getBehaviorsWithCounts());
132 132
     $answer_pie    = $user_behavior->getBehaviorsByCategory($raw_pie_data);
133 133
 
134
-    $pie_data   = [
134
+    $pie_data = [
135 135
       "labels"   => array_column($answer_pie, "name"),
136 136
       "datasets" => [[
137 137
           "data"                 => array_map('intval', array_column($answer_pie, "count")),
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
     $checkins = $user_behavior->getCheckInBreakdown($period);
167 167
 
168 168
     $accum = [];
169
-    foreach($checkins as $date => $cats) {
170
-      for($i = 1; $i <= 7; $i ++) {
169
+    foreach ($checkins as $date => $cats) {
170
+      for ($i = 1; $i <= 7; $i++) {
171 171
         $accum[$i][] = array_key_exists($i, $cats) ? $cats[$i]['count'] : [];
172 172
       }
173 173
     }
174 174
 
175 175
     $bar_datasets = [];
176
-    foreach($accum as $idx => $data) {
176
+    foreach ($accum as $idx => $data) {
177 177
       $bar_datasets[] = [
178 178
         'label' => ($category::getCategories())[$idx],
179 179
         'backgroundColor' => $category::$colors[$idx]['color'],
Please login to merge, or discard this patch.
site/models/SignupForm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.