@@ -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 | } |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | $this->container = new \yii\di\Container; |
| 33 | 33 | $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser'); |
| 34 | 34 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
| 35 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
| 35 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
| 36 | 36 | return new \common\components\Time('America/Los_Angeles'); |
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | 39 | // instantiate mock objects |
| 40 | 40 | $user_behavior = $this->container->get(\common\interfaces\UserBehaviorInterface::class); |
| 41 | - $time = $this->container->get(\common\interfaces\TimeInterface::class); |
|
| 41 | + $time = $this->container->get(\common\interfaces\TimeInterface::class); |
|
| 42 | 42 | |
| 43 | 43 | $question = $this->getMockBuilder(\common\models\Question::class) |
| 44 | 44 | ->setMethods(['save', 'attributes']) |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | // set up a side effect to occur when the user's save() function is called |
| 109 | 109 | $saved = false; |
| 110 | - $this->user->method('save')->will($this->returnCallback(function($runValidation=true, $attributeNames=null) use(&$saved) { |
|
| 110 | + $this->user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use(&$saved) { |
|
| 111 | 111 | $saved = true; |
| 112 | 112 | return $this->user; |
| 113 | 113 | })); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | public function testSignupExistingConfirmedUser() { |
| 135 | 135 | $saved = false; |
| 136 | - $this->existing_user->method('save')->will($this->returnCallback(function($runValidation=true, $attributeNames=null) use(&$saved) { |
|
| 136 | + $this->existing_user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use(&$saved) { |
|
| 137 | 137 | $saved = true; |
| 138 | 138 | return $this->existing_user; |
| 139 | 139 | })); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | public function testSignupExistingUnconfirmedUser() { |
| 154 | 154 | $saved = false; |
| 155 | - $this->existing_user->method('save')->will($this->returnCallback(function($runValidation=true, $attributeNames=null) use(&$saved) { |
|
| 155 | + $this->existing_user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use(&$saved) { |
|
| 156 | 156 | $saved = true; |
| 157 | 157 | return $this->existing_user; |
| 158 | 158 | })); |
@@ -183,14 +183,14 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $result = $form->setFields($this->user); |
| 185 | 185 | $this->specify('populate should set the values of the user model from the form', function() use ($result) { |
| 186 | - foreach($this->whitelist as $attr) { |
|
| 186 | + foreach ($this->whitelist as $attr) { |
|
| 187 | 187 | $this->assertEquals($this->vals[$attr], $result->$attr); |
| 188 | 188 | } |
| 189 | 189 | }); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | private function setAttrs($form, Array $vals) { |
| 193 | - foreach($vals as $key => $val) { |
|
| 193 | + foreach ($vals as $key => $val) { |
|
| 194 | 194 | $form->$key = $val; |
| 195 | 195 | } |
| 196 | 196 | return $form; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | private function getForm($user = null) { |
| 214 | - if(is_null($user)) $user = $this->user; |
|
| 214 | + if (is_null($user)) $user = $this->user; |
|
| 215 | 215 | $form = $this->container->get('\site\models\SignupForm', [$user]); |
| 216 | 216 | $form->attributes = $this->vals; // massive assignment |
| 217 | 217 | return $form; |
@@ -20,7 +20,7 @@ |
||
| 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 | } |
@@ -7,13 +7,13 @@ |
||
| 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() {} |
@@ -20,7 +20,7 @@ |
||
| 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 | } |
@@ -14,7 +14,7 @@ |
||
| 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) {} |
@@ -36,4 +36,4 @@ |
||
| 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 |
@@ -1,7 +1,7 @@ |
||
| 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']); |
@@ -13,8 +13,8 @@ |
||
| 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 | ?> |
@@ -15,7 +15,9 @@ |
||
| 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() ?> |
@@ -92,7 +92,7 @@ |
||
| 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 | |
@@ -27,7 +27,7 @@ discard block |
||
| 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 |
||
| 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']['behavior_name']}</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 |
||
| 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']}") |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | $name, |
| 13 | 13 | $checked, |
| 14 | 14 | ['value' => $value, |
| 15 | - 'label' => $label, |
|
| 16 | - 'container' => false, |
|
| 17 | - 'labelOptions' => [ 'class' => $checked |
|
| 15 | + 'label' => $label, |
|
| 16 | + 'container' => false, |
|
| 17 | + 'labelOptions' => [ 'class' => $checked |
|
| 18 | 18 | ? 'btn btn-info active' |
| 19 | 19 | : 'btn btn-info'], |
| 20 | 20 | ]); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | ['value' => $value, |
| 15 | 15 | 'label' => $label, |
| 16 | 16 | 'container' => false, |
| 17 | - 'labelOptions' => [ 'class' => $checked |
|
| 17 | + 'labelOptions' => ['class' => $checked |
|
| 18 | 18 | ? 'btn btn-info active' |
| 19 | 19 | : 'btn btn-info'], |
| 20 | 20 | ]); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | 'id' => 'checkin-form', |
| 33 | 33 | ]); |
| 34 | 34 | |
| 35 | -foreach($categories as $category_id => $category_name) { |
|
| 35 | +foreach ($categories as $category_id => $category_name) { |
|
| 36 | 36 | print $form->field($model, "user_behavior_id{$category_id}")->radioList($behaviors[$category_id], ['class' => "btn-group", 'data-toggle' => 'buttons', 'item'=>"radioItemTemplate"]); |
| 37 | 37 | print $form->field($model, "answer_{$category_id}a")->textarea()->label("How does it affect me? How do I act and feel?"); |
| 38 | 38 | print $form->field($model, "answer_{$category_id}b")->textarea()->label("How does it affect the important people in my life?"); |