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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
34db2d20
Commit
34db2d20
authored
Mar 08, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2652 from Theill11/fix-test-breaks
Update advanced app tests
parents
1af04e1e
95e01899
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
82 additions
and
76 deletions
+82
-76
LoginCept.php
apps/advanced/backend/tests/acceptance/LoginCept.php
+11
-9
LoginCept.php
apps/advanced/backend/tests/functional/LoginCept.php
+6
-9
ContactCept.php
apps/advanced/frontend/tests/acceptance/ContactCept.php
+10
-10
LoginCept.php
apps/advanced/frontend/tests/acceptance/LoginCept.php
+11
-9
SignupCest.php
apps/advanced/frontend/tests/acceptance/SignupCest.php
+9
-9
ContactCept.php
apps/advanced/frontend/tests/functional/ContactCept.php
+10
-10
LoginCept.php
apps/advanced/frontend/tests/functional/LoginCept.php
+6
-9
SignupCest.php
apps/advanced/frontend/tests/functional/SignupCest.php
+16
-8
ContactFormTest.php
apps/advanced/frontend/tests/unit/models/ContactFormTest.php
+3
-3
No files found.
apps/advanced/backend/tests/acceptance/LoginCept.php
View file @
34db2d20
...
...
@@ -10,21 +10,23 @@ $loginPage = LoginPage::openBy($I);
$I
->
amGoingTo
(
'submit login form with no data'
);
$loginPage
->
login
(
''
,
''
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Username cannot be blank.'
);
$I
->
see
(
'Password cannot be blank.'
);
$I
->
see
(
'Username cannot be blank.'
,
'.help-block'
);
$I
->
see
(
'Password cannot be blank.'
,
'.help-block'
);
$I
->
amGoingTo
(
'try to login with wrong credentials'
);
$I
->
expectTo
(
'see validations errors'
);
$loginPage
->
login
(
'admin'
,
'wrong'
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Incorrect username or password.'
);
$I
->
see
(
'Incorrect username or password.'
,
'.help-block'
);
$I
->
amGoingTo
(
'try to login with correct credentials'
);
$loginPage
->
login
(
'erau'
,
'password_0'
);
$I
->
expectTo
(
'see that user is logged'
);
$I
->
see
(
'Logout (erau)'
);
$I
->
dontSee
(
'Login'
);
$I
->
dontSee
(
'Signup'
);
$I
->
click
(
'Logout (erau)'
);
$I
->
dontSee
(
'Logout (erau)'
);
$I
->
see
(
'Login'
);
$I
->
seeLink
(
'Logout (erau)'
);
$I
->
dontSeeLink
(
'Login'
);
$I
->
dontSeeLink
(
'Signup'
);
/** Uncomment if using WebDriver
* $I->click('Logout (erau)');
* $I->dontSeeLink('Logout (erau)');
* $I->seeLink('Login');
*/
apps/advanced/backend/tests/functional/LoginCept.php
View file @
34db2d20
...
...
@@ -10,21 +10,18 @@ $loginPage = LoginPage::openBy($I);
$I
->
amGoingTo
(
'submit login form with no data'
);
$loginPage
->
login
(
''
,
''
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Username cannot be blank.'
);
$I
->
see
(
'Password cannot be blank.'
);
$I
->
see
(
'Username cannot be blank.'
,
'.help-block'
);
$I
->
see
(
'Password cannot be blank.'
,
'.help-block'
);
$I
->
amGoingTo
(
'try to login with wrong credentials'
);
$I
->
expectTo
(
'see validations errors'
);
$loginPage
->
login
(
'admin'
,
'wrong'
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Incorrect username or password.'
);
$I
->
see
(
'Incorrect username or password.'
,
'.help-block'
);
$I
->
amGoingTo
(
'try to login with correct credentials'
);
$loginPage
->
login
(
'erau'
,
'password_0'
);
$I
->
expectTo
(
'see that user is logged'
);
$I
->
see
(
'Logout (erau)'
);
$I
->
dontSee
(
'Login'
);
$I
->
dontSee
(
'Signup'
);
$I
->
click
(
'Logout (erau)'
);
$I
->
dontSee
(
'Logout (erau)'
);
$I
->
see
(
'Login'
);
$I
->
seeLink
(
'Logout (erau)'
);
$I
->
dontSeeLink
(
'Login'
);
$I
->
dontSeeLink
(
'Signup'
);
apps/advanced/frontend/tests/acceptance/ContactCept.php
View file @
34db2d20
...
...
@@ -13,11 +13,11 @@ $I->amGoingTo('submit contact form with no data');
$contactPage
->
submit
([]);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
see
(
'Name cannot be blank'
);
$I
->
see
(
'Email cannot be blank'
);
$I
->
see
(
'Subject cannot be blank'
);
$I
->
see
(
'Body cannot be blank'
);
$I
->
see
(
'The verification code is incorrect'
);
$I
->
see
(
'Name cannot be blank'
,
'.help-block'
);
$I
->
see
(
'Email cannot be blank'
,
'.help-block'
);
$I
->
see
(
'Subject cannot be blank'
,
'.help-block'
);
$I
->
see
(
'Body cannot be blank'
,
'.help-block'
);
$I
->
see
(
'The verification code is incorrect'
,
'.help-block'
);
$I
->
amGoingTo
(
'submit contact form with not correct email'
);
$contactPage
->
submit
([
...
...
@@ -28,11 +28,11 @@ $contactPage->submit([
'verifyCode'
=>
'testme'
,
]);
$I
->
expectTo
(
'see that email adress is wrong'
);
$I
->
dontSee
(
'Name cannot be blank'
,
'.help-
inline
'
);
$I
->
see
(
'Email is not a valid email address.'
);
$I
->
dontSee
(
'Subject cannot be blank'
,
'.help-
inline
'
);
$I
->
dontSee
(
'Body cannot be blank'
,
'.help-
inline
'
);
$I
->
dontSee
(
'The verification code is incorrect'
,
'.help-
inline
'
);
$I
->
dontSee
(
'Name cannot be blank'
,
'.help-
block
'
);
$I
->
see
(
'Email is not a valid email address.'
,
'.help-block'
);
$I
->
dontSee
(
'Subject cannot be blank'
,
'.help-
block
'
);
$I
->
dontSee
(
'Body cannot be blank'
,
'.help-
block
'
);
$I
->
dontSee
(
'The verification code is incorrect'
,
'.help-
block
'
);
$I
->
amGoingTo
(
'submit contact form with correct data'
);
$contactPage
->
submit
([
...
...
apps/advanced/frontend/tests/acceptance/LoginCept.php
View file @
34db2d20
...
...
@@ -10,21 +10,23 @@ $loginPage = LoginPage::openBy($I);
$I
->
amGoingTo
(
'submit login form with no data'
);
$loginPage
->
login
(
''
,
''
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Username cannot be blank.'
);
$I
->
see
(
'Password cannot be blank.'
);
$I
->
see
(
'Username cannot be blank.'
,
'.help-block'
);
$I
->
see
(
'Password cannot be blank.'
,
'.help-block'
);
$I
->
amGoingTo
(
'try to login with wrong credentials'
);
$I
->
expectTo
(
'see validations errors'
);
$loginPage
->
login
(
'admin'
,
'wrong'
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Incorrect username or password.'
);
$I
->
see
(
'Incorrect username or password.'
,
'.help-block'
);
$I
->
amGoingTo
(
'try to login with correct credentials'
);
$loginPage
->
login
(
'erau'
,
'password_0'
);
$I
->
expectTo
(
'see that user is logged'
);
$I
->
see
(
'Logout (erau)'
);
$I
->
dontSee
(
'Login'
);
$I
->
dontSee
(
'Signup'
);
$I
->
click
(
'Logout (erau)'
);
$I
->
dontSee
(
'Logout (erau)'
);
$I
->
see
(
'Login'
);
$I
->
seeLink
(
'Logout (erau)'
);
$I
->
dontSeeLink
(
'Login'
);
$I
->
dontSeeLink
(
'Signup'
);
/** Uncomment if using WebDriver
* $I->click('Logout (erau)');
* $I->dontSeeLink('Logout (erau)');
* $I->seeLink('Login');
*/
apps/advanced/frontend/tests/acceptance/SignupCest.php
View file @
34db2d20
...
...
@@ -9,7 +9,7 @@ class SignupCest
{
/**
* This method is called
after
each cest class test method
* This method is called
before
each cest class test method
* @param \Codeception\Event\Test $event
*/
public
function
_before
(
$event
)
...
...
@@ -37,7 +37,6 @@ class SignupCest
}
/**
*
* @param \WebGuy $I
* @param \Codeception\Scenario $scenario
*/
...
...
@@ -46,6 +45,7 @@ class SignupCest
$I
->
wantTo
(
'ensure that signup works'
);
$signupPage
=
SignupPage
::
openBy
(
$I
);
$I
->
see
(
'Signup'
,
'h1'
);
$I
->
see
(
'Please fill out the following fields to signup:'
);
$I
->
amGoingTo
(
'submit signup form with no data'
);
...
...
@@ -53,9 +53,9 @@ class SignupCest
$signupPage
->
submit
([]);
$I
->
expectTo
(
'see validation errors'
);
$I
->
see
(
'Username cannot be blank.'
);
$I
->
see
(
'Email cannot be blank.'
);
$I
->
see
(
'Password cannot be blank.'
);
$I
->
see
(
'Username cannot be blank.'
,
'.help-block'
);
$I
->
see
(
'Email cannot be blank.'
,
'.help-block'
);
$I
->
see
(
'Password cannot be blank.'
,
'.help-block'
);
$I
->
amGoingTo
(
'submit signup form with not correct email'
);
$signupPage
->
submit
([
...
...
@@ -64,9 +64,9 @@ class SignupCest
'password'
=>
'tester_password'
,
]);
$I
->
expectTo
(
'see that email adress is wrong'
);
$I
->
dontSee
(
'Username cannot be blank.'
,
'.help-
inline
'
);
$I
->
dontSee
(
'Password cannot be blank.'
,
'.help-
inline
'
);
$I
->
expectTo
(
'see that email ad
d
ress is wrong'
);
$I
->
dontSee
(
'Username cannot be blank.'
,
'.help-
block
'
);
$I
->
dontSee
(
'Password cannot be blank.'
,
'.help-
block
'
);
$I
->
see
(
'Email is not a valid email address.'
,
'.help-block'
);
$I
->
amGoingTo
(
'submit signup form with correct email'
);
...
...
@@ -77,6 +77,6 @@ class SignupCest
]);
$I
->
expectTo
(
'see that user logged in'
);
$I
->
see
(
'Logout (tester)'
);
$I
->
see
Link
(
'Logout (tester)'
);
}
}
apps/advanced/frontend/tests/functional/ContactCept.php
View file @
34db2d20
...
...
@@ -13,11 +13,11 @@ $I->amGoingTo('submit contact form with no data');
$contactPage
->
submit
([]);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
see
(
'Name cannot be blank'
);
$I
->
see
(
'Email cannot be blank'
);
$I
->
see
(
'Subject cannot be blank'
);
$I
->
see
(
'Body cannot be blank'
);
$I
->
see
(
'The verification code is incorrect'
);
$I
->
see
(
'Name cannot be blank'
,
'.help-block'
);
$I
->
see
(
'Email cannot be blank'
,
'.help-block'
);
$I
->
see
(
'Subject cannot be blank'
,
'.help-block'
);
$I
->
see
(
'Body cannot be blank'
,
'.help-block'
);
$I
->
see
(
'The verification code is incorrect'
,
'.help-block'
);
$I
->
amGoingTo
(
'submit contact form with not correct email'
);
$contactPage
->
submit
([
...
...
@@ -28,11 +28,11 @@ $contactPage->submit([
'verifyCode'
=>
'testme'
,
]);
$I
->
expectTo
(
'see that email adress is wrong'
);
$I
->
dontSee
(
'Name cannot be blank'
,
'.help-
inline
'
);
$I
->
see
(
'Email is not a valid email address.'
);
$I
->
dontSee
(
'Subject cannot be blank'
,
'.help-
inline
'
);
$I
->
dontSee
(
'Body cannot be blank'
,
'.help-
inline
'
);
$I
->
dontSee
(
'The verification code is incorrect'
,
'.help-
inline
'
);
$I
->
dontSee
(
'Name cannot be blank'
,
'.help-
block
'
);
$I
->
see
(
'Email is not a valid email address.'
,
'.help-block'
);
$I
->
dontSee
(
'Subject cannot be blank'
,
'.help-
block
'
);
$I
->
dontSee
(
'Body cannot be blank'
,
'.help-
block
'
);
$I
->
dontSee
(
'The verification code is incorrect'
,
'.help-
block
'
);
$I
->
amGoingTo
(
'submit contact form with correct data'
);
$contactPage
->
submit
([
...
...
apps/advanced/frontend/tests/functional/LoginCept.php
View file @
34db2d20
...
...
@@ -10,21 +10,18 @@ $loginPage = LoginPage::openBy($I);
$I
->
amGoingTo
(
'submit login form with no data'
);
$loginPage
->
login
(
''
,
''
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Username cannot be blank.'
);
$I
->
see
(
'Password cannot be blank.'
);
$I
->
see
(
'Username cannot be blank.'
,
'.help-block'
);
$I
->
see
(
'Password cannot be blank.'
,
'.help-block'
);
$I
->
amGoingTo
(
'try to login with wrong credentials'
);
$I
->
expectTo
(
'see validations errors'
);
$loginPage
->
login
(
'admin'
,
'wrong'
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Incorrect username or password.'
);
$I
->
see
(
'Incorrect username or password.'
,
'.help-block'
);
$I
->
amGoingTo
(
'try to login with correct credentials'
);
$loginPage
->
login
(
'erau'
,
'password_0'
);
$I
->
expectTo
(
'see that user is logged'
);
$I
->
see
(
'Logout (erau)'
);
$I
->
dontSee
(
'Login'
);
$I
->
dontSee
(
'Signup'
);
$I
->
click
(
'Logout (erau)'
);
$I
->
dontSee
(
'Logout (erau)'
);
$I
->
see
(
'Login'
);
$I
->
seeLink
(
'Logout (erau)'
);
$I
->
dontSeeLink
(
'Login'
);
$I
->
dontSeeLink
(
'Signup'
);
apps/advanced/frontend/tests/functional/SignupCest.php
View file @
34db2d20
...
...
@@ -9,7 +9,7 @@ class SignupCest
{
/**
* This method is called
after
each cest class test method
* This method is called
before
each cest class test method
* @param \Codeception\Event\Test $event
*/
public
function
_before
(
$event
)
...
...
@@ -34,6 +34,7 @@ class SignupCest
*/
public
function
_fail
(
$event
)
{
}
/**
...
...
@@ -46,6 +47,7 @@ class SignupCest
$I
->
wantTo
(
'ensure that signup works'
);
$signupPage
=
SignupPage
::
openBy
(
$I
);
$I
->
see
(
'Signup'
,
'h1'
);
$I
->
see
(
'Please fill out the following fields to signup:'
);
$I
->
amGoingTo
(
'submit signup form with no data'
);
...
...
@@ -53,9 +55,9 @@ class SignupCest
$signupPage
->
submit
([]);
$I
->
expectTo
(
'see validation errors'
);
$I
->
see
(
'Username cannot be blank.'
);
$I
->
see
(
'Email cannot be blank.'
);
$I
->
see
(
'Password cannot be blank.'
);
$I
->
see
(
'Username cannot be blank.'
,
'.help-block'
);
$I
->
see
(
'Email cannot be blank.'
,
'.help-block'
);
$I
->
see
(
'Password cannot be blank.'
,
'.help-block'
);
$I
->
amGoingTo
(
'submit signup form with not correct email'
);
$signupPage
->
submit
([
...
...
@@ -64,9 +66,9 @@ class SignupCest
'password'
=>
'tester_password'
,
]);
$I
->
expectTo
(
'see that email adress is wrong'
);
$I
->
dontSee
(
'Username cannot be blank.'
,
'.help-
inline
'
);
$I
->
dontSee
(
'Password cannot be blank.'
,
'.help-
inline
'
);
$I
->
expectTo
(
'see that email ad
d
ress is wrong'
);
$I
->
dontSee
(
'Username cannot be blank.'
,
'.help-
block
'
);
$I
->
dontSee
(
'Password cannot be blank.'
,
'.help-
block
'
);
$I
->
see
(
'Email is not a valid email address.'
,
'.help-block'
);
$I
->
amGoingTo
(
'submit signup form with correct email'
);
...
...
@@ -76,7 +78,13 @@ class SignupCest
'password'
=>
'tester_password'
,
]);
$I
->
expectTo
(
'see that user is created'
);
$I
->
seeRecord
(
'common\models\User'
,
[
'username'
=>
'tester'
,
'email'
=>
'tester.email@example.com'
,
]);
$I
->
expectTo
(
'see that user logged in'
);
$I
->
see
(
'Logout (tester)'
);
$I
->
see
Link
(
'Logout (tester)'
);
}
}
apps/advanced/frontend/tests/unit/models/ContactFormTest.php
View file @
34db2d20
...
...
@@ -4,6 +4,7 @@ namespace frontend\tests\unit\models;
use
Yii
;
use
frontend\tests\unit\TestCase
;
use
frontend\models\ContactForm
;
class
ContactFormTest
extends
TestCase
{
...
...
@@ -26,8 +27,7 @@ class ContactFormTest extends TestCase
public
function
testContact
()
{
$model
=
$this
->
getMock
(
'frontend\models\ContactForm'
,
[
'validate'
]);
$model
->
expects
(
$this
->
once
())
->
method
(
'validate'
)
->
will
(
$this
->
returnValue
(
true
));
$model
=
new
ContactForm
();
$model
->
attributes
=
[
'name'
=>
'Tester'
,
...
...
@@ -36,7 +36,7 @@ class ContactFormTest extends TestCase
'body'
=>
'body of current message'
,
];
$model
->
contact
(
'admin@example.com'
);
$model
->
sendEmail
(
'admin@example.com'
);
$this
->
specify
(
'email should be send'
,
function
()
{
expect
(
'email file should exist'
,
file_exists
(
$this
->
getMessageFile
()))
->
true
();
...
...
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