Passed
Pull Request — master (#177)
by Corey
05:23
created
site/tests/unit/models/SignupFormTest.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,9 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
   }
Please login to merge, or discard this patch.
site/tests/_support/AcceptanceTester.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 {
21 21
     use _generated\AcceptanceTesterActions;
22 22
 
23
-   /**
24
-    * Define custom actions here
25
-    */
23
+    /**
24
+     * Define custom actions here
25
+     */
26 26
 }
Please login to merge, or discard this patch.
site/tests/_support/MockUser.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
   public $timezone = 'America/Los_Angeles';
8 8
   public $password;
9 9
 
10
- public static function findIdentity($id) {}
11
- public static function findIdentityByAccessToken($token, $type = null) {}
12
- public function getId() {}
13
- public function getAuthKey() {}
14
- public function validateAuthKey($authKey) {}
15
- public function validatePassword($password) {}
16
- public function setPassword($password) {}
10
+  public static function findIdentity($id) {}
11
+  public static function findIdentityByAccessToken($token, $type = null) {}
12
+  public function getId() {}
13
+  public function getAuthKey() {}
14
+  public function validateAuthKey($authKey) {}
15
+  public function validatePassword($password) {}
16
+  public function setPassword($password) {}
17 17
 
18 18
   public static function primaryKey() {}
19 19
   public function attributes() {}
Please login to merge, or discard this patch.
site/tests/_support/FunctionalTester.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 {
21 21
     use _generated\FunctionalTesterActions;
22 22
 
23
-   /**
24
-    * Define custom actions here
25
-    */
23
+    /**
24
+     * Define custom actions here
25
+     */
26 26
 }
Please login to merge, or discard this patch.
site/tests/_support/MockUserBehavior.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
   public static function isPrimaryKey($keys) {}
15 15
   public static function find() {}
16 16
   public static function findOne($condition) {}
17
-  public static function findAll($condition) {return [];}
17
+  public static function findAll($condition) {return []; }
18 18
   public static function updateAll($attributes, $condition = null) {}
19 19
   public static function deleteAll($condition = null) {}
20 20
   public function save($runValidation = true, $attributeNames = null) {}
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,4 +36,4 @@
 block discarded – undo
36 36
   public function getBehaviorsByCategory(array $decorated_behaviors) {}
37 37
   public static function decorate(array $uo) {}
38 38
   public function getBehaviorsWithCounts($limit) {}
39
- }
40 39
\ No newline at end of file
40
+  }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
site/views/partials/posts.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 use \yii\helpers\Html;
3 3
 
4
-foreach($posts as $file) {
4
+foreach ($posts as $file) {
5 5
   $yaml       = $file['yaml'];
6 6
   $content    = $file['content'];
7 7
   $short_name = Html::encode($file['date']['name']);
Please login to merge, or discard this patch.
site/views/layouts/main.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
  */
14 14
 site\assets\AppAsset::register($this);
15 15
 
16
-if($hash = Utility::getRevHash()) {
17
-  $rev_link = '<a href="'.Utility::getGithubRevUrl().'">'.Utility::getRevHash().'</a>';
16
+if ($hash = Utility::getRevHash()) {
17
+  $rev_link = '<a href="' . Utility::getGithubRevUrl() . '">' . Utility::getRevHash() . '</a>';
18 18
 } else $rev_link = 'DEVELOPMENT';
19 19
 
20 20
 ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@
 block discarded – undo
15 15
 
16 16
 if($hash = Utility::getRevHash()) {
17 17
   $rev_link = '<a href="'.Utility::getGithubRevUrl().'">'.Utility::getRevHash().'</a>';
18
-} else $rev_link = 'DEVELOPMENT';
18
+} else {
19
+  $rev_link = 'DEVELOPMENT';
20
+}
19 21
 
20 22
 ?>
21 23
 <?php $this->beginPage() ?>
Please login to merge, or discard this patch.
site/views/checkin/index.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
   print $form
41 41
           ->field($model, "behaviors{$category['id']}")
42 42
           ->checkboxList($behaviors,
43
-                         ['data-toggle' => 'buttons', 'item' => "checkboxItemTemplate"]);
43
+                          ['data-toggle' => 'buttons', 'item' => "checkboxItemTemplate"]);
44 44
 }
45 45
 print Html::submitButton('Submit', ['class' => 'btn btn-success']); 
46 46
 ActiveForm::end();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@  discard block
 block discarded – undo
10 10
 $this->title = "The Faster Scale App | Check-in";
11 11
 
12 12
 function checkboxItemTemplate($index, $label, $name, $checked, $value) {
13
-  return Html::checkbox
14
-    (
13
+  return Html::checkbox(
15 14
       $name,
16 15
       $checked,
17 16
       [
@@ -35,7 +34,7 @@  discard block
 block discarded – undo
35 34
   'options' => ['class' => 'form-horizontal'],
36 35
 ]);
37 36
 
38
-foreach($categories as $category) {
37
+foreach ($categories as $category) {
39 38
   $behaviors = AH::map($behaviorsList[$category['id']], 'id', 'name');
40 39
   print $form
41 40
           ->field($model, "behaviors{$category['id']}")
Please login to merge, or discard this patch.
site/views/checkin/view.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
     print $form
93 93
             ->field($model, "behaviors{$category['id']}")
94 94
             ->checkboxList($behaviors,
95
-                           ['item' => "checkboxItemTemplate"]);
95
+                            ['item' => "checkboxItemTemplate"]);
96 96
   }
97 97
   ActiveForm::end();
98 98
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 $plus_week  = $time->alterLocalDate($actual_date, "+1 week");
28 28
 
29 29
 $pie_data = [];
30
-if($answer_pie) {
30
+if ($answer_pie) {
31 31
   $values     = array_map('intval', array_column($answer_pie, "count"));
32 32
   $labels     = array_column($answer_pie, "name");
33 33
   $colors     = array_column($answer_pie, "color");
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
     </div>
69 69
   </div>
70 70
 
71
-  <?php if($questions) {
72
-  foreach($questions as $behavior_id => $behavior_questions) {
71
+  <?php if ($questions) {
72
+  foreach ($questions as $behavior_id => $behavior_questions) {
73 73
     print "<div class='well well-sm'>";
74 74
     print "<button type='button' class='btn btn-primary' disabled='disabled'>{$behavior_questions['question']['title']}</button>";
75 75
     print "<div class='row'>";
76
-    foreach($behavior_questions['answers'] as $question) { 
76
+    foreach ($behavior_questions['answers'] as $question) { 
77 77
       print "<div class='col-md-4'>";
78 78
       print "<p><strong>{$question['title']}</strong></p>";
79
-      print "<p>".Html::encode($question['answer'])."</p>";
79
+      print "<p>" . Html::encode($question['answer']) . "</p>";
80 80
       print "</div>";
81 81
     }
82 82
     print "</div></div>";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     'options' => ['class' => 'form-horizontal'],
89 89
   ]);
90 90
 
91
-  foreach($categories as $category) {
91
+  foreach ($categories as $category) {
92 92
     $behaviors = AH::map($behaviorsList[$category['id']], 'id', 'name');
93 93
     print $form
94 94
             ->field($model, "behaviors{$category['id']}")
Please login to merge, or discard this patch.