Passed
Pull Request — master (#191)
by Corey
03:34
created
common/models/LoginForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         if ($this->validate()) {
65 65
             $user = $this->getUser();
66 66
             if ($user->isVerified()) {
67
-                return Yii::$app->user->login($user, $this->rememberMe ? 3600 * 24 * 30 : 0);
67
+                return Yii::$app->user->login($user, $this->rememberMe ? 3600*24*30 : 0);
68 68
             } else {
69 69
                 Yii::$app->session->setFlash('warning', 'You must verify your account before you can proceed. Please check your email inbox for a verification email and follow the instructions.');
70 70
             }
Please login to merge, or discard this patch.
common/models/Category.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 class Category extends \yii\base\BaseObject implements \common\interfaces\CategoryInterface
13 13
 {
14 14
     public static $categories = [
15
-    [ "id" => 1, "name" => "Restoration"],
16
-    [ "id" => 2, "name" => "Forgetting Priorities"],
17
-    [ "id" => 3, "name" => "Anxiety"],
18
-    [ "id" => 4, "name" => "Speeding Up"],
19
-    [ "id" => 5, "name" => "Ticked Off"],
20
-    [ "id" => 6, "name" => "Exhausted"],
21
-    [ "id" => 7, "name" => "Relapse/Moral Failure"],
15
+    ["id" => 1, "name" => "Restoration"],
16
+    ["id" => 2, "name" => "Forgetting Priorities"],
17
+    ["id" => 3, "name" => "Anxiety"],
18
+    ["id" => 4, "name" => "Speeding Up"],
19
+    ["id" => 5, "name" => "Ticked Off"],
20
+    ["id" => 6, "name" => "Exhausted"],
21
+    ["id" => 7, "name" => "Relapse/Moral Failure"],
22 22
   ];
23 23
 
24 24
     public static $colors = [
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public static function getCategory($key, $val)
104 104
     {
105
-        $ret = array_values(array_filter(self::$categories, function ($cat) use ($key, $val) {
105
+        $ret = array_values(array_filter(self::$categories, function($cat) use ($key, $val) {
106 106
             return $cat[$key] === $val;
107 107
         }));
108 108
         return $ret ? $ret[0] : null;
Please login to merge, or discard this patch.
common/models/Behavior.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -14,103 +14,103 @@  discard block
 block discarded – undo
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],
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public static function getBehavior($key, $val)
208 208
     {
209
-        $ret = array_values(array_filter(self::$behaviors, function ($bvr) use ($key, $val) {
209
+        $ret = array_values(array_filter(self::$behaviors, function($bvr) use ($key, $val) {
210 210
             return $bvr[$key] === $val;
211 211
         }));
212 212
         return $ret ? $ret[0] : null;
Please login to merge, or discard this patch.
common/tests/unit/components/GraphTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
     use \Codeception\Specify;
15 15
 
16 16
     private $user;
17
-    private $filepath = __DIR__.'/../../_output/test_graph.png';
18
-    private $filepath_extra = __DIR__.'/../../_output/charts/test_graph.png';
17
+    private $filepath = __DIR__ . '/../../_output/test_graph.png';
18
+    private $filepath_extra = __DIR__ . '/../../_output/charts/test_graph.png';
19 19
 
20 20
     public function setUp(): void
21 21
     {
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
       ->willReturn('random1DH4sh');
40 40
         $graph = new Graph($this->user);
41 41
 
42
-        expect('the expected graph image filepath will be returned', $this->assertEquals(dirname(dirname(dirname(dirname(__DIR__)))).'/site/web/charts/random1DH4sh.png', $graph->getFilepath()));
42
+        expect('the expected graph image filepath will be returned', $this->assertEquals(dirname(dirname(dirname(dirname(__DIR__)))) . '/site/web/charts/random1DH4sh.png', $graph->getFilepath()));
43 43
     }
44 44
 
45 45
     public function testGetUrl()
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
       '2019-02-27' => [],
238 238
       '2019-02-28' => [],
239 239
       '2019-03-01' => [
240
-        2 => [ 'name' => 'Forgetting Priorities',
240
+        2 => ['name' => 'Forgetting Priorities',
241 241
         'count' => 6,
242 242
         'color' => '#4CA100',
243 243
         'highlight' => '#61B219',
Please login to merge, or discard this patch.
common/tests/unit/components/UtilityTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
     public function testGetRevHash()
43 43
     {
44
-        $this->specify('getRevHash should function correctly', function () {
44
+        $this->specify('getRevHash should function correctly', function() {
45 45
             expect('getRevHash should return false when the file does not exist', $this->assertFalse(Utility::getRevHash()));
46 46
 
47 47
             $this->_createRevFile();
Please login to merge, or discard this patch.
common/tests/unit/components/TimeTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior');
25 25
         $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion');
26 26
 
27
-        $this->container->set('common\interfaces\TimeInterface', function () {
27
+        $this->container->set('common\interfaces\TimeInterface', function() {
28 28
             return new \common\components\Time('America/Los_Angeles');
29 29
         });
30 30
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function testGetLocalTime()
49 49
     {
50
-        $this->specify('getLocalTime should function correctly', function () {
50
+        $this->specify('getLocalTime should function correctly', function() {
51 51
             expect("getLocalTime should work with user's set time", $this->assertEquals($this->time->getLocalTime(), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s")));
52 52
             expect('getLocalTime should work with a custom timezone', $this->assertEquals($this->time->getLocalTime("UTC"), (new DateTime("now"))->format("Y-m-d H:i:s")));
53 53
         });
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function testConvertLocalToUTC()
57 57
     {
58
-        $this->specify('convertLocalToUTC should function correctly', function () {
58
+        $this->specify('convertLocalToUTC should function correctly', function() {
59 59
             $la_tz = (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s");
60 60
 
61 61
             expect('convertLocalToUTC should convert a Los Angeles tz to UTC with the included time', $this->assertEquals($this->time->convertLocalToUTC($la_tz), (new DateTime("now"))->format("Y-m-d H:i:s")));
62 62
             expect('convertLocalToUTC should convert a Los Angeles tz to UTC without the included time', $this->assertEquals($this->time->convertLocalToUTC($la_tz, false), (new DateTime("now"))->format("Y-m-d")));
63 63
             // with UTC
64
-            $this->container->set('common\interfaces\TimeInterface', function () {
64
+            $this->container->set('common\interfaces\TimeInterface', function() {
65 65
                 return new \common\components\Time('UTC');
66 66
             });
67 67
             $time = $this->container->get('common\interfaces\TimeInterface');
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function testConvertUTCToLocal()
76 76
     {
77
-        $this->specify('convertUTCToLocal should function correctly', function () {
77
+        $this->specify('convertUTCToLocal should function correctly', function() {
78 78
             $utc_tz = (new DateTime("now"))->format("Y-m-d H:i:s");
79 79
 
80 80
             expect('convertUTCToLocal should convert a UTC tz to Los Angeles with the included timezone', $this->assertEquals((new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format(DateTime::ATOM), $this->time->convertUTCToLocal($utc_tz)));
81 81
             expect('convertUTCToLocal should convert a UTC tz to Los Angeles without the included timezone', $this->assertEquals($this->time->convertUTCToLocal($utc_tz, false), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s")));
82 82
 
83 83
             // with UTC
84
-            $this->container->set('common\interfaces\TimeInterface', function () {
84
+            $this->container->set('common\interfaces\TimeInterface', function() {
85 85
                 return new \common\components\Time('UTC');
86 86
             });
87 87
             $time = $this->container->get('common\interfaces\TimeInterface');
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
     public function testGetLocalDate()
96 96
     {
97
-        $this->specify('getLocalDate should function correctly', function () {
97
+        $this->specify('getLocalDate should function correctly', function() {
98 98
             expect("getLocalDate should correctly get the user's local date", $this->assertEquals($this->time->getLocalDate(), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d")));
99 99
             expect("getLocalDate should correctly get the local date of a specified timezone", $this->assertEquals($this->time->getLocalDate("UTC"), (new DateTime("now", new DateTimeZone("UTC")))->format("Y-m-d")));
100 100
         });
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
     public function testAlterLocalDate()
104 104
     {
105
-        $this->specify('alterLocalDate should function correctly', function () {
105
+        $this->specify('alterLocalDate should function correctly', function() {
106 106
             expect('alterLocalDate should add one day to the local time', $this->assertEquals($this->time->alterLocalDate('2016-05-01 00:00:00', '+1 day'), (new DateTime("2016-05-01 00:00:00 +1 day"))->format("Y-m-d")));
107 107
             expect('alterLocalDate should subtract one week to the local time and change the year correctly', $this->assertEquals($this->time->alterLocalDate('2016-01-01 04:03:00', '-1 week'), (new DateTime("2016-01-01 04:03:00 -1 week"))->format("Y-m-d")));
108 108
         });
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 
111 111
     public function testGetUTCBookends()
112 112
     {
113
-        $this->specify('getUTCBookends should function correctly', function () {
113
+        $this->specify('getUTCBookends should function correctly', function() {
114 114
             expect('getUTCBookends should return false if there is a space in the time string', $this->assertFalse($this->time->getUTCBookends('2016-05-30 00:00:00')));
115 115
             expect('getUTCBookends should return false if there is a space at the start of the time string', $this->assertFalse($this->time->getUTCBookends(' 2016-05-30 00:00:00')));
116 116
             expect('getUTCBookends should return false if there is a space at the end of the time string', $this->assertFalse($this->time->getUTCBookends('2016-05-30 00:00:00 ')));
117 117
             expect('getUTCBookends should return UTC bookend times from the Los_Angeles tz', $this->assertEquals($this->time->getUTCBookends('2016-05-30'), ['2016-05-30 07:00:00', '2016-05-31 06:59:59']));
118 118
             // with UTC
119
-            $this->container->set('common\interfaces\TimeInterface', function () {
119
+            $this->container->set('common\interfaces\TimeInterface', function() {
120 120
                 return new \common\components\Time('UTC');
121 121
             });
122 122
             $time = $this->container->get('common\interfaces\TimeInterface');
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
         expect('parse should return the default value (false) if the date is not in bounds', $this->assertFalse($observer2->parse('2016-05-05')));
154 154
         expect('parse should return the default value if the date is not in bounds', $this->assertEquals($observer2->now()->format('Y-m-d'), $observer2->parse('2016-05-05', $observer2->now())->format('Y-m-d')));
155 155
 
156
-        $this->specify('should all return false', function () {
156
+        $this->specify('should all return false', function() {
157 157
             expect('parse should return false if the date itself is empty', $this->assertFalse($this->time->parse('')));
158 158
             expect('parse should return false if the date itself is unacceptable or is in an unacceptable format', $this->assertFalse($this->time->parse('aaaa-aa-aa')));
159 159
             expect('parse should return false if the date is not in bounds', $this->assertFalse($this->time->parse('aaaa-aa-aa')));
160 160
             expect('parse should return false if the date itself is nonsensical', $this->assertFalse($this->time->parse('2018-22-44')));
161 161
         });
162 162
 
163
-        $this->specify('should still work fine with other timezones', function () {
163
+        $this->specify('should still work fine with other timezones', function() {
164 164
             $this->time->timezone = 'UTC';
165 165
             $good = new DateTime('2016-05-05', new DateTimeZone('UTC'));
166 166
             expect('parse should accept a String time and verify it is in YYYY-MM-DD format, then return it as a \DateTime', $this->assertEquals($this->time->parse('2016-05-05'), $good));
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
         $tz = 'America/Los_Angeles';
206 206
         $this->time->timezone = 'America/Los_Angeles';
207 207
 
208
-        $today =  new \DateTime("now + 1 day", new \DateTimeZone($tz)); // we do an extra day to include today as the last day
208
+        $today = new \DateTime("now + 1 day", new \DateTimeZone($tz)); // we do an extra day to include today as the last day
209 209
         $should_be_today = $this->time->getDateTimesInPeriod()->getEndDate();
210 210
         expect('getDateTimesInPeriod should return a list of \DatePeriods, the last being for today', $this->assertEquals($today->format('Y-m-d H'), $should_be_today->format('Y-m-d H')));
211 211
 
212
-        $start =  new \DateTime("30 days ago", new \DateTimeZone($tz));
212
+        $start = new \DateTime("30 days ago", new \DateTimeZone($tz));
213 213
         $should_be_start = $this->time->getDateTimesInPeriod()->getStartDate();
214 214
         expect('getDateTimesInPeriod should return a list of \DatePeriods, the first being for 30 days ago (by default)', $this->assertEquals($start->format('Y-m-d H'), $should_be_start->format('Y-m-d H')));
215 215
     }
Please login to merge, or discard this patch.
common/tests/unit/models/UserBehaviorTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     public function setUp(): void
282 282
     {
283 283
         // pull in test data
284
-        $data = require(__DIR__.'/../data/checkinData.php');
284
+        $data = require(__DIR__ . '/../data/checkinData.php');
285 285
         $this->singleBhvr = $data['singleBhvr'];
286 286
         $this->manyBhvrs = $data['manyBhvrs'];
287 287
         $this->allBhvrs = $data['allBhvrs'];
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser');
292 292
         $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion');
293 293
         $this->container->set('common\interfaces\BehaviorInterface', 'common\models\Behavior');
294
-        $this->container->set('common\interfaces\TimeInterface', function () {
294
+        $this->container->set('common\interfaces\TimeInterface', function() {
295 295
             return new \common\components\Time('America/Los_Angeles');
296 296
         });
297 297
 
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
                             ->setMethods(['getIsNewRecord', 'save', 'getBehaviorsWithCounts'])
462 462
                             ->getMock();
463 463
 
464
-        $bhvrs = require(__DIR__.'/../data/behaviorsWithCounts.php');
465
-        $expected = require(__DIR__.'/../data/expected_getCheckinBreakdown.php');
464
+        $bhvrs = require(__DIR__ . '/../data/behaviorsWithCounts.php');
465
+        $expected = require(__DIR__ . '/../data/expected_getCheckinBreakdown.php');
466 466
         $this->user_behavior->method('getBehaviorsWithCounts')->willReturn(...$bhvrs);
467 467
         expect('asdf', $this->assertEquals($expected, $this->user_behavior->getCheckinBreakdown()));
468 468
     }
Please login to merge, or discard this patch.
common/tests/unit/models/LoginFormTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 
112 112
     public function testGetUser()
113 113
     {
114
-        $this->specify('getUser shougd function correctly', function () {
114
+        $this->specify('getUser shougd function correctly', function() {
115 115
             expect('getUser should return the user if the user attr on the form object is already set', $this->assertInstanceOf('\common\models\User', $this->form->getUser()));
116 116
         });
117 117
     }
118 118
 
119 119
     public function testValidatePassword()
120 120
     {
121
-        $this->specify('validatePassword should function correctly', function () {
121
+        $this->specify('validatePassword should function correctly', function() {
122 122
             expect('validatePassword should always return null', $this->assertNull($this->form->validatePassword()));
123 123
             expect('validatePassword should by default in this test class not set errors', $this->assertEmpty($this->form->getErrors()));
124 124
 
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
     }
131 131
     public function testLogin()
132 132
     {
133
-        $this->specify('login should function correctly', function () {
133
+        $this->specify('login should function correctly', function() {
134 134
             $this->form->email = '[email protected]';
135 135
             $this->form->password = 'hunter2';
136 136
             expect('login should return true if able to log in user', $this->assertTrue($this->form->login()));
137 137
         });
138 138
 
139
-        $this->specify('login should fail if account is not verified', function () {
139
+        $this->specify('login should fail if account is not verified', function() {
140 140
             $this->user = $this->mockUser(['isVerified' => false]);
141 141
             $this->form = $this->mockForm($this->user);
142 142
             $this->form->email = '[email protected]';
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             expect('login should set a flash message if account is not verified', $this->assertNotEmpty(Yii::$app->session->getFlash('warning', null, true)));
147 147
         });
148 148
 
149
-        $this->specify('login should fail if credentials are not valid', function () {
149
+        $this->specify('login should fail if credentials are not valid', function() {
150 150
             $this->user = $this->mockUser(['validatePassword' => false]);
151 151
             $this->form = $this->mockForm($this->user);
152 152
             $this->form->email = '[email protected]';
Please login to merge, or discard this patch.
common/tests/unit/models/QuestionTest.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,16 +159,16 @@
 block discarded – undo
159 159
     public function setUp(): void
160 160
     {
161 161
         $this->question = $this->getMockBuilder('\common\models\Question')
162
-         ->setMethods(['save', 'attributes'])
163
-         ->getMock();
162
+          ->setMethods(['save', 'attributes'])
163
+          ->getMock();
164 164
     }
165 165
 
166 166
     public function testParseQuestionData()
167 167
     {
168 168
         $questions = array_map(function ($d) {
169 169
             $q = $this->getMockBuilder('\common\models\Question')
170
-         ->setMethods(['save', 'attributes'])
171
-         ->getMock();
170
+          ->setMethods(['save', 'attributes'])
171
+          ->getMock();
172 172
             $q->method('save')->willReturn(true);
173 173
             $q->method('attributes')
174 174
         ->willReturn([
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
 
166 166
     public function testParseQuestionData()
167 167
     {
168
-        $questions = array_map(function ($d) {
168
+        $questions = array_map(function($d) {
169 169
             $q = $this->getMockBuilder('\common\models\Question')
170 170
          ->setMethods(['save', 'attributes'])
171 171
          ->getMock();
Please login to merge, or discard this patch.