@@ -163,12 +163,12 @@ |
||
| 163 | 163 | foreach ($this->behaviorToAnswers($behavior_id) as $answer_letter => $answer) { |
| 164 | 164 | $question_id = \common\models\Question::$TYPES[$answer_letter]; |
| 165 | 165 | array_push($answers, [ |
| 166 | - 'behavior_id' => $user_bhvr->behavior_id, |
|
| 167 | - 'category_id' => $user_bhvr->category_id, |
|
| 168 | - 'user_bhvr_id' => $user_bhvr->id, |
|
| 169 | - 'question_id' => $question_id, |
|
| 170 | - 'answer' => $answer, |
|
| 171 | - ]); |
|
| 166 | + 'behavior_id' => $user_bhvr->behavior_id, |
|
| 167 | + 'category_id' => $user_bhvr->category_id, |
|
| 168 | + 'user_bhvr_id' => $user_bhvr->id, |
|
| 169 | + 'question_id' => $question_id, |
|
| 170 | + 'answer' => $answer, |
|
| 171 | + ]); |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | return $answers; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $config = [] |
| 56 | 56 | ) |
| 57 | 57 | { |
| 58 | - $this->question = $question; |
|
| 58 | + $this->question = $question; |
|
| 59 | 59 | parent::__construct($config); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | 'whenClient' => "function(attribute, value) { return false; }", // lame, but acceptable |
| 74 | 74 | "message" => "You must select a behavior your responses apply to."], |
| 75 | 75 | |
| 76 | - [['answer_1a','answer_1b','answer_1c','answer_2a','answer_2b','answer_2c','answer_3a','answer_3b','answer_3c','answer_4a','answer_4b','answer_4c','answer_5a', 'answer_5b','answer_5c','answer_6a', 'answer_6b','answer_6c','answer_7a','answer_7b','answer_7c'], 'safe'] |
|
| 76 | + [['answer_1a', 'answer_1b', 'answer_1c', 'answer_2a', 'answer_2b', 'answer_2c', 'answer_3a', 'answer_3b', 'answer_3c', 'answer_4a', 'answer_4b', 'answer_4c', 'answer_5a', 'answer_5b', 'answer_5c', 'answer_6a', 'answer_6b', 'answer_6c', 'answer_7a', 'answer_7b', 'answer_7c'], 'safe'] |
|
| 77 | 77 | ]; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function getBhvrValidator() |
| 94 | 94 | { |
| 95 | - return function ($model, $attr) { |
|
| 96 | - $attrNum = $attr[strlen($attr)-1]; |
|
| 95 | + return function($model, $attr) { |
|
| 96 | + $attrNum = $attr[strlen($attr) - 1]; |
|
| 97 | 97 | foreach (['a', 'b', 'c'] as $l) { |
| 98 | 98 | $attr = "answer_{$attrNum}{$l}"; |
| 99 | 99 | if ($model->$attr) { |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | public function behaviorToAnswers($bhvr_number) |
| 125 | 125 | { |
| 126 | 126 | $prop_names = array_keys($this->getPrefixProps("answer_$bhvr_number")); |
| 127 | - $prop_letters = array_map(function ($n) { |
|
| 127 | + $prop_letters = array_map(function($n) { |
|
| 128 | 128 | return substr($n, -1, 1); |
| 129 | 129 | }, $prop_names); |
| 130 | - $answers = array_map(function ($n) { |
|
| 130 | + $answers = array_map(function($n) { |
|
| 131 | 131 | return $this->$n; |
| 132 | 132 | }, $prop_names); |
| 133 | 133 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | public function getPrefixProps($prefix) |
| 138 | 138 | { |
| 139 | - return array_filter(get_object_vars($this), function ($v, $k) use ($prefix) { |
|
| 139 | + return array_filter(get_object_vars($this), function($v, $k) use ($prefix) { |
|
| 140 | 140 | if (strpos($k, $prefix) === 0 && strlen($v)) { |
| 141 | 141 | return true; |
| 142 | 142 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | ['email', 'filter', 'filter' => 'strtolower'], |
| 30 | 30 | ['email', 'email'], |
| 31 | 31 | // verifyCode needs to be entered correctly |
| 32 | - ['verifyCode', 'captcha', 'when' => function () { |
|
| 32 | + ['verifyCode', 'captcha', 'when' => function() { |
|
| 33 | 33 | return Yii::$app->user->isGuest; |
| 34 | 34 | }, 'skipOnEmpty' => !!YII_ENV_TEST], |
| 35 | 35 | ]; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return Yii::$app->mailer->compose() |
| 58 | 58 | ->setTo($email) |
| 59 | 59 | ->setFrom([$this->email => $this->name]) |
| 60 | - ->setSubject("[FSA Contact] ".$this->subject) |
|
| 60 | + ->setSubject("[FSA Contact] " . $this->subject) |
|
| 61 | 61 | ->setTextBody($this->body) |
| 62 | 62 | ->send(); |
| 63 | 63 | } |
@@ -101,10 +101,10 @@ |
||
| 101 | 101 | $model->answer_2c = 'answering question c'; |
| 102 | 102 | |
| 103 | 103 | expect('behaviorToAnswers should return the answer properties related to the behavior number supplied', $this->assertEquals($model->behaviorToAnswers(1), [ |
| 104 | - 'a' => 'answering question a', |
|
| 105 | - 'b' => 'answering question b', |
|
| 106 | - 'c' => 'answering question c' |
|
| 107 | - ])); |
|
| 104 | + 'a' => 'answering question a', |
|
| 105 | + 'b' => 'answering question b', |
|
| 106 | + 'c' => 'answering question c' |
|
| 107 | + ])); |
|
| 108 | 108 | |
| 109 | 109 | expect('behaviorToAnswers should return the the empty set when there are no answers associated with the supplied behavior number', $this->assertEmpty($model->behaviorToAnswers(7))); |
| 110 | 110 | }); |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser'); |
| 19 | 19 | $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior'); |
| 20 | 20 | $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion'); |
| 21 | - $this->container->set('common\interfaces\TimeInterface', function () { |
|
| 21 | + $this->container->set('common\interfaces\TimeInterface', function() { |
|
| 22 | 22 | return new \common\components\Time('America/Los_Angeles'); |
| 23 | 23 | }); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function testAttributeLabels() |
| 27 | 27 | { |
| 28 | - $this->specify('setBehaviors should function properly', function () { |
|
| 28 | + $this->specify('setBehaviors should function properly', function() { |
|
| 29 | 29 | $model = $this->container->get('\site\models\QuestionForm'); |
| 30 | 30 | expect('attributeLabels should be correct', $this->assertEquals($model->attributeLabels(), [ |
| 31 | 31 | 'user_behavior_id1' => 'Restoration', |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $model = $this->container->get('\site\models\QuestionForm'); |
| 45 | 45 | $validator = $model->getBhvrValidator(); |
| 46 | 46 | |
| 47 | - $this->specify('getBhvrValidator should function properly', function () use ($model, $validator) { |
|
| 47 | + $this->specify('getBhvrValidator should function properly', function() use ($model, $validator) { |
|
| 48 | 48 | expect('getBhvrValidator should return false when nothing is set on the form', $this->assertFalse($validator($model, "user_behavior_id1"))); |
| 49 | 49 | expect('getBhvrValidator should return false when nothing is set on the form', $this->assertFalse($validator($model, "user_behavior_id7"))); |
| 50 | 50 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $model = $this->container->get('\site\models\QuestionForm'); |
| 67 | 67 | |
| 68 | - $this->specify('getPrefixProps should function properly', function () use ($model) { |
|
| 68 | + $this->specify('getPrefixProps should function properly', function() use ($model) { |
|
| 69 | 69 | expect('getPrefixProps should strip out all the falsy propeties it finds', $this->assertEmpty($model->getPrefixProps('answer'))); |
| 70 | 70 | |
| 71 | 71 | $model->answer_1a = 'processing emotions'; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function testBehaviorToAnswers() |
| 92 | 92 | { |
| 93 | - $this->specify('behaviorToAnswers should function properly', function () { |
|
| 93 | + $this->specify('behaviorToAnswers should function properly', function() { |
|
| 94 | 94 | $model = $this->container->get('\site\models\QuestionForm'); |
| 95 | 95 | $model->answer_1a = 'answering question a'; |
| 96 | 96 | $model->answer_1b = 'answering question b'; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $model = $this->container->get('\site\models\QuestionForm'); |
| 116 | 116 | |
| 117 | - $this->specify('getAnswers should function properly', function () use ($model) { |
|
| 117 | + $this->specify('getAnswers should function properly', function() use ($model) { |
|
| 118 | 118 | $model->user_behavior_id1 = 'dummy'; |
| 119 | 119 | $model->user_behavior_id2 = 'dummy'; |
| 120 | 120 | $model->user_behavior_id3 = 'dummy'; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $this->fakeModel(7, 280, 8), |
| 133 | 133 | $this->fakeModel(13, 281, 8), |
| 134 | 134 | $this->fakeModel(28, 284, 8) |
| 135 | - ]), [ [ |
|
| 135 | + ]), [[ |
|
| 136 | 136 | 'behavior_id' => 280, |
| 137 | 137 | 'category_id' => 8, |
| 138 | 138 | 'user_bhvr_id' => 7, |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function testChangeEmail() |
| 26 | 26 | { |
| 27 | - $this->specify('changeEmail() should return true and do nothing when the email is already taken', function () { |
|
| 27 | + $this->specify('changeEmail() should return true and do nothing when the email is already taken', function() { |
|
| 28 | 28 | $user = $this->getUser(); |
| 29 | 29 | $user |
| 30 | 30 | ->expects($this->never()) |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->assertNotEquals($user->desired_email, $desired_email); |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | - $this->specify('changeEmail() should return true, set values, and send an email when the email is available', function () { |
|
| 44 | + $this->specify('changeEmail() should return true, set values, and send an email when the email is available', function() { |
|
| 45 | 45 | $user = $this->getUser(); |
| 46 | 46 | $desired_email = '[email protected]'; |
| 47 | 47 | $user |
@@ -57,15 +57,15 @@ |
||
| 57 | 57 | |
| 58 | 58 | // Set up dependency injections |
| 59 | 59 | Yii::$container |
| 60 | - ->set(\common\interfaces\TimeInterface::class, function () { |
|
| 60 | + ->set(\common\interfaces\TimeInterface::class, function() { |
|
| 61 | 61 | return new \common\components\Time('UTC'); |
| 62 | 62 | }); |
| 63 | 63 | Yii::$container |
| 64 | - ->set(\common\components\Graph::class, function () { |
|
| 64 | + ->set(\common\components\Graph::class, function() { |
|
| 65 | 65 | return $this->graph; |
| 66 | 66 | }); |
| 67 | 67 | Yii::$container |
| 68 | - ->set(\common\interfaces\UserBehaviorInterface::class, function () { |
|
| 68 | + ->set(\common\interfaces\UserBehaviorInterface::class, function() { |
|
| 69 | 69 | return new FakeUserBehavior(); |
| 70 | 70 | }); |
| 71 | 71 | |
@@ -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() ?> |