Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
e51bf131
Commit
e51bf131
authored
Mar 05, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2620 from AlexGx/apps-codestyle-fix
apps code style fixes
parents
3777ec2b
9c4c8ffb
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
15 additions
and
25 deletions
+15
-25
FixtureHelper.php
apps/advanced/common/tests/_helpers/FixtureHelper.php
+1
-2
LoginPage.php
apps/advanced/common/tests/_pages/LoginPage.php
+0
-1
LoginFormTest.php
apps/advanced/common/tests/unit/models/LoginFormTest.php
+3
-4
SignupPage.php
apps/advanced/frontend/tests/_pages/SignupPage.php
+0
-1
SignupCest.php
apps/advanced/frontend/tests/acceptance/SignupCest.php
+0
-1
SignupCest.php
apps/advanced/frontend/tests/functional/SignupCest.php
+0
-1
ContactFormTest.php
apps/advanced/frontend/tests/unit/models/ContactFormTest.php
+1
-2
PasswordResetRequestFormTest.php
...ontend/tests/unit/models/PasswordResetRequestFormTest.php
+4
-5
ResetPasswordFormTest.php
...nced/frontend/tests/unit/models/ResetPasswordFormTest.php
+4
-5
SignupFormTest.php
apps/advanced/frontend/tests/unit/models/SignupFormTest.php
+2
-3
No files found.
apps/advanced/common/tests/_helpers/FixtureHelper.php
View file @
e51bf131
...
...
@@ -32,7 +32,7 @@ class FixtureHelper extends Module
* to use in acceptance and functional tests.
* @param array $settings
*/
public
function
_beforeSuite
(
$settings
=
array
()
)
public
function
_beforeSuite
(
$settings
=
[]
)
{
$this
->
loadFixtures
();
}
...
...
@@ -54,5 +54,4 @@ class FixtureHelper extends Module
],
];
}
}
apps/advanced/common/tests/_pages/LoginPage.php
View file @
e51bf131
...
...
@@ -18,5 +18,4 @@ class LoginPage extends BasePage
$this
->
guy
->
fillField
(
'input[name="LoginForm[password]"]'
,
$password
);
$this
->
guy
->
click
(
'login-button'
);
}
}
apps/advanced/common/tests/unit/models/LoginFormTest.php
View file @
e51bf131
...
...
@@ -25,7 +25,7 @@ class LoginFormTest extends TestCase
$model
->
username
=
'some_username'
;
$model
->
password
=
'some_password'
;
$this
->
specify
(
'user should not be able to login, when there is no identity'
,
function
()
use
(
$model
)
{
$this
->
specify
(
'user should not be able to login, when there is no identity'
,
function
()
use
(
$model
)
{
expect
(
'model should not login user'
,
$model
->
login
())
->
false
();
expect
(
'user should not be logged in'
,
Yii
::
$app
->
user
->
isGuest
)
->
true
();
});
...
...
@@ -52,7 +52,7 @@ class LoginFormTest extends TestCase
$model
->
username
=
'demo'
;
$model
->
password
=
'demo'
;
$this
->
specify
(
'user should be able to login with correct credentials'
,
function
()
use
(
$model
)
{
$this
->
specify
(
'user should be able to login with correct credentials'
,
function
()
use
(
$model
)
{
expect
(
'model should login user'
,
$model
->
login
())
->
true
();
expect
(
'error message should not be set'
,
$model
->
errors
)
->
hasntKey
(
'password'
);
expect
(
'user should be logged in'
,
Yii
::
$app
->
user
->
isGuest
)
->
false
();
...
...
@@ -61,9 +61,8 @@ class LoginFormTest extends TestCase
private
function
mockUser
(
$user
)
{
$loginForm
=
$this
->
getMock
(
'common\models\LoginForm'
,[
'getUser'
]);
$loginForm
=
$this
->
getMock
(
'common\models\LoginForm'
,
[
'getUser'
]);
$loginForm
->
expects
(
$this
->
any
())
->
method
(
'getUser'
)
->
will
(
$this
->
returnValue
(
$user
));
return
$loginForm
;
}
}
apps/advanced/frontend/tests/_pages/SignupPage.php
View file @
e51bf131
...
...
@@ -20,5 +20,4 @@ class SignupPage extends BasePage
}
$this
->
guy
->
click
(
'signup-button'
);
}
}
apps/advanced/frontend/tests/acceptance/SignupCest.php
View file @
e51bf131
...
...
@@ -79,5 +79,4 @@ class SignupCest
$I
->
expectTo
(
'see that user logged in'
);
$I
->
see
(
'Logout (tester)'
);
}
}
apps/advanced/frontend/tests/functional/SignupCest.php
View file @
e51bf131
...
...
@@ -79,5 +79,4 @@ class SignupCest
$I
->
expectTo
(
'see that user logged in'
);
$I
->
see
(
'Logout (tester)'
);
}
}
apps/advanced/frontend/tests/unit/models/ContactFormTest.php
View file @
e51bf131
...
...
@@ -42,7 +42,7 @@ class ContactFormTest extends TestCase
expect
(
'email file should exist'
,
file_exists
(
$this
->
getMessageFile
()))
->
true
();
});
$this
->
specify
(
'message should contain correct data'
,
function
()
use
(
$model
)
{
$this
->
specify
(
'message should contain correct data'
,
function
()
use
(
$model
)
{
$emailMessage
=
file_get_contents
(
$this
->
getMessageFile
());
expect
(
'email should contain user name'
,
$emailMessage
)
->
contains
(
$model
->
name
);
...
...
@@ -56,5 +56,4 @@ class ContactFormTest extends TestCase
{
return
Yii
::
getAlias
(
Yii
::
$app
->
mail
->
fileTransportPath
)
.
'/testing_message.eml'
;
}
}
apps/advanced/frontend/tests/unit/models/PasswordResetRequestFormTest.php
View file @
e51bf131
...
...
@@ -28,14 +28,14 @@ class PasswordResetRequestFormTest extends DbTestCase
public
function
testSendEmailWrongUser
()
{
$this
->
specify
(
'no user with such email, message should not be send'
,
function
()
{
$this
->
specify
(
'no user with such email, message should not be send'
,
function
()
{
$model
=
new
PasswordResetRequestForm
();
$model
->
email
=
'not-existing-email@example.com'
;
expect
(
'email not send'
,
$model
->
sendEmail
())
->
false
();
});
$this
->
specify
(
'user is not active, message should not be send'
,
function
()
{
$this
->
specify
(
'user is not active, message should not be send'
,
function
()
{
$model
=
new
PasswordResetRequestForm
();
$model
->
email
=
$this
->
user
[
1
][
'email'
];
...
...
@@ -52,8 +52,8 @@ class PasswordResetRequestFormTest extends DbTestCase
expect
(
'email sent'
,
$model
->
sendEmail
())
->
true
();
expect
(
'user has valid token'
,
$user
->
password_reset_token
)
->
notNull
();
$this
->
specify
(
'message has correct format'
,
function
()
use
(
$model
)
{
expect
(
'message file exists'
,
file_exists
(
$this
->
getMessageFile
()))
->
true
();
$this
->
specify
(
'message has correct format'
,
function
()
use
(
$model
)
{
expect
(
'message file exists'
,
file_exists
(
$this
->
getMessageFile
()))
->
true
();
$message
=
file_get_contents
(
$this
->
getMessageFile
());
expect
(
'message "from" is correct'
,
$message
)
->
contains
(
Yii
::
$app
->
params
[
'supportEmail'
]);
...
...
@@ -75,5 +75,4 @@ class PasswordResetRequestFormTest extends DbTestCase
{
return
Yii
::
getAlias
(
Yii
::
$app
->
mail
->
fileTransportPath
)
.
'/testing_message.eml'
;
}
}
apps/advanced/frontend/tests/unit/models/ResetPasswordFormTest.php
View file @
e51bf131
...
...
@@ -13,13 +13,13 @@ class ResetPasswordFormTest extends DbTestCase
public
function
testResetPassword
()
{
$this
->
specify
(
'wrong reset token'
,
function
()
{
$this
->
setExpectedException
(
'\Exception'
,
'Wrong password reset token.'
);
$this
->
specify
(
'wrong reset token'
,
function
()
{
$this
->
setExpectedException
(
'\Exception'
,
'Wrong password reset token.'
);
new
ResetPasswordForm
(
'notexistingtoken_1391882543'
);
});
$this
->
specify
(
'not correct token'
,
function
()
{
$this
->
setExpectedException
(
'yii\base\InvalidParamException'
,
'Password reset token cannot be blank.'
);
$this
->
specify
(
'not correct token'
,
function
()
{
$this
->
setExpectedException
(
'yii\base\InvalidParamException'
,
'Password reset token cannot be blank.'
);
new
ResetPasswordForm
(
''
);
});
}
...
...
@@ -33,5 +33,4 @@ class ResetPasswordFormTest extends DbTestCase
],
];
}
}
apps/advanced/frontend/tests/unit/models/SignupFormTest.php
View file @
e51bf131
...
...
@@ -12,7 +12,7 @@ class SignupFormTest extends DbTestCase
public
function
testCorrectSignup
()
{
$model
=
$this
->
getMock
(
'frontend\models\SignupForm'
,[
'validate'
]);
$model
=
$this
->
getMock
(
'frontend\models\SignupForm'
,
[
'validate'
]);
$model
->
expects
(
$this
->
once
())
->
method
(
'validate'
)
->
will
(
$this
->
returnValue
(
true
));
$model
->
username
=
'some_username'
;
...
...
@@ -28,7 +28,7 @@ class SignupFormTest extends DbTestCase
public
function
testNotCorrectSignup
()
{
$model
=
$this
->
getMock
(
'frontend\models\SignupForm'
,[
'validate'
]);
$model
=
$this
->
getMock
(
'frontend\models\SignupForm'
,
[
'validate'
]);
$model
->
expects
(
$this
->
once
())
->
method
(
'validate'
)
->
will
(
$this
->
returnValue
(
false
));
expect
(
'user should not be created'
,
$model
->
signup
())
->
null
();
...
...
@@ -43,5 +43,4 @@ class SignupFormTest extends DbTestCase
],
];
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment