@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function testDeleteAccount() |
| 28 | 28 | { |
| 29 | - $this->specify('deleteAccount() should return false if the form does not validate', function () { |
|
| 29 | + $this->specify('deleteAccount() should return false if the form does not validate', function() { |
|
| 30 | 30 | $user = $this->getUser(); |
| 31 | 31 | $user |
| 32 | 32 | ->expects($this->never()) |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $this->assertFalse($form->deleteAccount(), 'deleteAccount should not be successful'); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - $this->specify('deleteAccount() should return false if the user\'s password is incorrect', function () { |
|
| 40 | + $this->specify('deleteAccount() should return false if the user\'s password is incorrect', function() { |
|
| 41 | 41 | $user = $this->getUser(); |
| 42 | 42 | $user |
| 43 | 43 | ->expects($this->never()) |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $this->assertFalse($form->deleteAccount(), 'deleteAccount should not be successful'); |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | - $this->specify('deleteAccount() should return true, send a notification email, and delete the user when the form validates and the user\'s password is correct', function () { |
|
| 51 | + $this->specify('deleteAccount() should return true, send a notification email, and delete the user when the form validates and the user\'s password is correct', function() { |
|
| 52 | 52 | $password = 'password'; |
| 53 | 53 | $user = $this->getUser(); |
| 54 | 54 | $user->email = '[email protected]'; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $this->container = new \yii\di\Container; |
| 120 | 120 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
| 121 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
| 121 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
| 122 | 122 | return new \common\components\Time('America/Los_Angeles'); |
| 123 | 123 | }); |
| 124 | 124 | parent::setUp(); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | public function testAttributeLabels() |
| 128 | 128 | { |
| 129 | - $this->specify('attributeLabels should function properly', function () { |
|
| 129 | + $this->specify('attributeLabels should function properly', function() { |
|
| 130 | 130 | $model = $this->container->get('\site\models\CheckinForm'); |
| 131 | 131 | expect('attributeLabels should be correct', $this->assertEquals([ |
| 132 | 132 | 'behaviors1' => 'Restoration', |
@@ -142,32 +142,32 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | public function testSetBehaviors() |
| 144 | 144 | { |
| 145 | - $this->specify('setBehaviors should function properly', function () { |
|
| 145 | + $this->specify('setBehaviors should function properly', function() { |
|
| 146 | 146 | $model = $this->container->get('\site\models\CheckinForm'); |
| 147 | 147 | |
| 148 | 148 | $model->setBehaviors($this->behaviors); |
| 149 | - expect('behaviors1 should be correct', $this->assertEquals([ 0 => 7 ], $model->behaviors1)); |
|
| 150 | - expect('behaviors2 should be correct', $this->assertEquals([ 0 => 12, 1 => 13, 2 => 17, 3 => 18 ], $model->behaviors2)); |
|
| 151 | - expect('behaviors3 should be correct', $this->assertEquals([ 0 => 28, 1 => 38, 2 => 46 ], $model->behaviors3)); |
|
| 152 | - expect('behaviors4 should be correct', $this->assertEquals([ 0 => 47, 1 => 56, 2 => 62 ], $model->behaviors4)); |
|
| 153 | - expect('behaviors5 should be correct', $this->assertEquals([ 0 => 78, 1 => 79 ], $model->behaviors5)); |
|
| 154 | - expect('behaviors6 should be correct', $this->assertEquals([ 0 => 104 ], $model->behaviors6)); |
|
| 155 | - expect('behaviors7 should be correct', $this->assertEquals([ 0 => 128 ], $model->behaviors7)); |
|
| 149 | + expect('behaviors1 should be correct', $this->assertEquals([0 => 7], $model->behaviors1)); |
|
| 150 | + expect('behaviors2 should be correct', $this->assertEquals([0 => 12, 1 => 13, 2 => 17, 3 => 18], $model->behaviors2)); |
|
| 151 | + expect('behaviors3 should be correct', $this->assertEquals([0 => 28, 1 => 38, 2 => 46], $model->behaviors3)); |
|
| 152 | + expect('behaviors4 should be correct', $this->assertEquals([0 => 47, 1 => 56, 2 => 62], $model->behaviors4)); |
|
| 153 | + expect('behaviors5 should be correct', $this->assertEquals([0 => 78, 1 => 79], $model->behaviors5)); |
|
| 154 | + expect('behaviors6 should be correct', $this->assertEquals([0 => 104], $model->behaviors6)); |
|
| 155 | + expect('behaviors7 should be correct', $this->assertEquals([0 => 128], $model->behaviors7)); |
|
| 156 | 156 | |
| 157 | 157 | $model->setBehaviors($this->behaviors); |
| 158 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([ 0 => 7 ], $model->behaviors1)); |
|
| 159 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([ 0 => 12, 1 => 13, 2 => 17, 3 => 18 ], $model->behaviors2)); |
|
| 160 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([ 0 => 28, 1 => 38, 2 => 46 ], $model->behaviors3)); |
|
| 161 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([ 0 => 47, 1 => 56, 2 => 62 ], $model->behaviors4)); |
|
| 162 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([ 0 => 78, 1 => 79 ], $model->behaviors5)); |
|
| 163 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([ 0 => 104 ], $model->behaviors6)); |
|
| 164 | - expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([ 0 => 128 ], $model->behaviors7)); |
|
| 158 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([0 => 7], $model->behaviors1)); |
|
| 159 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([0 => 12, 1 => 13, 2 => 17, 3 => 18], $model->behaviors2)); |
|
| 160 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([0 => 28, 1 => 38, 2 => 46], $model->behaviors3)); |
|
| 161 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([0 => 47, 1 => 56, 2 => 62], $model->behaviors4)); |
|
| 162 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([0 => 78, 1 => 79], $model->behaviors5)); |
|
| 163 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([0 => 104], $model->behaviors6)); |
|
| 164 | + expect('setBehaviors should not append behaviors to existing ones', $this->assertEquals([0 => 128], $model->behaviors7)); |
|
| 165 | 165 | }); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | public function testValidateBehaviors() |
| 169 | 169 | { |
| 170 | - $this->specify('validateBehaviors should function properly', function () { |
|
| 170 | + $this->specify('validateBehaviors should function properly', function() { |
|
| 171 | 171 | $model = $this->container->get('\site\models\CheckinForm'); |
| 172 | 172 | $model->setBehaviors($this->behaviors); |
| 173 | 173 | expect('validation should be good', $this->assertTrue($model->validate())); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $model = $this->container->get('\site\models\CheckinForm'); |
| 217 | 217 | $model->custom_behaviors = []; |
| 218 | - $model->compiled_behaviors = [ 1, 2, 3]; |
|
| 218 | + $model->compiled_behaviors = [1, 2, 3]; |
|
| 219 | 219 | expect('to return an empty array if no custom behaviors are set', $this->assertEquals([], $model->getCustomBehaviors())); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -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::class); |
| 42 | - $time = $this->container->get(\common\interfaces\TimeInterface::class); |
|
| 42 | + $time = $this->container->get(\common\interfaces\TimeInterface::class); |
|
| 43 | 43 | |
| 44 | 44 | $question = $this->getMockBuilder(\common\models\Question::class) |
| 45 | 45 | ->setMethods(['save', 'attributes']) |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | // set up a side effect to occur when the user's save() function is called |
| 113 | 113 | $saved = false; |
| 114 | - $this->user->method('save')->will($this->returnCallback(function ($runValidation=true, $attributeNames=null) use (&$saved) { |
|
| 114 | + $this->user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use (&$saved) { |
|
| 115 | 115 | $saved = true; |
| 116 | 116 | return $this->user; |
| 117 | 117 | })); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | ///////////////////////////////////////////////////////////////////// |
| 122 | 122 | |
| 123 | - $this->specify('a brand-new user should be able to sign up', function () use ($form, &$saved) { |
|
| 123 | + $this->specify('a brand-new user should be able to sign up', function() use ($form, &$saved) { |
|
| 124 | 124 | expect('the form should validate correctly', $this->assertTrue($form->validate())); |
| 125 | 125 | $user = $form->signup(); |
| 126 | 126 | expect( |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function testSignupExistingConfirmedUser() |
| 147 | 147 | { |
| 148 | 148 | $saved = false; |
| 149 | - $this->existing_user->method('save')->will($this->returnCallback(function ($runValidation=true, $attributeNames=null) use (&$saved) { |
|
| 149 | + $this->existing_user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use (&$saved) { |
|
| 150 | 150 | $saved = true; |
| 151 | 151 | return $this->existing_user; |
| 152 | 152 | })); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $this->existing_user->verify_email_token = $this->getValidToken() . "_confirmed"; |
| 156 | 156 | $form2 = $this->getForm(); |
| 157 | 157 | |
| 158 | - $this->specify('an existing and confirmed user should not be signed up', function () use ($form2, &$saved) { |
|
| 158 | + $this->specify('an existing and confirmed user should not be signed up', function() use ($form2, &$saved) { |
|
| 159 | 159 | expect('the form should validate correctly', $this->assertTrue($form2->validate())); |
| 160 | 160 | $user = $form2->signup(); |
| 161 | 161 | expect('when the user exists and is confirmed, signup() should return null', $this->assertNull($user)); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | public function testSignupExistingUnconfirmedUser() |
| 167 | 167 | { |
| 168 | 168 | $saved = false; |
| 169 | - $this->existing_user->method('save')->will($this->returnCallback(function ($runValidation=true, $attributeNames=null) use (&$saved) { |
|
| 169 | + $this->existing_user->method('save')->will($this->returnCallback(function($runValidation = true, $attributeNames = null) use (&$saved) { |
|
| 170 | 170 | $saved = true; |
| 171 | 171 | return $this->existing_user; |
| 172 | 172 | })); |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $this->user->method('findByEmail')->willReturn($this->existing_user); |
| 180 | 180 | $form3 = $this->getForm(); |
| 181 | 181 | |
| 182 | - $this->specify('an existing and unconfirmed user should be able to sign up again, but their information will be UPDATED', function () use ($form3, &$saved) { |
|
| 182 | + $this->specify('an existing and unconfirmed user should be able to sign up again, but their information will be UPDATED', function() use ($form3, &$saved) { |
|
| 183 | 183 | expect('the form should validate correctly', $this->assertTrue($form3->validate())); |
| 184 | 184 | $user = $form3->signup(); |
| 185 | 185 | expect('This user should not be an isNewRecord -- they should already exist', $this->assertFalse($user->getIsNewRecord())); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $form = $this->setAttrs($form, $this->vals); |
| 200 | 200 | |
| 201 | 201 | $result = $form->setFields($this->user); |
| 202 | - $this->specify('populate should set the values of the user model from the form', function () use ($result) { |
|
| 202 | + $this->specify('populate should set the values of the user model from the form', function() use ($result) { |
|
| 203 | 203 | foreach ($this->whitelist as $attr) { |
| 204 | 204 | $this->assertEquals($this->vals[$attr], $result->$attr); |
| 205 | 205 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | 'id' => 'form-signup', |
| 28 | 28 | 'enableClientValidation' => true, |
| 29 | 29 | 'enableAjaxValidation' => false, |
| 30 | - 'options' => [ 'validateOnSubmit' => true ] |
|
| 30 | + 'options' => ['validateOnSubmit' => true] |
|
| 31 | 31 | ]); ?> |
| 32 | 32 | <?= $form->field($model, 'email', ['inputTemplate' => '<div class="input-group"><span class="input-group-addon">@</span>{input}</div>'])->input('email') ?> |
| 33 | 33 | <?= $form->field($model, 'password', ['inputTemplate' => '<div class="input-group">{input}<span class="input-group-btn"><button id="password-toggle" class="btn btn-default" type="button">Show</button></span></div>'])->passwordInput() ?> |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | site\assets\AppAsset::register($this); |
| 15 | 15 | |
| 16 | 16 | if ($hash = Utility::getRevHash()) { |
| 17 | - $rev_link = '<a href="'.Utility::getGithubRevUrl().'">'.Utility::getRevHash().'</a>'; |
|
| 17 | + $rev_link = '<a href="' . Utility::getGithubRevUrl() . '">' . Utility::getRevHash() . '</a>'; |
|
| 18 | 18 | } else { |
| 19 | 19 | $rev_link = 'DEVELOPMENT'; |
| 20 | 20 | } |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | foreach ($behavior_questions['answers'] as $question) { |
| 80 | 80 | print "<div class='col-md-4'>"; |
| 81 | 81 | print "<p><strong>{$question['title']}</strong></p>"; |
| 82 | - print "<p>".Html::encode($question['answer'])."</p>"; |
|
| 82 | + print "<p>" . Html::encode($question['answer']) . "</p>"; |
|
| 83 | 83 | print "</div>"; |
| 84 | 84 | } |
| 85 | 85 | print "</div></div>"; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $behaviors = AH::map($behaviorsList[$category['id']], 'id', 'name'); |
| 41 | 41 | $custom = []; |
| 42 | 42 | if (array_key_exists($category['id'], $customList)) { |
| 43 | - $custom = AH::map($customList[$category['id']], function ($cbhvr) { |
|
| 43 | + $custom = AH::map($customList[$category['id']], function($cbhvr) { |
|
| 44 | 44 | return $cbhvr['id'] . '-custom'; |
| 45 | 45 | }, 'name'); |
| 46 | 46 | } |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | </tr> |
| 29 | 29 | <?php foreach ($top_behaviors as $key => $row) { |
| 30 | 30 | $num = $key + 1; |
| 31 | - print "<tr>". |
|
| 32 | - "<td>{$row['count']}</td>". |
|
| 33 | - "<td>{$row['behavior']['name']}</td>". |
|
| 34 | - "<td>{$row['category']['name']}</td>". |
|
| 31 | + print "<tr>" . |
|
| 32 | + "<td>{$row['count']}</td>" . |
|
| 33 | + "<td>{$row['behavior']['name']}</td>" . |
|
| 34 | + "<td>{$row['category']['name']}</td>" . |
|
| 35 | 35 | "</tr>"; |
| 36 | 36 | } |
| 37 | 37 | ?> |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | $name, |
| 15 | 15 | $checked, |
| 16 | 16 | ['value' => $value, |
| 17 | - 'label' => $label, |
|
| 18 | - 'container' => false, |
|
| 19 | - 'labelOptions' => [ 'class' => $checked |
|
| 17 | + 'label' => $label, |
|
| 18 | + 'container' => false, |
|
| 19 | + 'labelOptions' => [ 'class' => $checked |
|
| 20 | 20 | ? 'btn btn-info active' |
| 21 | 21 | : 'btn btn-info'], |
| 22 | 22 | ] |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | ['value' => $value, |
| 17 | 17 | 'label' => $label, |
| 18 | 18 | 'container' => false, |
| 19 | - 'labelOptions' => [ 'class' => $checked |
|
| 19 | + 'labelOptions' => ['class' => $checked |
|
| 20 | 20 | ? 'btn btn-info active' |
| 21 | 21 | : 'btn btn-info'], |
| 22 | 22 | ] |