@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | public function actionBlog() |
56 | 56 | { |
57 | 57 | $time = Yii::$container->get(\common\interfaces\TimeInterface::class); |
58 | - $key = "index_blog_".$time->getLocalDate('UTC'); |
|
58 | + $key = "index_blog_" . $time->getLocalDate('UTC'); |
|
59 | 59 | $posts = Yii::$app->cache->get($key); |
60 | - if($posts === false) { |
|
60 | + if ($posts === false) { |
|
61 | 61 | $posts = \Yii::$app->getModule('blog') |
62 | 62 | ->fetch() |
63 | 63 | ->parse() |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | $model = new \site\models\ContactForm(); |
92 | 92 | if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
93 | - if($model->sendEmail(Yii::$app->params['adminEmail'])) { |
|
93 | + if ($model->sendEmail(Yii::$app->params['adminEmail'])) { |
|
94 | 94 | Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.'); |
95 | 95 | } else { |
96 | 96 | Yii::$app->session->setFlash('error', 'There was an error sending email.'); |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | public function actionSignup() |
123 | 123 | { |
124 | 124 | $model = Yii::$container->get(\site\models\SignupForm::class); |
125 | - if($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
125 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
126 | 126 | $model->signup(); |
127 | 127 | Yii::$app->session->setFlash('success', 'We have sent a verification email to the email address you provided. Please check your inbox and follow the instructions to verify your account.'); |
128 | - return $this->redirect('/',302); |
|
128 | + return $this->redirect('/', 302); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return $this->render('signup', [ |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | public function actionRequestPasswordReset() |
137 | 137 | { |
138 | 138 | $model = Yii::$container->get(\site\models\PasswordResetRequestForm::class); |
139 | - if($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
140 | - if(!$model->sendEmail()) { |
|
139 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
140 | + if (!$model->sendEmail()) { |
|
141 | 141 | $ip = Yii::$app->getRequest()->getUserIP() ?: "UNKNOWN"; |
142 | - Yii::warning("$ip has tried to reset the password for ".$model->email); |
|
142 | + Yii::warning("$ip has tried to reset the password for " . $model->email); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | Yii::$app->session->setFlash('success', 'If there is an account with the submitted email address you will receive further instructions in your email inbox.'); |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | throw new BadRequestHttpException("Wrong or expired email verification token. If you aren't sure why this error occurs perhaps you've already verified your account. Please try logging in."); |
184 | 184 | } |
185 | 185 | |
186 | - if($user->isTokenConfirmed($user->verify_email_token)) { |
|
186 | + if ($user->isTokenConfirmed($user->verify_email_token)) { |
|
187 | 187 | Yii::$app->session->setFlash('success', 'Your account has already been verified. Please log in.'); |
188 | - return $this->redirect('/login',302); |
|
188 | + return $this->redirect('/login', 302); |
|
189 | 189 | } else if (Yii::$app->getUser()->login($user)) { |
190 | 190 | $user->confirmVerifyEmailToken(); |
191 | 191 | $user->save(); |
192 | 192 | Yii::$app->session->setFlash('success', 'Your account has been verified. Please continue with your check-in.'); |
193 | - return $this->redirect('/welcome',302); |
|
193 | + return $this->redirect('/welcome', 302); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | if (!empty($this->json)) { |
39 | - foreach($this->json[self::POS_READY] as $json_name => $json_value) { |
|
39 | + foreach ($this->json[self::POS_READY] as $json_name => $json_value) { |
|
40 | 40 | $lines[] = Html::script($json_value, ['type' => 'application/json', 'id' => $json_name]); |
41 | 41 | } |
42 | 42 | } |
@@ -33,8 +33,8 @@ |
||
33 | 33 | { |
34 | 34 | return [ |
35 | 35 | 'error' => [ |
36 | - 'class' => 'yii\web\ErrorAction', |
|
37 | - ], |
|
36 | + 'class' => 'yii\web\ErrorAction', |
|
37 | + ], |
|
38 | 38 | 'captcha' => [ |
39 | 39 | 'class' => 'yii\captcha\CaptchaAction', |
40 | 40 | ], |
@@ -60,10 +60,10 @@ |
||
60 | 60 | */ |
61 | 61 | public function login() |
62 | 62 | { |
63 | - if($this->validate()) { |
|
63 | + if ($this->validate()) { |
|
64 | 64 | $user = $this->getUser(); |
65 | - if($user->isVerified()) { |
|
66 | - return Yii::$app->user->login($user, $this->rememberMe ? 3600 * 24 * 30 : 0); |
|
65 | + if ($user->isVerified()) { |
|
66 | + return Yii::$app->user->login($user, $this->rememberMe ? 3600*24*30 : 0); |
|
67 | 67 | } else { |
68 | 68 | 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.'); |
69 | 69 | } |
@@ -6,22 +6,22 @@ discard block |
||
6 | 6 | use \site\models\EditProfileForm; |
7 | 7 | |
8 | 8 | class EditProfileFormTest extends \Codeception\Test\Unit { |
9 | - public $graph; |
|
10 | - public $values = [ |
|
11 | - 'timezone' => 'America/Los_Angeles', |
|
12 | - 'email_threshold' => 5, |
|
13 | - 'partner_email1' => '[email protected]', |
|
14 | - 'partner_email2' => '[email protected]', |
|
15 | - 'partner_email3' => '[email protected]', |
|
16 | - 'expose_graph' => true, |
|
17 | - ]; |
|
18 | - |
|
19 | - public function setUp() { |
|
20 | - $this->graph = $this->getMockBuilder(common\components\Graph::class) |
|
21 | - ->setMethods(['create', 'destroy']) |
|
22 | - ->getMock(); |
|
23 | - parent::setUp(); |
|
24 | - } |
|
9 | + public $graph; |
|
10 | + public $values = [ |
|
11 | + 'timezone' => 'America/Los_Angeles', |
|
12 | + 'email_threshold' => 5, |
|
13 | + 'partner_email1' => '[email protected]', |
|
14 | + 'partner_email2' => '[email protected]', |
|
15 | + 'partner_email3' => '[email protected]', |
|
16 | + 'expose_graph' => true, |
|
17 | + ]; |
|
18 | + |
|
19 | + public function setUp() { |
|
20 | + $this->graph = $this->getMockBuilder(common\components\Graph::class) |
|
21 | + ->setMethods(['create', 'destroy']) |
|
22 | + ->getMock(); |
|
23 | + parent::setUp(); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | public function testLoadUser() { |
27 | 27 | $user = $this->getUser(); |
@@ -58,37 +58,37 @@ discard block |
||
58 | 58 | |
59 | 59 | $form->attributes = $this->values; |
60 | 60 | expect('saveProfile should return the user', $this->assertEquals($user, $form->saveProfile())); |
61 | - expect('saveProfile should set the user\'s attributes to be the form values', $this->assertEquals($this->values, $user->attributes)); |
|
61 | + expect('saveProfile should set the user\'s attributes to be the form values', $this->assertEquals($this->values, $user->attributes)); |
|
62 | 62 | |
63 | 63 | $form->send_email = 'not_a_boolean'; |
64 | - $ret = $form->saveProfile(); |
|
64 | + $ret = $form->saveProfile(); |
|
65 | 65 | expect('saveProfile should return the user with the partner-related settings equal to null', $this->assertNull($ret)); |
66 | 66 | |
67 | - $null_vals = [ |
|
68 | - 'email_threshold' => null, |
|
69 | - 'partner_email1' => null, |
|
70 | - 'partner_email2' => null, |
|
71 | - 'partner_email3' => null, |
|
72 | - 'timezone' => 'America/Los_Angeles', |
|
73 | - 'expose_graph' => true, |
|
74 | - ]; |
|
67 | + $null_vals = [ |
|
68 | + 'email_threshold' => null, |
|
69 | + 'partner_email1' => null, |
|
70 | + 'partner_email2' => null, |
|
71 | + 'partner_email3' => null, |
|
72 | + 'timezone' => 'America/Los_Angeles', |
|
73 | + 'expose_graph' => true, |
|
74 | + ]; |
|
75 | 75 | $form->send_email = false; |
76 | - $ret = $form->saveProfile(); |
|
76 | + $ret = $form->saveProfile(); |
|
77 | 77 | expect('saveProfile should return the user with the partner-related settings equal to null', $this->assertEquals($null_vals, $user->attributes)); |
78 | 78 | |
79 | - $this->graph |
|
80 | - ->expects($this->once()) |
|
81 | - ->method('destroy'); |
|
82 | - $form->expose_graph = false; |
|
83 | - $ret = $form->saveProfile(); |
|
84 | - expect('if form->expose_graph is set to false, destroy the graph and set user->expose_graph to false', $this->assertFalse($ret->expose_graph)); |
|
85 | - |
|
86 | - $this->graph |
|
87 | - ->expects($this->once()) |
|
88 | - ->method('create'); |
|
89 | - $form->expose_graph = true; |
|
90 | - $ret = $form->saveProfile(); |
|
91 | - expect('if form->expose_graph is set to true, create the graph and set user->expose_graph to true', $this->assertTrue($ret->expose_graph)); |
|
79 | + $this->graph |
|
80 | + ->expects($this->once()) |
|
81 | + ->method('destroy'); |
|
82 | + $form->expose_graph = false; |
|
83 | + $ret = $form->saveProfile(); |
|
84 | + expect('if form->expose_graph is set to false, destroy the graph and set user->expose_graph to false', $this->assertFalse($ret->expose_graph)); |
|
85 | + |
|
86 | + $this->graph |
|
87 | + ->expects($this->once()) |
|
88 | + ->method('create'); |
|
89 | + $form->expose_graph = true; |
|
90 | + $ret = $form->saveProfile(); |
|
91 | + expect('if form->expose_graph is set to true, create the graph and set user->expose_graph to true', $this->assertTrue($ret->expose_graph)); |
|
92 | 92 | |
93 | 93 | $form->send_email = 'not_a_boolean'; |
94 | 94 | expect('saveProfile should return null if the form validation fails', $this->assertNull($form->saveProfile())); |
@@ -52,9 +52,9 @@ |
||
52 | 52 | $form->loadUser(); |
53 | 53 | |
54 | 54 | Yii::$container |
55 | - ->set(\common\components\Graph::class, function () { return $this->graph; }); |
|
55 | + ->set(\common\components\Graph::class, function() { return $this->graph; }); |
|
56 | 56 | Yii::$container |
57 | - ->set(\common\interfaces\UserBehaviorInterface::class, function () { return new FakeUserBehavior(); }); |
|
57 | + ->set(\common\interfaces\UserBehaviorInterface::class, function() { return new FakeUserBehavior(); }); |
|
58 | 58 | |
59 | 59 | $form->attributes = $this->values; |
60 | 60 | expect('saveProfile should return the user', $this->assertEquals($user, $form->saveProfile())); |