Completed
Pull Request — master (#178)
by Corey
02:50
created
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/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.
site/assets/assets.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
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'];
Please login to merge, or discard this patch.
site/tests/unit/models/QuestionFormTest.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
site/views/checkin/report.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
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
   ?>
Please login to merge, or discard this patch.
site/controllers/ProfileController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             'allow'   => true,
28 28
             'roles'   => ['@'],
29 29
           ], [
30
-            'actions' => [ 'change-email', ],
30
+            'actions' => ['change-email', ],
31 31
             'allow'   => true,
32 32
           ],
33 33
         ],
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     if ($editProfileForm->load(Yii::$app->request->post())) {
59 59
       $saved_user = $editProfileForm->saveProfile();
60
-      if($saved_user) {
60
+      if ($saved_user) {
61 61
         Yii::$app->session->setFlash('success', 'New profile data saved!');
62 62
       }
63 63
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     $model = Yii::$container->get(\site\models\DeleteAccountForm::class, [Yii::$app->user->identity]);
77 77
 
78 78
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
79
-      if($model->deleteAccount()) {
79
+      if ($model->deleteAccount()) {
80 80
         $this->redirect(['site/index']);
81 81
       } else {
82 82
         Yii::$app->session->setFlash('error', 'Wrong password!');
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     $model = Yii::$container->get(\site\models\ChangePasswordForm::class, [Yii::$app->user->identity]);
91 91
 
92 92
     if ($model->load(Yii::$app->request->post())) {
93
-      if($model->validate() && $model->changePassword()) {
93
+      if ($model->validate() && $model->changePassword()) {
94 94
         Yii::$app->session->setFlash('success', 'Password successfully changed');
95 95
       } else {
96 96
         Yii::$app->session->setFlash('error', 'Wrong password!');
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
   public function actionChangeEmail(string $token) {
115 115
     $user = Yii::$container->get(\common\interfaces\UserInterface::class)->findByChangeEmailToken($token);
116 116
 
117
-    if($user) {
117
+    if ($user) {
118 118
       $validator = new \yii\validators\EmailValidator();
119
-      if($validator->validate($user->desired_email, $error)) {
119
+      if ($validator->validate($user->desired_email, $error)) {
120 120
         $user->removeChangeEmailToken();
121 121
         $user->email = $user->desired_email;
122 122
         $user->desired_email = null;
123 123
         $user->save();
124
-        if(!Yii::$app->user->isGuest) {
124
+        if (!Yii::$app->user->isGuest) {
125 125
           Yii::$app->user->logout();
126 126
           Yii::$app->session->setFlash('success', 'Your email address was successfully changed. For security, we\'ve logged you out.');
127 127
         } else {
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
   public function actionExport() {
143 143
     header("Content-Type: text/csv");
144
-    header("Content-Disposition: attachment; filename=fsa-data-export-".Yii::$app->user->identity->email."-".date('Ymd').".csv");
144
+    header("Content-Disposition: attachment; filename=fsa-data-export-" . Yii::$app->user->identity->email . "-" . date('Ymd') . ".csv");
145 145
 
146 146
     $reader = Yii::$app->user->identity->getExportData();
147 147
     $fp = fopen('php://output', 'w');
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
     fputcsv($fp, $header);
159 159
     $user_behavior = Yii::$container->get(\common\interfaces\UserBehaviorInterface::class);
160
-    while($row = $reader->read()) {
160
+    while ($row = $reader->read()) {
161 161
       $row = $user_behavior::decorate([$row]);
162 162
       $row = Yii::$app->user->identity->cleanExportData($row);
163 163
       fputcsv($fp, $row[0]);
Please login to merge, or discard this patch.
common/tests/unit/models/UserTest.php 2 patches
Indentation   +379 added lines, -379 removed lines patch added patch discarded remove patch
@@ -19,387 +19,387 @@
 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 $exportData = [
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     $this->container = new \yii\di\Container;
471 471
     $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser');
472 472
     $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior');
473
-    $this->container->set('common\interfaces\TimeInterface', function () {
473
+    $this->container->set('common\interfaces\TimeInterface', function() {
474 474
       return new \common\components\Time('America/Los_Angeles');
475 475
     });
476 476
 
@@ -516,14 +516,14 @@  discard block
 block discarded – undo
516 516
   }
517 517
 
518 518
   public function testParseQuestionData() {
519
-    $this->specify('parseQuestionData should function correctly', function () {
519
+    $this->specify('parseQuestionData should function correctly', function() {
520 520
       expect('parseQuestionData should return the correct structure with expected data', $this->assertEquals($this->user->parseQuestionData($this->questionData), $this->userQuestions));
521 521
       expect('parseQuestionData should return empty with the empty set', $this->assertEmpty($this->user->parseQuestionData([])));
522 522
     });
523 523
   }
524 524
 
525 525
   public function testIsTokenCurrent() {
526
-    $this->specify('isTokenCurrent should function correctly', function () {
526
+    $this->specify('isTokenCurrent should function correctly', function() {
527 527
       $good_token = \Yii::$app
528 528
                       ->getSecurity()
529 529
                       ->generateRandomString() . '_' . time();
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
   public function testConfirmVerifyEmailToken() {
558 558
     $this->user->verify_email_token = 'hello_world';
559 559
     $this->user->confirmVerifyEmailToken();
560
-    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));
560
+    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));
561 561
   }
562 562
 
563 563
   public function testIsVerified() {
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
       ->disableOriginalConstructor()
652 652
       ->setMethods(['save', 'attributes', 'getCheckinBreakdown'])
653 653
       ->getMock();
654
-    $expected = require(__DIR__.'/../data/expected_getCheckinBreakdown.php');
654
+    $expected = require(__DIR__ . '/../data/expected_getCheckinBreakdown.php');
655 655
     $user_behavior->method('getCheckinBreakdown')->willReturn($expected);
656 656
 
657 657
     $user = $this->getMockBuilder('\common\models\User')
Please login to merge, or discard this patch.
common/tests/unit/models/UserBehaviorTest.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -449,6 +449,6 @@
 block discarded – undo
449 449
     $bhvrs = require(__DIR__.'/../data/behaviorsWithCounts.php');
450 450
     $expected = require(__DIR__.'/../data/expected_getCheckinBreakdown.php');
451 451
     $this->user_behavior->method('getBehaviorsWithCounts')->willReturn(...$bhvrs);
452
-		expect('asdf', $this->assertEquals($expected, $this->user_behavior->getCheckinBreakdown()));
452
+    expect('asdf', $this->assertEquals($expected, $this->user_behavior->getCheckinBreakdown()));
453 453
   }
454 454
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 
288 288
   public function setUp() {
289 289
     // pull in test data
290
-    $data = require(__DIR__.'/../data/checkinData.php');
290
+    $data = require(__DIR__ . '/../data/checkinData.php');
291 291
     $this->singleBhvr = $data['singleBhvr'];
292 292
     $this->manyBhvrs = $data['manyBhvrs'];
293 293
     $this->allBhvrs = $data['allBhvrs'];
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser');
298 298
     $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion');
299 299
     $this->container->set('common\interfaces\BehaviorInterface', 'common\models\Behavior');
300
-    $this->container->set('common\interfaces\TimeInterface', function () {
300
+    $this->container->set('common\interfaces\TimeInterface', function() {
301 301
         return new \common\components\Time('America/Los_Angeles');
302 302
       });
303 303
 
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
                             ->setMethods(['getIsNewRecord', 'save', 'getBehaviorsWithCounts'])
447 447
                             ->getMock();
448 448
 
449
-    $bhvrs = require(__DIR__.'/../data/behaviorsWithCounts.php');
450
-    $expected = require(__DIR__.'/../data/expected_getCheckinBreakdown.php');
449
+    $bhvrs = require(__DIR__ . '/../data/behaviorsWithCounts.php');
450
+    $expected = require(__DIR__ . '/../data/expected_getCheckinBreakdown.php');
451 451
     $this->user_behavior->method('getBehaviorsWithCounts')->willReturn(...$bhvrs);
452 452
 		expect('asdf', $this->assertEquals($expected, $this->user_behavior->getCheckinBreakdown()));
453 453
   }
Please login to merge, or discard this patch.
migrations/m190829_141748_alter_user_behavior_link_add_category_id.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,20 +22,20 @@
 block discarded – undo
22 22
 
23 23
       // then populate the columns
24 24
       $query = (new Query())->from('user_behavior_link');
25
-      foreach($query->batch() as $rows) {
26
-        foreach($rows as $row) {
25
+      foreach ($query->batch() as $rows) {
26
+        foreach ($rows as $row) {
27 27
           $bhvr = Behavior::getBehavior('id', $row['behavior_id']);
28
-          if($bhvr) {
28
+          if ($bhvr) {
29 29
             $this->update('{{%user_behavior_link}}', ['category_id' => $bhvr['category_id']], ['id' => $row['id']]);
30 30
           }
31 31
         }
32 32
       }
33 33
 
34 34
       $query = (new Query())->from('question');
35
-      foreach($query->batch() as $rows) {
36
-        foreach($rows as $row) {
35
+      foreach ($query->batch() as $rows) {
36
+        foreach ($rows as $row) {
37 37
           $bhvr = Behavior::getBehavior('id', $row['behavior_id']);
38
-          if($bhvr) {
38
+          if ($bhvr) {
39 39
             $this->update('{{%question}}', ['category_id' => $bhvr['category_id']], ['id' => $row['id']]);
40 40
           }
41 41
         }
Please login to merge, or discard this patch.