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
70463d53
Commit
70463d53
authored
Mar 07, 2014
by
Johnny Theill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests
parent
fa661221
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
81 additions
and
77 deletions
+81
-77
LoginCept.php
apps/advanced/backend/tests/acceptance/LoginCept.php
+10
-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
+10
-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
+17
-9
ContactFormTest.php
apps/advanced/frontend/tests/unit/models/ContactFormTest.php
+3
-3
No files found.
apps/advanced/backend/tests/acceptance/LoginCept.php
View file @
70463d53
...
...
@@ -10,21 +10,22 @@ $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
->
see
(
'Logout (erau)'
,
'ul.nav li a'
);
$I
->
dontSee
(
'Login'
,
'ul.nav li a'
);
$I
->
dontSee
(
'Signup'
,
'ul.nav li a'
);
// Uncomment if using WebDriver
//$I->click('Logout (erau)', 'ul.nav li a');
//$I->dontSee('Logout (erau)', 'ul.nav li a');
//$I->see('Login', 'ul.nav li a');
apps/advanced/backend/tests/functional/LoginCept.php
View file @
70463d53
...
...
@@ -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
->
see
(
'Logout (erau)'
,
'ul.nav li a'
);
$I
->
dontSee
(
'Login'
,
'ul.nav li a'
);
$I
->
dontSee
(
'Signup'
,
'ul.nav li a'
);
apps/advanced/frontend/tests/acceptance/ContactCept.php
View file @
70463d53
...
...
@@ -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 @
70463d53
...
...
@@ -10,21 +10,22 @@ $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
->
see
(
'Logout (erau)'
,
'ul.nav li a'
);
$I
->
dontSee
(
'Login'
,
'ul.nav li a'
);
$I
->
dontSee
(
'Signup'
,
'ul.nav li a'
);
// Uncomment if using WebDriver
//$I->click('Logout (erau)', 'ul.nav li a');
//$I->dontSee('Logout (erau)', 'ul.nav li a');
//$I->see('Login', 'ul.nav li a');
apps/advanced/frontend/tests/acceptance/SignupCest.php
View file @
70463d53
...
...
@@ -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
(
'Logout (tester)'
,
'ul.nav li a'
);
}
}
apps/advanced/frontend/tests/functional/ContactCept.php
View file @
70463d53
...
...
@@ -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 @
70463d53
...
...
@@ -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
->
see
(
'Logout (erau)'
,
'ul.nav li a'
);
$I
->
dontSee
(
'Login'
,
'ul.nav li a'
);
$I
->
dontSee
(
'Signup'
,
'ul.nav li a'
);
apps/advanced/frontend/tests/functional/SignupCest.php
View file @
70463d53
...
...
@@ -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,10 +34,11 @@ class SignupCest
*/
public
function
_fail
(
$event
)
{
}
/**
*
*
* @param \TestGuy $I
* @param \Codeception\Scenario $scenario
*/
...
...
@@ -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
(
'Logout (tester)'
,
'ul.nav li a'
);
}
}
apps/advanced/frontend/tests/unit/models/ContactFormTest.php
View file @
70463d53
...
...
@@ -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