@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\UnitTesterActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | require_once(YII_APP_BASE_PATH . '/vendor/autoload.php'); |
8 | 8 | require_once(YII_APP_BASE_PATH . '/vendor/yiisoft/yii2/Yii.php'); |
9 | 9 | |
10 | - Yii::setAlias('@web', '/'); |
|
10 | + Yii::setAlias('@web', '/'); |
|
11 | 11 | |
12 | 12 | require(YII_APP_BASE_PATH . '/common/config/aliases.php'); |
13 | 13 | Yii::setAlias('@tests', dirname(__DIR__)); |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | <th style="Margin:0;color:#0a0a0a;font-family:Lato,Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left"> |
126 | 126 | |
127 | 127 | <?php |
128 | -if($questions) { |
|
129 | - foreach($questions as $behavior_id => $behavior_questions) { |
|
128 | +if ($questions) { |
|
129 | + foreach ($questions as $behavior_id => $behavior_questions) { |
|
130 | 130 | ?> |
131 | 131 | |
132 | 132 | <h4 style="Margin:0;Margin-bottom:10px;color:#37b98f;font-family:Lato,Helvetica,Arial,sans-serif;font-size:24px;font-weight:400;line-height:1.3;margin:0;margin-bottom:5px;padding:0 8px;text-align:left;word-wrap:normal"> <?= $behavior_questions['question']['title'] ?> </h4> |
133 | 133 | |
134 | 134 | <?php |
135 | - foreach($behavior_questions['answers'] as $key => $question) { ?> |
|
135 | + foreach ($behavior_questions['answers'] as $key => $question) { ?> |
|
136 | 136 | <p style="Margin:0;Margin-bottom:10px;color:#0a0a0a;font-family:Lato,Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;margin-bottom:10px;padding:0 8px 4px 8px;text-align:left"><strong><?=$question['title']?></strong> <?=$question['answer']?></p> |
137 | 137 | <?php |
138 | 138 | } |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | <th style="Margin:0;color:#0a0a0a;font-family:Lato,Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left"> |
190 | 190 | |
191 | 191 | <?php |
192 | -if($user_behaviors) { |
|
193 | - foreach($user_behaviors as $user_behavior) { ?> |
|
192 | +if ($user_behaviors) { |
|
193 | + foreach ($user_behaviors as $user_behavior) { ?> |
|
194 | 194 | <p style="Margin:0;Margin-bottom:10px;color:#0a0a0a;font-family:Lato,Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;margin-bottom:10px;padding:0 8px 4px 8px;text-align:left"> |
195 | 195 | <strong style="color:#37b98f"><?= $user_behavior['category_name'] ?></strong> |
196 | 196 | <?php |
197 | - foreach($user_behavior['behaviors'] as $behavior) { ?> |
|
197 | + foreach ($user_behavior['behaviors'] as $behavior) { ?> |
|
198 | 198 | <br><?= $behavior['name'] ?> |
199 | 199 | <?php |
200 | 200 | } |
@@ -561,28 +561,28 @@ |
||
561 | 561 | } |
562 | 562 | |
563 | 563 | public function cleanExportData($data) { |
564 | - $order = array_flip(["date", "behavior", "category", "question1", "question2", "question3"]); |
|
564 | + $order = array_flip(["date", "behavior", "category", "question1", "question2", "question3"]); |
|
565 | 565 | |
566 | - $ret = array_map( |
|
567 | - function($row) use ($order) { |
|
568 | - // change timestamp to local time (for the user) |
|
569 | - $row['date'] = $this->time->convertUTCToLocal($row['date'], false); |
|
566 | + $ret = array_map( |
|
567 | + function($row) use ($order) { |
|
568 | + // change timestamp to local time (for the user) |
|
569 | + $row['date'] = $this->time->convertUTCToLocal($row['date'], false); |
|
570 | 570 | |
571 | - // clean up things we don't need |
|
572 | - $row['category'] = $row['behavior']['category']['name']; |
|
573 | - $row['behavior'] = $row['behavior']['name']; |
|
574 | - unset($row['id']); |
|
575 | - unset($row['behavior_id']); |
|
576 | - |
|
577 | - // sort the array into a sensible order |
|
578 | - uksort($row, function($a, $b) use ($order) { |
|
571 | + // clean up things we don't need |
|
572 | + $row['category'] = $row['behavior']['category']['name']; |
|
573 | + $row['behavior'] = $row['behavior']['name']; |
|
574 | + unset($row['id']); |
|
575 | + unset($row['behavior_id']); |
|
576 | + |
|
577 | + // sort the array into a sensible order |
|
578 | + uksort($row, function($a, $b) use ($order) { |
|
579 | 579 | return $order[$a] <=> $order[$b]; |
580 | - }); |
|
581 | - return $row; |
|
582 | - }, |
|
583 | - $data |
|
584 | - ); |
|
585 | - return $ret; |
|
580 | + }); |
|
581 | + return $row; |
|
582 | + }, |
|
583 | + $data |
|
584 | + ); |
|
585 | + return $ret; |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | /* |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function findByPasswordResetToken($token) |
143 | 143 | { |
144 | - if(!$this->isTokenCurrent($token)) { |
|
144 | + if (!$this->isTokenCurrent($token)) { |
|
145 | 145 | return null; |
146 | 146 | } |
147 | 147 | |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function findByVerifyEmailToken($token) |
161 | 161 | { |
162 | - if($this->isTokenConfirmed($token)) return null; |
|
162 | + if ($this->isTokenConfirmed($token)) return null; |
|
163 | 163 | |
164 | 164 | $user = $this->findOne([ |
165 | 165 | 'verify_email_token' => [$token, $token . self::CONFIRMED_STRING], |
166 | 166 | 'status' => self::STATUS_ACTIVE, |
167 | 167 | ]); |
168 | 168 | |
169 | - if($user) { |
|
170 | - if(!$this->isTokenConfirmed($token) && |
|
169 | + if ($user) { |
|
170 | + if (!$this->isTokenConfirmed($token) && |
|
171 | 171 | !$this->isTokenCurrent($token, 'user.verifyAccountTokenExpire')) { |
172 | 172 | return null; |
173 | 173 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | public function isTokenCurrent($token, String $paramPath = 'user.passwordResetTokenExpire') { |
187 | 187 | $expire = \Yii::$app->params[$paramPath]; |
188 | 188 | $parts = explode('_', $token); |
189 | - $timestamp = (int) end($parts); |
|
189 | + $timestamp = (int)end($parts); |
|
190 | 190 | if ($timestamp + $expire < time()) { |
191 | 191 | // token expired |
192 | 192 | return false; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param string $match the needle to search for |
202 | 202 | */ |
203 | 203 | public function isTokenConfirmed($token = null, String $match = self::CONFIRMED_STRING) { |
204 | - if(is_null($token)) $token = $this->verify_email_token; |
|
204 | + if (is_null($token)) $token = $this->verify_email_token; |
|
205 | 205 | return substr($token, -strlen($match)) === $match; |
206 | 206 | } |
207 | 207 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | public function isVerified() { |
229 | - if(is_null($this->verify_email_token)) { |
|
229 | + if (is_null($this->verify_email_token)) { |
|
230 | 230 | // for old users who verified their accounts before the addition of |
231 | 231 | // '_confirmed' to the token |
232 | 232 | return true; |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | } |
321 | 321 | |
322 | 322 | public function sendEmailReport($date) { |
323 | - if(!$this->send_email) return false; // no partner emails set |
|
323 | + if (!$this->send_email) return false; // no partner emails set |
|
324 | 324 | list($start, $end) = $this->time->getUTCBookends($date); |
325 | - $user_behaviors = $this->getUserBehaviors($date); |
|
325 | + $user_behaviors = $this->getUserBehaviors($date); |
|
326 | 326 | $user_questions = $this->getUserQuestions($date); |
327 | 327 | |
328 | 328 | $messages = []; |
329 | - foreach($this->getPartnerEmails() as $email) { |
|
330 | - if($email) { |
|
329 | + foreach ($this->getPartnerEmails() as $email) { |
|
330 | + if ($email) { |
|
331 | 331 | $messages[] = Yii::$app->mailer->compose('checkinReport', [ |
332 | 332 | 'user' => $this, |
333 | 333 | 'email' => $email, |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | 'behaviors_list' => \common\models\Behavior::$behaviors, |
340 | 340 | ])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name]) |
341 | 341 | ->setReplyTo($this->email) |
342 | - ->setSubject($this->email." has completed a Faster Scale check-in") |
|
342 | + ->setSubject($this->email . " has completed a Faster Scale check-in") |
|
343 | 343 | ->setTo($email); |
344 | 344 | } |
345 | 345 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | return \Yii::$app->mailer->compose('signupNotification') |
413 | 413 | ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name]) |
414 | 414 | ->setTo(\Yii::$app->params['adminEmail']) |
415 | - ->setSubject('A new user has signed up for '.\Yii::$app->name) |
|
415 | + ->setSubject('A new user has signed up for ' . \Yii::$app->name) |
|
416 | 416 | ->send(); |
417 | 417 | } |
418 | 418 | |
@@ -420,22 +420,22 @@ discard block |
||
420 | 420 | return \Yii::$app->mailer->compose('verifyEmail', ['user' => $this]) |
421 | 421 | ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name]) |
422 | 422 | ->setTo($this->email) |
423 | - ->setSubject('Please verify your '.\Yii::$app->name .' account') |
|
423 | + ->setSubject('Please verify your ' . \Yii::$app->name . ' account') |
|
424 | 424 | ->send(); |
425 | 425 | } |
426 | 426 | |
427 | 427 | public function sendDeleteNotificationEmail() { |
428 | - if($this->send_email) return false; // no partner emails set |
|
428 | + if ($this->send_email) return false; // no partner emails set |
|
429 | 429 | |
430 | 430 | $messages = []; |
431 | - foreach(array_merge([$this->email], $this->getPartnerEmails()) as $email) { |
|
432 | - if($email) { |
|
431 | + foreach (array_merge([$this->email], $this->getPartnerEmails()) as $email) { |
|
432 | + if ($email) { |
|
433 | 433 | $messages[] = Yii::$app->mailer->compose('partnerDeleteNotification', [ |
434 | 434 | 'user' => $this, |
435 | 435 | 'email' => $email |
436 | 436 | ])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name]) |
437 | 437 | ->setReplyTo($this->email) |
438 | - ->setSubject($this->email." has deleted their The Faster Scale App account") |
|
438 | + ->setSubject($this->email . " has deleted their The Faster Scale App account") |
|
439 | 439 | ->setTo($email); |
440 | 440 | } |
441 | 441 | } |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | } |
445 | 445 | |
446 | 446 | public function getUserQuestions($local_date = null) { |
447 | - if(is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
447 | + if (is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
448 | 448 | $questions = $this->getQuestionData($local_date); |
449 | 449 | return $this->parseQuestionData($questions); |
450 | 450 | } |
451 | 451 | |
452 | 452 | public function getUserBehaviors($local_date = null) { |
453 | - if(is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
453 | + if (is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
454 | 454 | |
455 | 455 | $behaviors = $this->getBehaviorData($local_date); |
456 | 456 | $behaviors = $this->user_behavior::decorateWithCategory($behaviors); |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | public function parseQuestionData($questions) { |
461 | - if(!$questions) return []; |
|
461 | + if (!$questions) return []; |
|
462 | 462 | |
463 | 463 | $question_answers = []; |
464 | - foreach($questions as $question) { |
|
464 | + foreach ($questions as $question) { |
|
465 | 465 | $behavior = $question['behavior']; |
466 | 466 | |
467 | 467 | $question_answers[$behavior['id']]['question'] = [ |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | } |
480 | 480 | |
481 | 481 | public function parseBehaviorData($behaviors) { |
482 | - if(!$behaviors) return []; |
|
482 | + if (!$behaviors) return []; |
|
483 | 483 | |
484 | 484 | $opts_by_cat = []; |
485 | - foreach($behaviors as $behavior) { |
|
485 | + foreach ($behaviors as $behavior) { |
|
486 | 486 | $indx = $behavior['behavior']['category_id']; |
487 | 487 | |
488 | 488 | $opts_by_cat[$indx]['category_name'] = $behavior['behavior']['category']['name']; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | return rtrim( |
575 | 575 | strtr( |
576 | 576 | base64_encode( |
577 | - hash('sha256', $this->id."::".$this->created_at, true) |
|
577 | + hash('sha256', $this->id . "::" . $this->created_at, true) |
|
578 | 578 | ), |
579 | 579 | '+/', '-_'), |
580 | 580 | '='); |
@@ -159,7 +159,9 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function findByVerifyEmailToken($token) |
161 | 161 | { |
162 | - if($this->isTokenConfirmed($token)) return null; |
|
162 | + if($this->isTokenConfirmed($token)) { |
|
163 | + return null; |
|
164 | + } |
|
163 | 165 | |
164 | 166 | $user = $this->findOne([ |
165 | 167 | 'verify_email_token' => [$token, $token . self::CONFIRMED_STRING], |
@@ -201,7 +203,9 @@ discard block |
||
201 | 203 | * @param string $match the needle to search for |
202 | 204 | */ |
203 | 205 | public function isTokenConfirmed($token = null, String $match = self::CONFIRMED_STRING) { |
204 | - if(is_null($token)) $token = $this->verify_email_token; |
|
206 | + if(is_null($token)) { |
|
207 | + $token = $this->verify_email_token; |
|
208 | + } |
|
205 | 209 | return substr($token, -strlen($match)) === $match; |
206 | 210 | } |
207 | 211 | |
@@ -320,7 +324,10 @@ discard block |
||
320 | 324 | } |
321 | 325 | |
322 | 326 | public function sendEmailReport($date) { |
323 | - if(!$this->send_email) return false; // no partner emails set |
|
327 | + if(!$this->send_email) { |
|
328 | + return false; |
|
329 | + } |
|
330 | + // no partner emails set |
|
324 | 331 | list($start, $end) = $this->time->getUTCBookends($date); |
325 | 332 | $user_behaviors = $this->getUserBehaviors($date); |
326 | 333 | $user_questions = $this->getUserQuestions($date); |
@@ -425,7 +432,10 @@ discard block |
||
425 | 432 | } |
426 | 433 | |
427 | 434 | public function sendDeleteNotificationEmail() { |
428 | - if($this->send_email) return false; // no partner emails set |
|
435 | + if($this->send_email) { |
|
436 | + return false; |
|
437 | + } |
|
438 | + // no partner emails set |
|
429 | 439 | |
430 | 440 | $messages = []; |
431 | 441 | foreach(array_merge([$this->email], $this->getPartnerEmails()) as $email) { |
@@ -444,13 +454,17 @@ discard block |
||
444 | 454 | } |
445 | 455 | |
446 | 456 | public function getUserQuestions($local_date = null) { |
447 | - if(is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
457 | + if(is_null($local_date)) { |
|
458 | + $local_date = $this->time->getLocalDate(); |
|
459 | + } |
|
448 | 460 | $questions = $this->getQuestionData($local_date); |
449 | 461 | return $this->parseQuestionData($questions); |
450 | 462 | } |
451 | 463 | |
452 | 464 | public function getUserBehaviors($local_date = null) { |
453 | - if(is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
465 | + if(is_null($local_date)) { |
|
466 | + $local_date = $this->time->getLocalDate(); |
|
467 | + } |
|
454 | 468 | |
455 | 469 | $behaviors = $this->getBehaviorData($local_date); |
456 | 470 | $behaviors = $this->user_behavior::decorateWithCategory($behaviors); |
@@ -458,7 +472,9 @@ discard block |
||
458 | 472 | } |
459 | 473 | |
460 | 474 | public function parseQuestionData($questions) { |
461 | - if(!$questions) return []; |
|
475 | + if(!$questions) { |
|
476 | + return []; |
|
477 | + } |
|
462 | 478 | |
463 | 479 | $question_answers = []; |
464 | 480 | foreach($questions as $question) { |
@@ -479,7 +495,9 @@ discard block |
||
479 | 495 | } |
480 | 496 | |
481 | 497 | public function parseBehaviorData($behaviors) { |
482 | - if(!$behaviors) return []; |
|
498 | + if(!$behaviors) { |
|
499 | + return []; |
|
500 | + } |
|
483 | 501 | |
484 | 502 | $opts_by_cat = []; |
485 | 503 | foreach($behaviors as $behavior) { |
@@ -60,10 +60,10 @@ |
||
60 | 60 | */ |
61 | 61 | public function login() |
62 | 62 | { |
63 | - if($this->validate()) { |
|
63 | + if ($this->validate()) { |
|
64 | 64 | $user = $this->getUser(); |
65 | - if($user->isVerified()) { |
|
66 | - return Yii::$app->user->login($user, $this->rememberMe ? 3600 * 24 * 30 : 0); |
|
65 | + if ($user->isVerified()) { |
|
66 | + return Yii::$app->user->login($user, $this->rememberMe ? 3600*24*30 : 0); |
|
67 | 67 | } else { |
68 | 68 | Yii::$app->getSession()->setFlash('warning', 'You must verify your account before you can proceed. Please check your email inbox for a verification email and follow the instructions.'); |
69 | 69 | } |
@@ -13,138 +13,138 @@ |
||
13 | 13 | */ |
14 | 14 | class Behavior extends \yii\base\BaseObject implements BehaviorInterface |
15 | 15 | { |
16 | - public static $behaviors = [ |
|
17 | - ['id' => 1, 'name' => 'no current secrets', 'category_id' => 1], |
|
18 | - ['id' => 2, 'name' => 'resolving problems', 'category_id' => 1], |
|
19 | - ['id' => 3, 'name' => 'identifying fears and feelings', 'category_id' => 1], |
|
20 | - ['id' => 4, 'name' => 'keeping commitments to meetings, prayer, family, church, people, goals, and self', 'category_id' => 1], |
|
21 | - ['id' => 5, 'name' => 'being open', 'category_id' => 1], |
|
22 | - ['id' => 6, 'name' => 'being honest', 'category_id' => 1], |
|
23 | - ['id' => 7, 'name' => 'making eye contact', 'category_id' => 1], |
|
24 | - ['id' => 8, 'name' => 'reaching out to others', 'category_id' => 1], |
|
25 | - ['id' => 9, 'name' => 'increasing in relationships with God and others', 'category_id' => 1], |
|
26 | - ['id' => 10, 'name' => 'accountability', 'category_id' => 1], |
|
27 | - ['id' => 11, 'name' => 'secrets', 'category_id' => 2], |
|
28 | - ['id' => 12, 'name' => 'bored', 'category_id' => 2], |
|
29 | - ['id' => 13, 'name' => 'less time/energy for God, meetings, and church', 'category_id' => 2], |
|
30 | - ['id' => 14, 'name' => 'avoiding support and accountability towards people', 'category_id' => 2], |
|
31 | - ['id' => 15, 'name' => 'superficial conversations', 'category_id' => 2], |
|
32 | - ['id' => 16, 'name' => 'sarcasm', 'category_id' => 2], |
|
33 | - ['id' => 17, 'name' => 'isolating yourself', 'category_id' => 2], |
|
34 | - ['id' => 18, 'name' => 'changes in goals', 'category_id' => 2], |
|
35 | - ['id' => 19, 'name' => 'flirting', 'category_id' => 2], |
|
36 | - ['id' => 20, 'name' => 'obsessed with relationships', 'category_id' => 2], |
|
37 | - ['id' => 21, 'name' => 'breaking promises/commitments', 'category_id' => 2], |
|
38 | - ['id' => 22, 'name' => 'neglecting family', 'category_id' => 2], |
|
39 | - ['id' => 23, 'name' => 'preoccupation with material things, television, or entertainment', 'category_id' => 2], |
|
40 | - ['id' => 24, 'name' => 'procrastination', 'category_id' => 2], |
|
41 | - ['id' => 25, 'name' => 'lying', 'category_id' => 2], |
|
42 | - ['id' => 26, 'name' => 'over-confidence', 'category_id' => 2], |
|
43 | - ['id' => 27, 'name' => 'hiding money', 'category_id' => 2], |
|
44 | - ['id' => 28, 'name' => 'worry', 'category_id' => 3], |
|
45 | - ['id' => 29, 'name' => 'using profanity', 'category_id' => 3], |
|
46 | - ['id' => 30, 'name' => 'being fearful', 'category_id' => 3], |
|
47 | - ['id' => 31, 'name' => 'being resentful', 'category_id' => 3], |
|
48 | - ['id' => 32, 'name' => 'replaying old, negative thoughts', 'category_id' => 3], |
|
49 | - ['id' => 33, 'name' => 'perfectionism', 'category_id' => 3], |
|
50 | - ['id' => 34, 'name' => 'judging others\' motives', 'category_id' => 3], |
|
51 | - ['id' => 35, 'name' => 'making goals and lists you can\'t complete', 'category_id' => 3], |
|
52 | - ['id' => 36, 'name' => 'poor planning', 'category_id' => 3], |
|
53 | - ['id' => 37, 'name' => 'mind reading', 'category_id' => 3], |
|
54 | - ['id' => 38, 'name' => 'fantasy', 'category_id' => 3], |
|
55 | - ['id' => 41, 'name' => 'co-dependent rescuing', 'category_id' => 3], |
|
56 | - ['id' => 42, 'name' => 'sleep problems', 'category_id' => 3], |
|
57 | - ['id' => 43, 'name' => 'trouble concentrating', 'category_id' => 3], |
|
58 | - ['id' => 44, 'name' => 'seeking/creating drama', 'category_id' => 3], |
|
59 | - ['id' => 45, 'name' => 'gossip', 'category_id' => 3], |
|
60 | - ['id' => 46, 'name' => 'using over-the-counter medication for pain, sleep, and weight control', 'category_id' => 3], |
|
61 | - ['id' => 47, 'name' => 'super busy', 'category_id' => 4], |
|
62 | - ['id' => 48, 'name' => 'workaholic', 'category_id' => 4], |
|
63 | - ['id' => 49, 'name' => 'can\'t relax', 'category_id' => 4], |
|
64 | - ['id' => 50, 'name' => 'driving too fast', 'category_id' => 4], |
|
65 | - ['id' => 51, 'name' => 'avoiding slowing down', 'category_id' => 4], |
|
66 | - ['id' => 52, 'name' => 'feeling driven', 'category_id' => 4], |
|
67 | - ['id' => 53, 'name' => 'in a hurry', 'category_id' => 4], |
|
68 | - ['id' => 54, 'name' => 'can\'t turn off thoughts', 'category_id' => 4], |
|
69 | - ['id' => 55, 'name' => 'skipping meals', 'category_id' => 4], |
|
70 | - ['id' => 56, 'name' => 'binge eating (usually at night)', 'category_id' => 4], |
|
71 | - ['id' => 57, 'name' => 'overspending', 'category_id' => 4], |
|
72 | - ['id' => 58, 'name' => 'can\'t identify own feelings/needs', 'category_id' => 4], |
|
73 | - ['id' => 59, 'name' => 'repetitive, negative thoughts', 'category_id' => 4], |
|
74 | - ['id' => 60, 'name' => 'irritable', 'category_id' => 4], |
|
75 | - ['id' => 61, 'name' => 'making excuses for "having to do it all"', 'category_id' => 4], |
|
76 | - ['id' => 62, 'name' => 'dramatic mood swings', 'category_id' => 4], |
|
77 | - ['id' => 63, 'name' => 'lust', 'category_id' => 4], |
|
78 | - ['id' => 64, 'name' => 'too much caffeine', 'category_id' => 4], |
|
79 | - ['id' => 65, 'name' => 'over exercising', 'category_id' => 4], |
|
80 | - ['id' => 66, 'name' => 'nervousness', 'category_id' => 4], |
|
81 | - ['id' => 67, 'name' => 'difficulty being alone or with people', 'category_id' => 4], |
|
82 | - ['id' => 68, 'name' => 'difficulty listening to others', 'category_id' => 4], |
|
83 | - ['id' => 69, 'name' => 'avoiding support', 'category_id' => 4], |
|
84 | - ['id' => 70, 'name' => 'procrastination causing crises in money, work, or relationships', 'category_id' => 5], |
|
85 | - ['id' => 71, 'name' => 'sarcasm', 'category_id' => 5], |
|
86 | - ['id' => 72, 'name' => 'black and white, all or nothing thinking', 'category_id' => 5], |
|
87 | - ['id' => 73, 'name' => 'feeling that no one understands', 'category_id' => 5], |
|
88 | - ['id' => 74, 'name' => 'overreacting', 'category_id' => 5], |
|
89 | - ['id' => 75, 'name' => 'road rage', 'category_id' => 5], |
|
90 | - ['id' => 76, 'name' => 'constant resentments', 'category_id' => 5], |
|
91 | - ['id' => 77, 'name' => 'pushing others away', 'category_id' => 5], |
|
92 | - ['id' => 78, 'name' => 'increased isolation', 'category_id' => 5], |
|
93 | - ['id' => 79, 'name' => 'blaming', 'category_id' => 5], |
|
94 | - ['id' => 80, 'name' => 'self pity', 'category_id' => 5], |
|
95 | - ['id' => 81, 'name' => 'arguing', 'category_id' => 5], |
|
96 | - ['id' => 82, 'name' => 'irrationality', 'category_id' => 5], |
|
97 | - ['id' => 83, 'name' => 'can\'t handle criticism', 'category_id' => 5], |
|
98 | - ['id' => 84, 'name' => 'defensive', 'category_id' => 5], |
|
99 | - ['id' => 85, 'name' => 'people are avoiding you', 'category_id' => 5], |
|
100 | - ['id' => 86, 'name' => 'having to be right', 'category_id' => 5], |
|
101 | - ['id' => 87, 'name' => 'digestive problems', 'category_id' => 5], |
|
102 | - ['id' => 88, 'name' => 'headaches', 'category_id' => 5], |
|
103 | - ['id' => 89, 'name' => 'obsessive (stuck) thoughts', 'category_id' => 5], |
|
104 | - ['id' => 90, 'name' => 'can\'t forgive', 'category_id' => 5], |
|
105 | - ['id' => 91, 'name' => 'feeling grandiose (superior)', 'category_id' => 5], |
|
106 | - ['id' => 92, 'name' => 'intimidation', 'category_id' => 5], |
|
107 | - ['id' => 93, 'name' => 'feeling aggressive', 'category_id' => 5], |
|
108 | - ['id' => 94, 'name' => 'depressed', 'category_id' => 6], |
|
109 | - ['id' => 95, 'name' => 'panicked', 'category_id' => 6], |
|
110 | - ['id' => 96, 'name' => 'confused', 'category_id' => 6], |
|
111 | - ['id' => 97, 'name' => 'hopeless', 'category_id' => 6], |
|
112 | - ['id' => 98, 'name' => 'sleeping too much or too little', 'category_id' => 6], |
|
113 | - ['id' => 99, 'name' => 'can\'t cope', 'category_id' => 6], |
|
114 | - ['id' => 100, 'name' => 'overwhelmed', 'category_id' => 6], |
|
115 | - ['id' => 101, 'name' => 'crying for "no reason"', 'category_id' => 6], |
|
116 | - ['id' => 102, 'name' => 'can\'t think', 'category_id' => 6], |
|
117 | - ['id' => 103, 'name' => 'forgetful', 'category_id' => 6], |
|
118 | - ['id' => 104, 'name' => 'pessimistic', 'category_id' => 6], |
|
119 | - ['id' => 105, 'name' => 'helpless', 'category_id' => 6], |
|
120 | - ['id' => 106, 'name' => 'tired', 'category_id' => 6], |
|
121 | - ['id' => 107, 'name' => 'numb', 'category_id' => 6], |
|
122 | - ['id' => 108, 'name' => 'wanting to run', 'category_id' => 6], |
|
123 | - ['id' => 109, 'name' => 'constant cravings for old coping behaviors', 'category_id' => 6], |
|
124 | - ['id' => 110, 'name' => 'thinking of using drugs and alcohol', 'category_id' => 6], |
|
125 | - ['id' => 111, 'name' => 'seeking out old unhealthy people and places', 'category_id' => 6], |
|
126 | - ['id' => 112, 'name' => 'really isolated', 'category_id' => 6], |
|
127 | - ['id' => 113, 'name' => 'people are angry with you', 'category_id' => 6], |
|
128 | - ['id' => 114, 'name' => 'self-abuse', 'category_id' => 6], |
|
129 | - ['id' => 115, 'name' => 'suicidal thoughts', 'category_id' => 6], |
|
130 | - ['id' => 116, 'name' => 'no goals', 'category_id' => 6], |
|
131 | - ['id' => 117, 'name' => 'survival mode', 'category_id' => 6], |
|
132 | - ['id' => 118, 'name' => 'not returning phone calls', 'category_id' => 6], |
|
133 | - ['id' => 119, 'name' => 'missing work', 'category_id' => 6], |
|
134 | - ['id' => 120, 'name' => 'irritability', 'category_id' => 6], |
|
135 | - ['id' => 121, 'name' => 'loss of appetite', 'category_id' => 6], |
|
136 | - ['id' => 122, 'name' => 'returning to the place you swore you would never go again', 'category_id' => 7], |
|
137 | - ['id' => 123, 'name' => 'giving up', 'category_id' => 7], |
|
138 | - ['id' => 124, 'name' => 'giving in', 'category_id' => 7], |
|
139 | - ['id' => 125, 'name' => 'out of control', 'category_id' => 7], |
|
140 | - ['id' => 126, 'name' => 'lost in your addiction', 'category_id' => 7], |
|
141 | - ['id' => 127, 'name' => 'lying to yourself and others', 'category_id' => 7], |
|
142 | - ['id' => 128, 'name' => 'feeling you just can\'t manage without your coping behavior, at least for now', 'category_id' => 7], |
|
143 | - ['id' => 129, 'name' => 'shame', 'category_id' => 7], |
|
144 | - ['id' => 130, 'name' => 'condemnation', 'category_id' => 7], |
|
145 | - ['id' => 131, 'name' => 'guilt', 'category_id' => 7], |
|
146 | - ['id' => 132, 'name' => 'aloneness', 'category_id' => 7], |
|
147 | - ]; |
|
16 | + public static $behaviors = [ |
|
17 | + ['id' => 1, 'name' => 'no current secrets', 'category_id' => 1], |
|
18 | + ['id' => 2, 'name' => 'resolving problems', 'category_id' => 1], |
|
19 | + ['id' => 3, 'name' => 'identifying fears and feelings', 'category_id' => 1], |
|
20 | + ['id' => 4, 'name' => 'keeping commitments to meetings, prayer, family, church, people, goals, and self', 'category_id' => 1], |
|
21 | + ['id' => 5, 'name' => 'being open', 'category_id' => 1], |
|
22 | + ['id' => 6, 'name' => 'being honest', 'category_id' => 1], |
|
23 | + ['id' => 7, 'name' => 'making eye contact', 'category_id' => 1], |
|
24 | + ['id' => 8, 'name' => 'reaching out to others', 'category_id' => 1], |
|
25 | + ['id' => 9, 'name' => 'increasing in relationships with God and others', 'category_id' => 1], |
|
26 | + ['id' => 10, 'name' => 'accountability', 'category_id' => 1], |
|
27 | + ['id' => 11, 'name' => 'secrets', 'category_id' => 2], |
|
28 | + ['id' => 12, 'name' => 'bored', 'category_id' => 2], |
|
29 | + ['id' => 13, 'name' => 'less time/energy for God, meetings, and church', 'category_id' => 2], |
|
30 | + ['id' => 14, 'name' => 'avoiding support and accountability towards people', 'category_id' => 2], |
|
31 | + ['id' => 15, 'name' => 'superficial conversations', 'category_id' => 2], |
|
32 | + ['id' => 16, 'name' => 'sarcasm', 'category_id' => 2], |
|
33 | + ['id' => 17, 'name' => 'isolating yourself', 'category_id' => 2], |
|
34 | + ['id' => 18, 'name' => 'changes in goals', 'category_id' => 2], |
|
35 | + ['id' => 19, 'name' => 'flirting', 'category_id' => 2], |
|
36 | + ['id' => 20, 'name' => 'obsessed with relationships', 'category_id' => 2], |
|
37 | + ['id' => 21, 'name' => 'breaking promises/commitments', 'category_id' => 2], |
|
38 | + ['id' => 22, 'name' => 'neglecting family', 'category_id' => 2], |
|
39 | + ['id' => 23, 'name' => 'preoccupation with material things, television, or entertainment', 'category_id' => 2], |
|
40 | + ['id' => 24, 'name' => 'procrastination', 'category_id' => 2], |
|
41 | + ['id' => 25, 'name' => 'lying', 'category_id' => 2], |
|
42 | + ['id' => 26, 'name' => 'over-confidence', 'category_id' => 2], |
|
43 | + ['id' => 27, 'name' => 'hiding money', 'category_id' => 2], |
|
44 | + ['id' => 28, 'name' => 'worry', 'category_id' => 3], |
|
45 | + ['id' => 29, 'name' => 'using profanity', 'category_id' => 3], |
|
46 | + ['id' => 30, 'name' => 'being fearful', 'category_id' => 3], |
|
47 | + ['id' => 31, 'name' => 'being resentful', 'category_id' => 3], |
|
48 | + ['id' => 32, 'name' => 'replaying old, negative thoughts', 'category_id' => 3], |
|
49 | + ['id' => 33, 'name' => 'perfectionism', 'category_id' => 3], |
|
50 | + ['id' => 34, 'name' => 'judging others\' motives', 'category_id' => 3], |
|
51 | + ['id' => 35, 'name' => 'making goals and lists you can\'t complete', 'category_id' => 3], |
|
52 | + ['id' => 36, 'name' => 'poor planning', 'category_id' => 3], |
|
53 | + ['id' => 37, 'name' => 'mind reading', 'category_id' => 3], |
|
54 | + ['id' => 38, 'name' => 'fantasy', 'category_id' => 3], |
|
55 | + ['id' => 41, 'name' => 'co-dependent rescuing', 'category_id' => 3], |
|
56 | + ['id' => 42, 'name' => 'sleep problems', 'category_id' => 3], |
|
57 | + ['id' => 43, 'name' => 'trouble concentrating', 'category_id' => 3], |
|
58 | + ['id' => 44, 'name' => 'seeking/creating drama', 'category_id' => 3], |
|
59 | + ['id' => 45, 'name' => 'gossip', 'category_id' => 3], |
|
60 | + ['id' => 46, 'name' => 'using over-the-counter medication for pain, sleep, and weight control', 'category_id' => 3], |
|
61 | + ['id' => 47, 'name' => 'super busy', 'category_id' => 4], |
|
62 | + ['id' => 48, 'name' => 'workaholic', 'category_id' => 4], |
|
63 | + ['id' => 49, 'name' => 'can\'t relax', 'category_id' => 4], |
|
64 | + ['id' => 50, 'name' => 'driving too fast', 'category_id' => 4], |
|
65 | + ['id' => 51, 'name' => 'avoiding slowing down', 'category_id' => 4], |
|
66 | + ['id' => 52, 'name' => 'feeling driven', 'category_id' => 4], |
|
67 | + ['id' => 53, 'name' => 'in a hurry', 'category_id' => 4], |
|
68 | + ['id' => 54, 'name' => 'can\'t turn off thoughts', 'category_id' => 4], |
|
69 | + ['id' => 55, 'name' => 'skipping meals', 'category_id' => 4], |
|
70 | + ['id' => 56, 'name' => 'binge eating (usually at night)', 'category_id' => 4], |
|
71 | + ['id' => 57, 'name' => 'overspending', 'category_id' => 4], |
|
72 | + ['id' => 58, 'name' => 'can\'t identify own feelings/needs', 'category_id' => 4], |
|
73 | + ['id' => 59, 'name' => 'repetitive, negative thoughts', 'category_id' => 4], |
|
74 | + ['id' => 60, 'name' => 'irritable', 'category_id' => 4], |
|
75 | + ['id' => 61, 'name' => 'making excuses for "having to do it all"', 'category_id' => 4], |
|
76 | + ['id' => 62, 'name' => 'dramatic mood swings', 'category_id' => 4], |
|
77 | + ['id' => 63, 'name' => 'lust', 'category_id' => 4], |
|
78 | + ['id' => 64, 'name' => 'too much caffeine', 'category_id' => 4], |
|
79 | + ['id' => 65, 'name' => 'over exercising', 'category_id' => 4], |
|
80 | + ['id' => 66, 'name' => 'nervousness', 'category_id' => 4], |
|
81 | + ['id' => 67, 'name' => 'difficulty being alone or with people', 'category_id' => 4], |
|
82 | + ['id' => 68, 'name' => 'difficulty listening to others', 'category_id' => 4], |
|
83 | + ['id' => 69, 'name' => 'avoiding support', 'category_id' => 4], |
|
84 | + ['id' => 70, 'name' => 'procrastination causing crises in money, work, or relationships', 'category_id' => 5], |
|
85 | + ['id' => 71, 'name' => 'sarcasm', 'category_id' => 5], |
|
86 | + ['id' => 72, 'name' => 'black and white, all or nothing thinking', 'category_id' => 5], |
|
87 | + ['id' => 73, 'name' => 'feeling that no one understands', 'category_id' => 5], |
|
88 | + ['id' => 74, 'name' => 'overreacting', 'category_id' => 5], |
|
89 | + ['id' => 75, 'name' => 'road rage', 'category_id' => 5], |
|
90 | + ['id' => 76, 'name' => 'constant resentments', 'category_id' => 5], |
|
91 | + ['id' => 77, 'name' => 'pushing others away', 'category_id' => 5], |
|
92 | + ['id' => 78, 'name' => 'increased isolation', 'category_id' => 5], |
|
93 | + ['id' => 79, 'name' => 'blaming', 'category_id' => 5], |
|
94 | + ['id' => 80, 'name' => 'self pity', 'category_id' => 5], |
|
95 | + ['id' => 81, 'name' => 'arguing', 'category_id' => 5], |
|
96 | + ['id' => 82, 'name' => 'irrationality', 'category_id' => 5], |
|
97 | + ['id' => 83, 'name' => 'can\'t handle criticism', 'category_id' => 5], |
|
98 | + ['id' => 84, 'name' => 'defensive', 'category_id' => 5], |
|
99 | + ['id' => 85, 'name' => 'people are avoiding you', 'category_id' => 5], |
|
100 | + ['id' => 86, 'name' => 'having to be right', 'category_id' => 5], |
|
101 | + ['id' => 87, 'name' => 'digestive problems', 'category_id' => 5], |
|
102 | + ['id' => 88, 'name' => 'headaches', 'category_id' => 5], |
|
103 | + ['id' => 89, 'name' => 'obsessive (stuck) thoughts', 'category_id' => 5], |
|
104 | + ['id' => 90, 'name' => 'can\'t forgive', 'category_id' => 5], |
|
105 | + ['id' => 91, 'name' => 'feeling grandiose (superior)', 'category_id' => 5], |
|
106 | + ['id' => 92, 'name' => 'intimidation', 'category_id' => 5], |
|
107 | + ['id' => 93, 'name' => 'feeling aggressive', 'category_id' => 5], |
|
108 | + ['id' => 94, 'name' => 'depressed', 'category_id' => 6], |
|
109 | + ['id' => 95, 'name' => 'panicked', 'category_id' => 6], |
|
110 | + ['id' => 96, 'name' => 'confused', 'category_id' => 6], |
|
111 | + ['id' => 97, 'name' => 'hopeless', 'category_id' => 6], |
|
112 | + ['id' => 98, 'name' => 'sleeping too much or too little', 'category_id' => 6], |
|
113 | + ['id' => 99, 'name' => 'can\'t cope', 'category_id' => 6], |
|
114 | + ['id' => 100, 'name' => 'overwhelmed', 'category_id' => 6], |
|
115 | + ['id' => 101, 'name' => 'crying for "no reason"', 'category_id' => 6], |
|
116 | + ['id' => 102, 'name' => 'can\'t think', 'category_id' => 6], |
|
117 | + ['id' => 103, 'name' => 'forgetful', 'category_id' => 6], |
|
118 | + ['id' => 104, 'name' => 'pessimistic', 'category_id' => 6], |
|
119 | + ['id' => 105, 'name' => 'helpless', 'category_id' => 6], |
|
120 | + ['id' => 106, 'name' => 'tired', 'category_id' => 6], |
|
121 | + ['id' => 107, 'name' => 'numb', 'category_id' => 6], |
|
122 | + ['id' => 108, 'name' => 'wanting to run', 'category_id' => 6], |
|
123 | + ['id' => 109, 'name' => 'constant cravings for old coping behaviors', 'category_id' => 6], |
|
124 | + ['id' => 110, 'name' => 'thinking of using drugs and alcohol', 'category_id' => 6], |
|
125 | + ['id' => 111, 'name' => 'seeking out old unhealthy people and places', 'category_id' => 6], |
|
126 | + ['id' => 112, 'name' => 'really isolated', 'category_id' => 6], |
|
127 | + ['id' => 113, 'name' => 'people are angry with you', 'category_id' => 6], |
|
128 | + ['id' => 114, 'name' => 'self-abuse', 'category_id' => 6], |
|
129 | + ['id' => 115, 'name' => 'suicidal thoughts', 'category_id' => 6], |
|
130 | + ['id' => 116, 'name' => 'no goals', 'category_id' => 6], |
|
131 | + ['id' => 117, 'name' => 'survival mode', 'category_id' => 6], |
|
132 | + ['id' => 118, 'name' => 'not returning phone calls', 'category_id' => 6], |
|
133 | + ['id' => 119, 'name' => 'missing work', 'category_id' => 6], |
|
134 | + ['id' => 120, 'name' => 'irritability', 'category_id' => 6], |
|
135 | + ['id' => 121, 'name' => 'loss of appetite', 'category_id' => 6], |
|
136 | + ['id' => 122, 'name' => 'returning to the place you swore you would never go again', 'category_id' => 7], |
|
137 | + ['id' => 123, 'name' => 'giving up', 'category_id' => 7], |
|
138 | + ['id' => 124, 'name' => 'giving in', 'category_id' => 7], |
|
139 | + ['id' => 125, 'name' => 'out of control', 'category_id' => 7], |
|
140 | + ['id' => 126, 'name' => 'lost in your addiction', 'category_id' => 7], |
|
141 | + ['id' => 127, 'name' => 'lying to yourself and others', 'category_id' => 7], |
|
142 | + ['id' => 128, 'name' => 'feeling you just can\'t manage without your coping behavior, at least for now', 'category_id' => 7], |
|
143 | + ['id' => 129, 'name' => 'shame', 'category_id' => 7], |
|
144 | + ['id' => 130, 'name' => 'condemnation', 'category_id' => 7], |
|
145 | + ['id' => 131, 'name' => 'guilt', 'category_id' => 7], |
|
146 | + ['id' => 132, 'name' => 'aloneness', 'category_id' => 7], |
|
147 | + ]; |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * @inheritdoc |
@@ -14,103 +14,103 @@ discard block |
||
14 | 14 | class Behavior extends \yii\base\BaseObject implements BehaviorInterface |
15 | 15 | { |
16 | 16 | public static $behaviors = [ |
17 | - ['id' => 1, 'name' => 'no current secrets', 'category_id' => 1], |
|
18 | - ['id' => 2, 'name' => 'resolving problems', 'category_id' => 1], |
|
19 | - ['id' => 3, 'name' => 'identifying fears and feelings', 'category_id' => 1], |
|
20 | - ['id' => 4, 'name' => 'keeping commitments to meetings, prayer, family, church, people, goals, and self', 'category_id' => 1], |
|
21 | - ['id' => 5, 'name' => 'being open', 'category_id' => 1], |
|
22 | - ['id' => 6, 'name' => 'being honest', 'category_id' => 1], |
|
23 | - ['id' => 7, 'name' => 'making eye contact', 'category_id' => 1], |
|
24 | - ['id' => 8, 'name' => 'reaching out to others', 'category_id' => 1], |
|
25 | - ['id' => 9, 'name' => 'increasing in relationships with God and others', 'category_id' => 1], |
|
26 | - ['id' => 10, 'name' => 'accountability', 'category_id' => 1], |
|
27 | - ['id' => 11, 'name' => 'secrets', 'category_id' => 2], |
|
28 | - ['id' => 12, 'name' => 'bored', 'category_id' => 2], |
|
29 | - ['id' => 13, 'name' => 'less time/energy for God, meetings, and church', 'category_id' => 2], |
|
30 | - ['id' => 14, 'name' => 'avoiding support and accountability towards people', 'category_id' => 2], |
|
31 | - ['id' => 15, 'name' => 'superficial conversations', 'category_id' => 2], |
|
32 | - ['id' => 16, 'name' => 'sarcasm', 'category_id' => 2], |
|
33 | - ['id' => 17, 'name' => 'isolating yourself', 'category_id' => 2], |
|
34 | - ['id' => 18, 'name' => 'changes in goals', 'category_id' => 2], |
|
35 | - ['id' => 19, 'name' => 'flirting', 'category_id' => 2], |
|
36 | - ['id' => 20, 'name' => 'obsessed with relationships', 'category_id' => 2], |
|
37 | - ['id' => 21, 'name' => 'breaking promises/commitments', 'category_id' => 2], |
|
38 | - ['id' => 22, 'name' => 'neglecting family', 'category_id' => 2], |
|
39 | - ['id' => 23, 'name' => 'preoccupation with material things, television, or entertainment', 'category_id' => 2], |
|
40 | - ['id' => 24, 'name' => 'procrastination', 'category_id' => 2], |
|
41 | - ['id' => 25, 'name' => 'lying', 'category_id' => 2], |
|
42 | - ['id' => 26, 'name' => 'over-confidence', 'category_id' => 2], |
|
43 | - ['id' => 27, 'name' => 'hiding money', 'category_id' => 2], |
|
44 | - ['id' => 28, 'name' => 'worry', 'category_id' => 3], |
|
45 | - ['id' => 29, 'name' => 'using profanity', 'category_id' => 3], |
|
46 | - ['id' => 30, 'name' => 'being fearful', 'category_id' => 3], |
|
47 | - ['id' => 31, 'name' => 'being resentful', 'category_id' => 3], |
|
48 | - ['id' => 32, 'name' => 'replaying old, negative thoughts', 'category_id' => 3], |
|
49 | - ['id' => 33, 'name' => 'perfectionism', 'category_id' => 3], |
|
50 | - ['id' => 34, 'name' => 'judging others\' motives', 'category_id' => 3], |
|
51 | - ['id' => 35, 'name' => 'making goals and lists you can\'t complete', 'category_id' => 3], |
|
52 | - ['id' => 36, 'name' => 'poor planning', 'category_id' => 3], |
|
53 | - ['id' => 37, 'name' => 'mind reading', 'category_id' => 3], |
|
54 | - ['id' => 38, 'name' => 'fantasy', 'category_id' => 3], |
|
55 | - ['id' => 41, 'name' => 'co-dependent rescuing', 'category_id' => 3], |
|
56 | - ['id' => 42, 'name' => 'sleep problems', 'category_id' => 3], |
|
57 | - ['id' => 43, 'name' => 'trouble concentrating', 'category_id' => 3], |
|
58 | - ['id' => 44, 'name' => 'seeking/creating drama', 'category_id' => 3], |
|
59 | - ['id' => 45, 'name' => 'gossip', 'category_id' => 3], |
|
60 | - ['id' => 46, 'name' => 'using over-the-counter medication for pain, sleep, and weight control', 'category_id' => 3], |
|
61 | - ['id' => 47, 'name' => 'super busy', 'category_id' => 4], |
|
62 | - ['id' => 48, 'name' => 'workaholic', 'category_id' => 4], |
|
63 | - ['id' => 49, 'name' => 'can\'t relax', 'category_id' => 4], |
|
64 | - ['id' => 50, 'name' => 'driving too fast', 'category_id' => 4], |
|
65 | - ['id' => 51, 'name' => 'avoiding slowing down', 'category_id' => 4], |
|
66 | - ['id' => 52, 'name' => 'feeling driven', 'category_id' => 4], |
|
67 | - ['id' => 53, 'name' => 'in a hurry', 'category_id' => 4], |
|
68 | - ['id' => 54, 'name' => 'can\'t turn off thoughts', 'category_id' => 4], |
|
69 | - ['id' => 55, 'name' => 'skipping meals', 'category_id' => 4], |
|
70 | - ['id' => 56, 'name' => 'binge eating (usually at night)', 'category_id' => 4], |
|
71 | - ['id' => 57, 'name' => 'overspending', 'category_id' => 4], |
|
72 | - ['id' => 58, 'name' => 'can\'t identify own feelings/needs', 'category_id' => 4], |
|
73 | - ['id' => 59, 'name' => 'repetitive, negative thoughts', 'category_id' => 4], |
|
74 | - ['id' => 60, 'name' => 'irritable', 'category_id' => 4], |
|
75 | - ['id' => 61, 'name' => 'making excuses for "having to do it all"', 'category_id' => 4], |
|
76 | - ['id' => 62, 'name' => 'dramatic mood swings', 'category_id' => 4], |
|
77 | - ['id' => 63, 'name' => 'lust', 'category_id' => 4], |
|
78 | - ['id' => 64, 'name' => 'too much caffeine', 'category_id' => 4], |
|
79 | - ['id' => 65, 'name' => 'over exercising', 'category_id' => 4], |
|
80 | - ['id' => 66, 'name' => 'nervousness', 'category_id' => 4], |
|
81 | - ['id' => 67, 'name' => 'difficulty being alone or with people', 'category_id' => 4], |
|
82 | - ['id' => 68, 'name' => 'difficulty listening to others', 'category_id' => 4], |
|
83 | - ['id' => 69, 'name' => 'avoiding support', 'category_id' => 4], |
|
84 | - ['id' => 70, 'name' => 'procrastination causing crises in money, work, or relationships', 'category_id' => 5], |
|
85 | - ['id' => 71, 'name' => 'sarcasm', 'category_id' => 5], |
|
86 | - ['id' => 72, 'name' => 'black and white, all or nothing thinking', 'category_id' => 5], |
|
87 | - ['id' => 73, 'name' => 'feeling that no one understands', 'category_id' => 5], |
|
88 | - ['id' => 74, 'name' => 'overreacting', 'category_id' => 5], |
|
89 | - ['id' => 75, 'name' => 'road rage', 'category_id' => 5], |
|
90 | - ['id' => 76, 'name' => 'constant resentments', 'category_id' => 5], |
|
91 | - ['id' => 77, 'name' => 'pushing others away', 'category_id' => 5], |
|
92 | - ['id' => 78, 'name' => 'increased isolation', 'category_id' => 5], |
|
93 | - ['id' => 79, 'name' => 'blaming', 'category_id' => 5], |
|
94 | - ['id' => 80, 'name' => 'self pity', 'category_id' => 5], |
|
95 | - ['id' => 81, 'name' => 'arguing', 'category_id' => 5], |
|
96 | - ['id' => 82, 'name' => 'irrationality', 'category_id' => 5], |
|
97 | - ['id' => 83, 'name' => 'can\'t handle criticism', 'category_id' => 5], |
|
98 | - ['id' => 84, 'name' => 'defensive', 'category_id' => 5], |
|
99 | - ['id' => 85, 'name' => 'people are avoiding you', 'category_id' => 5], |
|
100 | - ['id' => 86, 'name' => 'having to be right', 'category_id' => 5], |
|
101 | - ['id' => 87, 'name' => 'digestive problems', 'category_id' => 5], |
|
102 | - ['id' => 88, 'name' => 'headaches', 'category_id' => 5], |
|
103 | - ['id' => 89, 'name' => 'obsessive (stuck) thoughts', 'category_id' => 5], |
|
104 | - ['id' => 90, 'name' => 'can\'t forgive', 'category_id' => 5], |
|
105 | - ['id' => 91, 'name' => 'feeling grandiose (superior)', 'category_id' => 5], |
|
106 | - ['id' => 92, 'name' => 'intimidation', 'category_id' => 5], |
|
107 | - ['id' => 93, 'name' => 'feeling aggressive', 'category_id' => 5], |
|
108 | - ['id' => 94, 'name' => 'depressed', 'category_id' => 6], |
|
109 | - ['id' => 95, 'name' => 'panicked', 'category_id' => 6], |
|
110 | - ['id' => 96, 'name' => 'confused', 'category_id' => 6], |
|
111 | - ['id' => 97, 'name' => 'hopeless', 'category_id' => 6], |
|
112 | - ['id' => 98, 'name' => 'sleeping too much or too little', 'category_id' => 6], |
|
113 | - ['id' => 99, 'name' => 'can\'t cope', 'category_id' => 6], |
|
17 | + ['id' => 1, 'name' => 'no current secrets', 'category_id' => 1], |
|
18 | + ['id' => 2, 'name' => 'resolving problems', 'category_id' => 1], |
|
19 | + ['id' => 3, 'name' => 'identifying fears and feelings', 'category_id' => 1], |
|
20 | + ['id' => 4, 'name' => 'keeping commitments to meetings, prayer, family, church, people, goals, and self', 'category_id' => 1], |
|
21 | + ['id' => 5, 'name' => 'being open', 'category_id' => 1], |
|
22 | + ['id' => 6, 'name' => 'being honest', 'category_id' => 1], |
|
23 | + ['id' => 7, 'name' => 'making eye contact', 'category_id' => 1], |
|
24 | + ['id' => 8, 'name' => 'reaching out to others', 'category_id' => 1], |
|
25 | + ['id' => 9, 'name' => 'increasing in relationships with God and others', 'category_id' => 1], |
|
26 | + ['id' => 10, 'name' => 'accountability', 'category_id' => 1], |
|
27 | + ['id' => 11, 'name' => 'secrets', 'category_id' => 2], |
|
28 | + ['id' => 12, 'name' => 'bored', 'category_id' => 2], |
|
29 | + ['id' => 13, 'name' => 'less time/energy for God, meetings, and church', 'category_id' => 2], |
|
30 | + ['id' => 14, 'name' => 'avoiding support and accountability towards people', 'category_id' => 2], |
|
31 | + ['id' => 15, 'name' => 'superficial conversations', 'category_id' => 2], |
|
32 | + ['id' => 16, 'name' => 'sarcasm', 'category_id' => 2], |
|
33 | + ['id' => 17, 'name' => 'isolating yourself', 'category_id' => 2], |
|
34 | + ['id' => 18, 'name' => 'changes in goals', 'category_id' => 2], |
|
35 | + ['id' => 19, 'name' => 'flirting', 'category_id' => 2], |
|
36 | + ['id' => 20, 'name' => 'obsessed with relationships', 'category_id' => 2], |
|
37 | + ['id' => 21, 'name' => 'breaking promises/commitments', 'category_id' => 2], |
|
38 | + ['id' => 22, 'name' => 'neglecting family', 'category_id' => 2], |
|
39 | + ['id' => 23, 'name' => 'preoccupation with material things, television, or entertainment', 'category_id' => 2], |
|
40 | + ['id' => 24, 'name' => 'procrastination', 'category_id' => 2], |
|
41 | + ['id' => 25, 'name' => 'lying', 'category_id' => 2], |
|
42 | + ['id' => 26, 'name' => 'over-confidence', 'category_id' => 2], |
|
43 | + ['id' => 27, 'name' => 'hiding money', 'category_id' => 2], |
|
44 | + ['id' => 28, 'name' => 'worry', 'category_id' => 3], |
|
45 | + ['id' => 29, 'name' => 'using profanity', 'category_id' => 3], |
|
46 | + ['id' => 30, 'name' => 'being fearful', 'category_id' => 3], |
|
47 | + ['id' => 31, 'name' => 'being resentful', 'category_id' => 3], |
|
48 | + ['id' => 32, 'name' => 'replaying old, negative thoughts', 'category_id' => 3], |
|
49 | + ['id' => 33, 'name' => 'perfectionism', 'category_id' => 3], |
|
50 | + ['id' => 34, 'name' => 'judging others\' motives', 'category_id' => 3], |
|
51 | + ['id' => 35, 'name' => 'making goals and lists you can\'t complete', 'category_id' => 3], |
|
52 | + ['id' => 36, 'name' => 'poor planning', 'category_id' => 3], |
|
53 | + ['id' => 37, 'name' => 'mind reading', 'category_id' => 3], |
|
54 | + ['id' => 38, 'name' => 'fantasy', 'category_id' => 3], |
|
55 | + ['id' => 41, 'name' => 'co-dependent rescuing', 'category_id' => 3], |
|
56 | + ['id' => 42, 'name' => 'sleep problems', 'category_id' => 3], |
|
57 | + ['id' => 43, 'name' => 'trouble concentrating', 'category_id' => 3], |
|
58 | + ['id' => 44, 'name' => 'seeking/creating drama', 'category_id' => 3], |
|
59 | + ['id' => 45, 'name' => 'gossip', 'category_id' => 3], |
|
60 | + ['id' => 46, 'name' => 'using over-the-counter medication for pain, sleep, and weight control', 'category_id' => 3], |
|
61 | + ['id' => 47, 'name' => 'super busy', 'category_id' => 4], |
|
62 | + ['id' => 48, 'name' => 'workaholic', 'category_id' => 4], |
|
63 | + ['id' => 49, 'name' => 'can\'t relax', 'category_id' => 4], |
|
64 | + ['id' => 50, 'name' => 'driving too fast', 'category_id' => 4], |
|
65 | + ['id' => 51, 'name' => 'avoiding slowing down', 'category_id' => 4], |
|
66 | + ['id' => 52, 'name' => 'feeling driven', 'category_id' => 4], |
|
67 | + ['id' => 53, 'name' => 'in a hurry', 'category_id' => 4], |
|
68 | + ['id' => 54, 'name' => 'can\'t turn off thoughts', 'category_id' => 4], |
|
69 | + ['id' => 55, 'name' => 'skipping meals', 'category_id' => 4], |
|
70 | + ['id' => 56, 'name' => 'binge eating (usually at night)', 'category_id' => 4], |
|
71 | + ['id' => 57, 'name' => 'overspending', 'category_id' => 4], |
|
72 | + ['id' => 58, 'name' => 'can\'t identify own feelings/needs', 'category_id' => 4], |
|
73 | + ['id' => 59, 'name' => 'repetitive, negative thoughts', 'category_id' => 4], |
|
74 | + ['id' => 60, 'name' => 'irritable', 'category_id' => 4], |
|
75 | + ['id' => 61, 'name' => 'making excuses for "having to do it all"', 'category_id' => 4], |
|
76 | + ['id' => 62, 'name' => 'dramatic mood swings', 'category_id' => 4], |
|
77 | + ['id' => 63, 'name' => 'lust', 'category_id' => 4], |
|
78 | + ['id' => 64, 'name' => 'too much caffeine', 'category_id' => 4], |
|
79 | + ['id' => 65, 'name' => 'over exercising', 'category_id' => 4], |
|
80 | + ['id' => 66, 'name' => 'nervousness', 'category_id' => 4], |
|
81 | + ['id' => 67, 'name' => 'difficulty being alone or with people', 'category_id' => 4], |
|
82 | + ['id' => 68, 'name' => 'difficulty listening to others', 'category_id' => 4], |
|
83 | + ['id' => 69, 'name' => 'avoiding support', 'category_id' => 4], |
|
84 | + ['id' => 70, 'name' => 'procrastination causing crises in money, work, or relationships', 'category_id' => 5], |
|
85 | + ['id' => 71, 'name' => 'sarcasm', 'category_id' => 5], |
|
86 | + ['id' => 72, 'name' => 'black and white, all or nothing thinking', 'category_id' => 5], |
|
87 | + ['id' => 73, 'name' => 'feeling that no one understands', 'category_id' => 5], |
|
88 | + ['id' => 74, 'name' => 'overreacting', 'category_id' => 5], |
|
89 | + ['id' => 75, 'name' => 'road rage', 'category_id' => 5], |
|
90 | + ['id' => 76, 'name' => 'constant resentments', 'category_id' => 5], |
|
91 | + ['id' => 77, 'name' => 'pushing others away', 'category_id' => 5], |
|
92 | + ['id' => 78, 'name' => 'increased isolation', 'category_id' => 5], |
|
93 | + ['id' => 79, 'name' => 'blaming', 'category_id' => 5], |
|
94 | + ['id' => 80, 'name' => 'self pity', 'category_id' => 5], |
|
95 | + ['id' => 81, 'name' => 'arguing', 'category_id' => 5], |
|
96 | + ['id' => 82, 'name' => 'irrationality', 'category_id' => 5], |
|
97 | + ['id' => 83, 'name' => 'can\'t handle criticism', 'category_id' => 5], |
|
98 | + ['id' => 84, 'name' => 'defensive', 'category_id' => 5], |
|
99 | + ['id' => 85, 'name' => 'people are avoiding you', 'category_id' => 5], |
|
100 | + ['id' => 86, 'name' => 'having to be right', 'category_id' => 5], |
|
101 | + ['id' => 87, 'name' => 'digestive problems', 'category_id' => 5], |
|
102 | + ['id' => 88, 'name' => 'headaches', 'category_id' => 5], |
|
103 | + ['id' => 89, 'name' => 'obsessive (stuck) thoughts', 'category_id' => 5], |
|
104 | + ['id' => 90, 'name' => 'can\'t forgive', 'category_id' => 5], |
|
105 | + ['id' => 91, 'name' => 'feeling grandiose (superior)', 'category_id' => 5], |
|
106 | + ['id' => 92, 'name' => 'intimidation', 'category_id' => 5], |
|
107 | + ['id' => 93, 'name' => 'feeling aggressive', 'category_id' => 5], |
|
108 | + ['id' => 94, 'name' => 'depressed', 'category_id' => 6], |
|
109 | + ['id' => 95, 'name' => 'panicked', 'category_id' => 6], |
|
110 | + ['id' => 96, 'name' => 'confused', 'category_id' => 6], |
|
111 | + ['id' => 97, 'name' => 'hopeless', 'category_id' => 6], |
|
112 | + ['id' => 98, 'name' => 'sleeping too much or too little', 'category_id' => 6], |
|
113 | + ['id' => 99, 'name' => 'can\'t cope', 'category_id' => 6], |
|
114 | 114 | ['id' => 100, 'name' => 'overwhelmed', 'category_id' => 6], |
115 | 115 | ['id' => 101, 'name' => 'crying for "no reason"', 'category_id' => 6], |
116 | 116 | ['id' => 102, 'name' => 'can\'t think', 'category_id' => 6], |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | public function getCategories() { |
181 | 181 | $bhvrs_by_cat = AH::index(self::$behaviors, null, 'category_id'); |
182 | 182 | $cats = AH::index(\common\models\Category::$categories, "id"); |
183 | - foreach($cats as $id => &$cat) { |
|
183 | + foreach ($cats as $id => &$cat) { |
|
184 | 184 | $cat['behavior_count'] = count($bhvrs_by_cat[$id]); // add count of behaviors |
185 | 185 | $cat['category_id'] = $cat['id']; // rename id to category_id |
186 | 186 | unset($cat['id']); |
@@ -4,8 +4,8 @@ |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | // In the console environment, some path aliases may not exist. Please define these: |
7 | - Yii::setAlias('@webroot', __DIR__ . '/../web'); |
|
8 | - Yii::setAlias('@web', '/'); |
|
7 | + Yii::setAlias('@webroot', __DIR__ . '/../web'); |
|
8 | + Yii::setAlias('@web', '/'); |
|
9 | 9 | |
10 | 10 | $mainConf = require(Yii::getAlias('@site/config/main.php')); |
11 | 11 | $converter = $mainConf['components']['assetManager']['converter']; |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $model->answer_2c = 'answering question c'; |
86 | 86 | |
87 | 87 | expect('behaviorToAnswers should return the answer properties related to the behavior number supplied', $this->assertEquals($model->behaviorToAnswers(1), [ |
88 | - 'a' => 'answering question a', |
|
89 | - 'b' => 'answering question b', |
|
90 | - 'c' => 'answering question c' |
|
91 | - ])); |
|
88 | + 'a' => 'answering question a', |
|
89 | + 'b' => 'answering question b', |
|
90 | + 'c' => 'answering question c' |
|
91 | + ])); |
|
92 | 92 | |
93 | 93 | expect('behaviorToAnswers should return the the empty set when there are no answers associated with the supplied behavior number', $this->assertEmpty($model->behaviorToAnswers(7))); |
94 | 94 | }); |
@@ -117,51 +117,51 @@ discard block |
||
117 | 117 | $this->fakeModel(13, 281), |
118 | 118 | $this->fakeModel(28, 284) |
119 | 119 | ]), [ [ |
120 | - 'behavior_id' => 280, |
|
121 | - 'user_bhvr_id' => 7, |
|
122 | - 'question_id' => 1, |
|
123 | - 'answer' => 'processing emotions', |
|
124 | - ], [ |
|
125 | - 'behavior_id' => 280, |
|
126 | - 'user_bhvr_id' => 7, |
|
127 | - 'question_id' => 2, |
|
128 | - 'answer' => 'processing emotions', |
|
129 | - ], [ |
|
130 | - 'behavior_id' => 280, |
|
131 | - 'user_bhvr_id' => 7, |
|
132 | - 'question_id' => 3, |
|
133 | - 'answer' => 'processing emotions', |
|
134 | - ], [ |
|
135 | - 'behavior_id' => 281, |
|
136 | - 'user_bhvr_id' => 13, |
|
137 | - 'question_id' => 1, |
|
138 | - 'answer' => 'processing emotions', |
|
139 | - ], [ |
|
140 | - 'behavior_id' => 281, |
|
141 | - 'user_bhvr_id' => 13, |
|
142 | - 'question_id' => 2, |
|
143 | - 'answer' => 'processing emotions', |
|
144 | - ], [ |
|
145 | - 'behavior_id' => 281, |
|
146 | - 'user_bhvr_id' => 13, |
|
147 | - 'question_id' => 3, |
|
148 | - 'answer' => 'processing emotions', |
|
149 | - ], [ |
|
150 | - 'behavior_id' => 284, |
|
151 | - 'user_bhvr_id' => 28, |
|
152 | - 'question_id' => 1, |
|
153 | - 'answer' => 'processing emotions', |
|
154 | - ], [ |
|
155 | - 'behavior_id' => 284, |
|
156 | - 'user_bhvr_id' => 28, |
|
157 | - 'question_id' => 2, |
|
158 | - 'answer' => 'processing emotions', |
|
159 | - ], [ |
|
160 | - 'behavior_id' => 284, |
|
161 | - 'user_bhvr_id' => 28, |
|
162 | - 'question_id' => 3, |
|
163 | - 'answer' => 'processing emotions', |
|
164 | - ]])); |
|
120 | + 'behavior_id' => 280, |
|
121 | + 'user_bhvr_id' => 7, |
|
122 | + 'question_id' => 1, |
|
123 | + 'answer' => 'processing emotions', |
|
124 | + ], [ |
|
125 | + 'behavior_id' => 280, |
|
126 | + 'user_bhvr_id' => 7, |
|
127 | + 'question_id' => 2, |
|
128 | + 'answer' => 'processing emotions', |
|
129 | + ], [ |
|
130 | + 'behavior_id' => 280, |
|
131 | + 'user_bhvr_id' => 7, |
|
132 | + 'question_id' => 3, |
|
133 | + 'answer' => 'processing emotions', |
|
134 | + ], [ |
|
135 | + 'behavior_id' => 281, |
|
136 | + 'user_bhvr_id' => 13, |
|
137 | + 'question_id' => 1, |
|
138 | + 'answer' => 'processing emotions', |
|
139 | + ], [ |
|
140 | + 'behavior_id' => 281, |
|
141 | + 'user_bhvr_id' => 13, |
|
142 | + 'question_id' => 2, |
|
143 | + 'answer' => 'processing emotions', |
|
144 | + ], [ |
|
145 | + 'behavior_id' => 281, |
|
146 | + 'user_bhvr_id' => 13, |
|
147 | + 'question_id' => 3, |
|
148 | + 'answer' => 'processing emotions', |
|
149 | + ], [ |
|
150 | + 'behavior_id' => 284, |
|
151 | + 'user_bhvr_id' => 28, |
|
152 | + 'question_id' => 1, |
|
153 | + 'answer' => 'processing emotions', |
|
154 | + ], [ |
|
155 | + 'behavior_id' => 284, |
|
156 | + 'user_bhvr_id' => 28, |
|
157 | + 'question_id' => 2, |
|
158 | + 'answer' => 'processing emotions', |
|
159 | + ], [ |
|
160 | + 'behavior_id' => 284, |
|
161 | + 'user_bhvr_id' => 28, |
|
162 | + 'question_id' => 3, |
|
163 | + 'answer' => 'processing emotions', |
|
164 | + ]])); |
|
165 | 165 | }); |
166 | 166 | } |
167 | 167 |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser'); |
18 | 18 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
19 | 19 | $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion'); |
20 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
20 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
21 | 21 | return new \common\components\Time('America/Los_Angeles'); |
22 | 22 | }); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function testAttributeLabels() |
26 | 26 | { |
27 | - $this->specify('setBehaviors should function properly', function () { |
|
27 | + $this->specify('setBehaviors should function properly', function() { |
|
28 | 28 | $model = $this->container->get('\site\models\QuestionForm'); |
29 | 29 | expect('attributeLabels should be correct', $this->assertEquals($model->attributeLabels(), [ |
30 | 30 | 'user_behavior_id1' => 'Restoration', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $model = $this->container->get('\site\models\QuestionForm'); |
44 | 44 | $validator = $model->getBhvrValidator(); |
45 | 45 | |
46 | - $this->specify('getBhvrValidator should function properly', function () use($model, $validator) { |
|
46 | + $this->specify('getBhvrValidator should function properly', function() use($model, $validator) { |
|
47 | 47 | expect('getBhvrValidator should return false when nothing is set on the form', $this->assertFalse($validator($model, "user_behavior_id1"))); |
48 | 48 | expect('getBhvrValidator should return false when nothing is set on the form', $this->assertFalse($validator($model, "user_behavior_id7"))); |
49 | 49 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->fakeModel(7, 280), |
117 | 117 | $this->fakeModel(13, 281), |
118 | 118 | $this->fakeModel(28, 284) |
119 | - ]), [ [ |
|
119 | + ]), [[ |
|
120 | 120 | 'behavior_id' => 280, |
121 | 121 | 'user_bhvr_id' => 7, |
122 | 122 | 'question_id' => 1, |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | $this->container = new \yii\di\Container; |
34 | 34 | $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser'); |
35 | 35 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
36 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
36 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
37 | 37 | return new \common\components\Time('America/Los_Angeles'); |
38 | 38 | }); |
39 | 39 | |
40 | 40 | // instantiate mock objects |
41 | 41 | $user_behavior = $this->container->get('common\interfaces\UserBehaviorInterface'); |
42 | - $time = $this->container->get('common\interfaces\TimeInterface'); |
|
42 | + $time = $this->container->get('common\interfaces\TimeInterface'); |
|
43 | 43 | |
44 | 44 | $question = $this->getMockBuilder('\common\models\Question') |
45 | 45 | ->setMethods(['save', 'attributes']) |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | // set up a side effect to occur when the user's save() function is called |
130 | 130 | $saved = false; |
131 | - $this->user->method('save')->will($this->returnCallback(function($runValidation=true, $attributeNames=null) use(&$saved) { |
|
131 | + $this->user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use(&$saved) { |
|
132 | 132 | $saved = true; |
133 | 133 | return $this->user; |
134 | 134 | })); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | public function testSignupExistingConfirmedUser() { |
156 | 156 | $saved = false; |
157 | - $this->existing_user->method('save')->will($this->returnCallback(function($runValidation=true, $attributeNames=null) use(&$saved) { |
|
157 | + $this->existing_user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use(&$saved) { |
|
158 | 158 | $saved = true; |
159 | 159 | return $this->existing_user; |
160 | 160 | })); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | public function testSignupExistingUnconfirmedUser() { |
175 | 175 | $saved = false; |
176 | - $this->existing_user->method('save')->will($this->returnCallback(function($runValidation=true, $attributeNames=null) use(&$saved) { |
|
176 | + $this->existing_user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use(&$saved) { |
|
177 | 177 | $saved = true; |
178 | 178 | return $this->existing_user; |
179 | 179 | })); |
@@ -204,14 +204,14 @@ discard block |
||
204 | 204 | |
205 | 205 | $result = $form->setFields($this->user); |
206 | 206 | $this->specify('populate should set the values of the user model from the form', function() use ($result) { |
207 | - foreach($this->whitelist as $attr) { |
|
207 | + foreach ($this->whitelist as $attr) { |
|
208 | 208 | $this->assertEquals($this->vals[$attr], $result->$attr); |
209 | 209 | } |
210 | 210 | }); |
211 | 211 | } |
212 | 212 | |
213 | 213 | private function setAttrs($form, Array $vals) { |
214 | - foreach($vals as $key => $val) { |
|
214 | + foreach ($vals as $key => $val) { |
|
215 | 215 | $form->$key = $val; |
216 | 216 | } |
217 | 217 | return $form; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | private function getForm($user = null) { |
235 | - if(is_null($user)) $user = $this->user; |
|
235 | + if (is_null($user)) $user = $this->user; |
|
236 | 236 | $form = $this->container->get('\site\models\SignupForm', [$user]); |
237 | 237 | $form->attributes = $this->vals; // massive assignment |
238 | 238 | return $form; |
@@ -232,7 +232,9 @@ |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | private function getForm($user = null) { |
235 | - if(is_null($user)) $user = $this->user; |
|
235 | + if(is_null($user)) { |
|
236 | + $user = $this->user; |
|
237 | + } |
|
236 | 238 | $form = $this->container->get('\site\models\SignupForm', [$user]); |
237 | 239 | $form->attributes = $this->vals; // massive assignment |
238 | 240 | return $form; |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | expect('the form should validate correctly', $this->assertTrue($form->validate())); |
137 | 137 | $user = $form->signup(); |
138 | 138 | expect('signup() should return a newly-saved user when the user does not already exist with the submitted values', |
139 | - $this->assertEquals($user->getAttributes($this->whitelist), array_splice($this->vals, 1))); |
|
139 | + $this->assertEquals($user->getAttributes($this->whitelist), array_splice($this->vals, 1))); |
|
140 | 140 | expect('the "Remember Me" auth_key value should be set to a random string (defaults to a 32 char length)', |
141 | - $this->assertEquals(32, strlen($user->auth_key))); |
|
141 | + $this->assertEquals(32, strlen($user->auth_key))); |
|
142 | 142 | expect('password_hash to be set to something like a hash', |
143 | - $this->assertStringStartsWith('$2y$13$', $user->password_hash)); |
|
143 | + $this->assertStringStartsWith('$2y$13$', $user->password_hash)); |
|
144 | 144 | expect('when the user is created, signup() should call save()', |
145 | - $this->assertTrue($saved)); |
|
145 | + $this->assertTrue($saved)); |
|
146 | 146 | expect('This user should be an isNewRecord -- they should NOT already exist', $this->assertTrue($user->getIsNewRecord())); |
147 | 147 | }); |
148 | 148 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $user = $form3->signup(); |
187 | 187 | expect('This user should not be an isNewRecord -- they should already exist', $this->assertFalse($user->getIsNewRecord())); |
188 | 188 | expect('signup() should return a newly-saved user when the user does not already exist with the submitted values', |
189 | - $this->assertEquals($user->getAttributes($this->whitelist), array_splice($this->vals, 1))); |
|
189 | + $this->assertEquals($user->getAttributes($this->whitelist), array_splice($this->vals, 1))); |
|
190 | 190 | expect('when the user exists and is NOT confirmed, signup() should call save() to UPDATE their info', $this->assertTrue($saved)); |
191 | 191 | }); |
192 | 192 | } |