Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2bootstrap
Project
Project
Details
Activity
Releases
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
夏彬
yii2bootstrap
Commits
44e515b4
Commit
44e515b4
authored
Dec 02, 2013
by
Mark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests modified, bootstrap added
parent
8b4a6bab
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
1959 additions
and
876 deletions
+1959
-876
_bootstrap.php
apps/basic/tests/_bootstrap.php
+1
-0
AboutPage.php
apps/basic/tests/_pages/AboutPage.php
+10
-0
BasePage.php
apps/basic/tests/_pages/BasePage.php
+45
-0
ContactPage.php
apps/basic/tests/_pages/ContactPage.php
+63
-0
LoginPage.php
apps/basic/tests/_pages/LoginPage.php
+40
-0
acceptance.suite.dist.yml
apps/basic/tests/acceptance.suite.dist.yml
+4
-3
AboutCept.php
apps/basic/tests/acceptance/AboutCept.php
+3
-1
ContactCept.php
apps/basic/tests/acceptance/ContactCept.php
+24
-14
LoginCept.php
apps/basic/tests/acceptance/LoginCept.php
+18
-15
WebGuy.php
apps/basic/tests/acceptance/WebGuy.php
+1432
-757
_bootstrap.php
apps/basic/tests/acceptance/_bootstrap.php
+9
-0
functional.suite.dist.yml
apps/basic/tests/functional.suite.dist.yml
+2
-2
AboutCept.php
apps/basic/tests/functional/AboutCept.php
+4
-1
ContactCept.php
apps/basic/tests/functional/ContactCept.php
+23
-14
LoginCept.php
apps/basic/tests/functional/LoginCept.php
+17
-15
TestGuy.php
apps/basic/tests/functional/TestGuy.php
+70
-51
_bootstrap.php
apps/basic/tests/functional/_bootstrap.php
+9
-1
ContactPage.php
apps/basic/tests/functional/_pages/ContactPage.php
+56
-0
LoginPage.php
apps/basic/tests/functional/_pages/LoginPage.php
+33
-0
CodeGuy.php
apps/basic/tests/unit/CodeGuy.php
+18
-1
_bootstrap.php
apps/basic/tests/unit/_bootstrap.php
+9
-1
ContactFormTest.php
apps/basic/tests/unit/models/ContactFormTest.php
+16
-0
LoginFormTest.php
apps/basic/tests/unit/models/LoginFormTest.php
+16
-0
UserTest.php
apps/basic/tests/unit/models/UserTest.php
+27
-0
yii_bootstrap.php
apps/basic/tests/yii_bootstrap.php
+10
-0
No files found.
apps/basic/tests/_bootstrap.php
0 → 100644
View file @
44e515b4
<?php
apps/basic/tests/_pages/AboutPage.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\_pages
;
class
AboutPage
extends
BasePage
{
public
static
$URL
=
'?r=site/about'
;
}
\ No newline at end of file
apps/basic/tests/_pages/BasePage.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\_pages
;
class
BasePage
{
// include url of current page
public
static
$URL
=
''
;
/**
* Declare UI map for this page here. CSS or XPath allowed.
* public static $usernameField = '#username';
* public static $formSubmitButton = "#mainForm input[type=submit]";
*/
/**
* Basic route example for your current URL
* You can append any additional parameter to URL
* and use it in tests like: EditPage::route('/123-post');
*/
public
static
function
route
(
$param
)
{
return
static
::
$URL
.
$param
;
}
/**
* @var
*/
protected
$guy
;
public
function
__construct
(
$I
)
{
$this
->
guy
=
$I
;
}
/**
* @return $this
*/
public
static
function
of
(
$I
)
{
return
new
static
(
$I
);
}
}
apps/basic/tests/_pages/ContactPage.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\_pages
;
class
ContactPage
extends
BasePage
{
public
static
$URL
=
'?r=site/contact'
;
/**
* contact form name text field locator
* @var string
*/
public
$name
=
'input[name="ContactForm[name]"]'
;
/**
* contact form email text field locator
* @var string
*/
public
$email
=
'input[name="ContactForm[email]"]'
;
/**
* contact form subject text field locator
* @var string
*/
public
$subject
=
'input[name="ContactForm[subject]"]'
;
/**
* contact form body textarea locator
* @var string
*/
public
$body
=
'textarea[name="ContactForm[body]"]'
;
/**
* contact form verification code text field locator
* @var string
*/
public
$verifyCode
=
'input[name="ContactForm[verifyCode]"]'
;
/**
* contact form submit button
* @var string
*/
public
$button
=
'button[type=submit]'
;
/**
*
* @param array $contactData
*/
public
function
submit
(
array
$contactData
)
{
if
(
!
empty
(
$contactData
))
{
$this
->
guy
->
fillField
(
$this
->
name
,
$contactData
[
'name'
]);
$this
->
guy
->
fillField
(
$this
->
email
,
$contactData
[
'email'
]);
$this
->
guy
->
fillField
(
$this
->
subject
,
$contactData
[
'subject'
]);
$this
->
guy
->
fillField
(
$this
->
body
,
$contactData
[
'body'
]);
$this
->
guy
->
fillField
(
$this
->
verifyCode
,
$contactData
[
'verifyCode'
]);
}
$this
->
guy
->
click
(
$this
->
button
);
}
}
apps/basic/tests/_pages/LoginPage.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\_pages
;
class
LoginPage
extends
BasePage
{
public
static
$URL
=
'?r=site/login'
;
/**
* login form username text field locator
* @var string
*/
public
$username
=
'input[name="LoginForm[username]"]'
;
/**
* login form password text field locator
* @var string
*/
public
$password
=
'input[name="LoginForm[password]"]'
;
/**
* login form submit button locator
* @var string
*/
public
$button
=
'button[type=submit]'
;
/**
*
* @param string $username
* @param string $password
*/
public
function
login
(
$username
,
$password
)
{
$this
->
guy
->
fillField
(
$this
->
username
,
$username
);
$this
->
guy
->
fillField
(
$this
->
password
,
$password
);
$this
->
guy
->
click
(
$this
->
button
);
}
}
apps/basic/tests/acceptance.suite.dist.yml
View file @
44e515b4
...
@@ -11,8 +11,9 @@
...
@@ -11,8 +11,9 @@
class_name
:
WebGuy
class_name
:
WebGuy
modules
:
modules
:
enabled
:
enabled
:
-
PhpBrowser
-
WebHelper
-
WebHelper
-
WebDriver
config
:
config
:
PhpBrowser
:
WebDriver
:
url
:
'
http://localhost/index-test.php'
url
:
'
http://localhost/basic/web/index-test-accept.php'
browser
:
firefox
apps/basic/tests/acceptance/AboutCept.php
View file @
44e515b4
<?php
<?php
use
tests\_pages\AboutPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
WebGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
amOnPage
(
'?r=site/about'
);
$I
->
amOnPage
(
AboutPage
::
$URL
);
$I
->
see
(
'About'
,
'h1'
);
$I
->
see
(
'About'
,
'h1'
);
apps/basic/tests/acceptance/ContactCept.php
View file @
44e515b4
<?php
<?php
use
tests\_pages\ContactPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
WebGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
amOnPage
(
'?r=site/contact'
);
$contactPage
=
ContactPage
::
of
(
$I
);
$I
->
amOnPage
(
ContactPage
::
$URL
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
submitForm
(
'#contact-form'
,
[]);
$I
->
amGoingTo
(
'submit contact form with no data'
);
$contactPage
->
submit
([]);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
see
(
'Name cannot be blank'
);
$I
->
see
(
'Name cannot be blank'
);
$I
->
see
(
'Email cannot be blank'
);
$I
->
see
(
'Email cannot be blank'
);
...
@@ -12,25 +18,29 @@ $I->see('Subject cannot be blank');
...
@@ -12,25 +18,29 @@ $I->see('Subject cannot be blank');
$I
->
see
(
'Body cannot be blank'
);
$I
->
see
(
'Body cannot be blank'
);
$I
->
see
(
'The verification code is incorrect'
);
$I
->
see
(
'The verification code is incorrect'
);
$I
->
submitForm
(
'#contact-form'
,
[
$I
->
amGoingTo
(
'submit contact form with not correct email'
);
'ContactForm[name]'
=>
'tester'
,
$contactPage
->
submit
([
'ContactForm[email]'
=>
'tester.email'
,
'name'
=>
'tester'
,
'ContactForm[subject]'
=>
'test subject'
,
'email'
=>
'tester.email'
,
'ContactForm[body]'
=>
'test content'
,
'subject'
=>
'test subject'
,
'ContactForm[verifyCode]'
=>
'testme'
,
'body'
=>
'test content'
,
'verifyCode'
=>
'testme'
,
]);
]);
$I
->
expectTo
(
'see that email adress is wrong'
);
$I
->
dontSee
(
'Name cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'Name cannot be blank'
,
'.help-inline'
);
$I
->
see
(
'Email is not a valid email address.'
);
$I
->
see
(
'Email is not a valid email address.'
);
$I
->
dontSee
(
'Subject cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'Subject cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'Body cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'Body cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'The verification code is incorrect'
,
'.help-inline'
);
$I
->
dontSee
(
'The verification code is incorrect'
,
'.help-inline'
);
$I
->
submitForm
(
'#contact-form'
,
[
$I
->
amGoingTo
(
'submit contact form with correct data'
);
'ContactForm[name]'
=>
'tester'
,
$contactPage
->
submit
([
'ContactForm[email]'
=>
'tester@example.com'
,
'name'
=>
'tester'
,
'ContactForm[subject]'
=>
'test subject'
,
'email'
=>
'tester@example.com'
,
'ContactForm[body]'
=>
'test content'
,
'subject'
=>
'test subject'
,
'ContactForm[verifyCode]'
=>
'testme'
,
'body'
=>
'test content'
,
'verifyCode'
=>
'testme'
,
]);
]);
$I
->
wait
(
3
);
$I
->
dontSeeElement
(
'#contact-form'
);
$I
->
dontSeeElement
(
'#contact-form'
);
$I
->
see
(
'Thank you for contacting us. We will respond to you as soon as possible.'
);
$I
->
see
(
'Thank you for contacting us. We will respond to you as soon as possible.'
);
apps/basic/tests/acceptance/LoginCept.php
View file @
44e515b4
<?php
<?php
use
tests\_pages\LoginPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
WebGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that login works'
);
$I
->
wantTo
(
'ensure that login works'
);
$I
->
amOnPage
(
'?r=site/login'
);
$loginPage
=
LoginPage
::
of
(
$I
);
$I
->
amOnPage
(
LoginPage
::
$URL
);
$I
->
see
(
'Login'
,
'h1'
);
$I
->
see
(
'Login'
,
'h1'
);
$I
->
submitForm
(
'#login-form'
,
[]);
$I
->
amGoingTo
(
'try to login with empty credentials'
);
$I
->
dontSee
(
'Logout (admin)'
);
$loginPage
->
login
(
''
,
''
);
$I
->
see
(
'Username cannot be blank'
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Password cannot be blank'
);
$I
->
see
(
'Username cannot be blank.'
);
$I
->
see
(
'Password cannot be blank.'
);
$I
->
submitForm
(
'#login-form'
,
[
$I
->
amGoingTo
(
'try to login with wrong credentials'
);
'LoginForm[username]'
=>
'admin'
,
$loginPage
->
login
(
'admin'
,
'wrong'
);
'LoginForm[password]'
=>
'wrong'
,
$I
->
expectTo
(
'see validations errors'
);
]);
$I
->
see
(
'Incorrect username or password.'
);
$I
->
dontSee
(
'Logout (admin)'
);
$I
->
see
(
'Incorrect username or password'
);
$I
->
submitForm
(
'#login-form'
,
[
$I
->
amGoingTo
(
'try to login with correct credentials'
);
'LoginForm[username]'
=>
'admin'
,
$loginPage
->
login
(
'admin'
,
'admin'
);
'LoginForm[password]'
=>
'admin'
,
$I
->
wait
(
3
);
]
);
$I
->
expectTo
(
'see user info'
);
$I
->
see
(
'Logout (admin)'
);
$I
->
see
(
'Logout (admin)'
);
apps/basic/tests/acceptance/WebGuy.php
View file @
44e515b4
This source diff could not be displayed because it is too large. You can
view the blob
instead.
apps/basic/tests/acceptance/_bootstrap.php
View file @
44e515b4
<?php
<?php
// Here you can initialize variables that will for your tests
// Here you can initialize variables that will for your tests
$config
=
require
(
__DIR__
.
'/../yii_bootstrap.php'
);
$config
=
yii\helpers\ArrayHelper
::
merge
(
$config
,
require
(
__DIR__
.
'/../../config/codeception/acceptance.php'
)
);
$application
=
new
yii\web\Application
(
$config
);
apps/basic/tests/functional.suite.dist.yml
View file @
44e515b4
...
@@ -5,11 +5,11 @@
...
@@ -5,11 +5,11 @@
# (tip: better to use with frameworks).
# (tip: better to use with frameworks).
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
#basic/web/index-test-func.php
class_name
:
TestGuy
class_name
:
TestGuy
modules
:
modules
:
enabled
:
[
Filesystem
,
TestHelper
,
Yii2
]
enabled
:
[
Filesystem
,
TestHelper
,
Yii2
]
config
:
config
:
Yii2
:
Yii2
:
entryScript
:
'
web/index-test.php'
entryScript
:
'
web/index-test
-func
.php'
url
:
'
http://localhost/'
url
:
'
http://localhost/'
apps/basic/tests/functional/AboutCept.php
View file @
44e515b4
<?php
<?php
use
tests\_pages\AboutPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
amOnPage
(
'?r=site/about'
);
$I
->
amOnPage
(
AboutPage
::
$URL
);
$I
->
see
(
'About'
,
'h1'
);
$I
->
see
(
'About'
,
'h1'
);
apps/basic/tests/functional/ContactCept.php
View file @
44e515b4
<?php
<?php
use
tests\functional\_pages\ContactPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
amOnPage
(
'?r=site/contact'
);
$contactPage
=
ContactPage
::
of
(
$I
);
$I
->
amOnPage
(
ContactPage
::
$URL
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
submitForm
(
'#contact-form'
,
[]);
$I
->
amGoingTo
(
'submit contact form with no data'
);
$contactPage
->
submit
([]);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
see
(
'Name cannot be blank'
);
$I
->
see
(
'Name cannot be blank'
);
$I
->
see
(
'Email cannot be blank'
);
$I
->
see
(
'Email cannot be blank'
);
...
@@ -12,25 +18,28 @@ $I->see('Subject cannot be blank');
...
@@ -12,25 +18,28 @@ $I->see('Subject cannot be blank');
$I
->
see
(
'Body cannot be blank'
);
$I
->
see
(
'Body cannot be blank'
);
$I
->
see
(
'The verification code is incorrect'
);
$I
->
see
(
'The verification code is incorrect'
);
$I
->
submitForm
(
'#contact-form'
,
[
$I
->
amGoingTo
(
'submit contact form with not correct email'
);
'ContactForm[name]'
=>
'tester'
,
$contactPage
->
submit
([
'ContactForm[email]'
=>
'tester.email'
,
'name'
=>
'tester'
,
'ContactForm[subject]'
=>
'test subject'
,
'email'
=>
'tester.email'
,
'ContactForm[body]'
=>
'test content'
,
'subject'
=>
'test subject'
,
'ContactForm[verifyCode]'
=>
'testme'
,
'body'
=>
'test content'
,
'verifyCode'
=>
'testme'
,
]);
]);
$I
->
expectTo
(
'see that email adress is wrong'
);
$I
->
dontSee
(
'Name cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'Name cannot be blank'
,
'.help-inline'
);
$I
->
see
(
'Email is not a valid email address.'
);
$I
->
see
(
'Email is not a valid email address.'
);
$I
->
dontSee
(
'Subject cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'Subject cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'Body cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'Body cannot be blank'
,
'.help-inline'
);
$I
->
dontSee
(
'The verification code is incorrect'
,
'.help-inline'
);
$I
->
dontSee
(
'The verification code is incorrect'
,
'.help-inline'
);
$I
->
submitForm
(
'#contact-form'
,
[
$I
->
amGoingTo
(
'submit contact form with correct data'
);
'ContactForm[name]'
=>
'tester'
,
$contactPage
->
submit
([
'ContactForm[email]'
=>
'tester@example.com'
,
'name'
=>
'tester'
,
'ContactForm[subject]'
=>
'test subject'
,
'email'
=>
'tester@example.com'
,
'ContactForm[body]'
=>
'test content'
,
'subject'
=>
'test subject'
,
'ContactForm[verifyCode]'
=>
'testme'
,
'body'
=>
'test content'
,
'verifyCode'
=>
'testme'
,
]);
]);
$I
->
dontSeeElement
(
'#contact-form'
);
$I
->
dontSeeElement
(
'#contact-form'
);
$I
->
see
(
'Thank you for contacting us. We will respond to you as soon as possible.'
);
$I
->
see
(
'Thank you for contacting us. We will respond to you as soon as possible.'
);
apps/basic/tests/functional/LoginCept.php
View file @
44e515b4
<?php
<?php
use
tests\functional\_pages\LoginPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that login works'
);
$I
->
wantTo
(
'ensure that login works'
);
$I
->
amOnPage
(
'?r=site/login'
);
$loginPage
=
LoginPage
::
of
(
$I
);
$I
->
amOnPage
(
LoginPage
::
$URL
);
$I
->
see
(
'Login'
,
'h1'
);
$I
->
see
(
'Login'
,
'h1'
);
$I
->
submitForm
(
'#login-form'
,
[]);
$I
->
amGoingTo
(
'try to login with empty credentials'
);
$I
->
dontSee
(
'Logout (admin)'
);
$loginPage
->
login
(
''
,
''
);
$I
->
see
(
'Username cannot be blank'
);
$I
->
expectTo
(
'see validations errors'
);
$I
->
see
(
'Password cannot be blank'
);
$I
->
see
(
'Username cannot be blank.'
);
$I
->
see
(
'Password cannot be blank.'
);
$I
->
submitForm
(
'#login-form'
,
[
$I
->
amGoingTo
(
'try to login with wrong credentials'
);
'LoginForm[username]'
=>
'admin'
,
$loginPage
->
login
(
'admin'
,
'wrong'
);
'LoginForm[password]'
=>
'wrong'
,
$I
->
expectTo
(
'see validations errors'
);
]);
$I
->
see
(
'Incorrect username or password.'
);
$I
->
dontSee
(
'Logout (admin)'
);
$I
->
see
(
'Incorrect username or password'
);
$I
->
submitForm
(
'#login-form'
,
[
$I
->
amGoingTo
(
'try to login with correct credentials'
);
'LoginForm[username]'
=>
'admin'
,
$loginPage
->
login
(
'admin'
,
'admin'
);
'LoginForm[password]'
=>
'admin'
,
$I
->
expectTo
(
'see user info'
);
]);
$I
->
see
(
'Logout (admin)'
);
$I
->
see
(
'Logout (admin)'
);
apps/basic/tests/functional/TestGuy.php
View file @
44e515b4
...
@@ -440,6 +440,25 @@ class TestGuy extends \Codeception\AbstractGuy
...
@@ -440,6 +440,25 @@ class TestGuy extends \Codeception\AbstractGuy
}
}
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
*
* @see Codeception\Module::getName()
* @return \Codeception\Maybe
*/
public
function
getName
()
{
$this
->
scenario
->
addStep
(
new
\Codeception\Step\Action
(
'getName'
,
func_get_args
()));
if
(
$this
->
scenario
->
running
())
{
$result
=
$this
->
scenario
->
runStep
();
return
new
Maybe
(
$result
);
}
return
new
Maybe
();
}
/**
/**
* This method is generated.
* This method is generated.
* Documentation taken from corresponding module.
* Documentation taken from corresponding module.
...
...
apps/basic/tests/functional/_bootstrap.php
View file @
44e515b4
<?php
<?php
// Here you can initialize variables that will for your tests
$config
=
require
(
__DIR__
.
'/../yii_bootstrap.php'
);
$config
=
yii\helpers\ArrayHelper
::
merge
(
$config
,
require
(
__DIR__
.
'/../../config/codeception/functional.php'
)
);
$application
=
new
yii\web\Application
(
$config
);
apps/basic/tests/functional/_pages/ContactPage.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\functional\_pages
;
class
ContactPage
extends
\tests\_pages\ContactPage
{
/**
* contact form name text field locator
* @var string
*/
public
$name
=
'ContactForm[name]'
;
/**
* contact form email text field locator
* @var string
*/
public
$email
=
'ContactForm[email]'
;
/**
* contact form subject text field locator
* @var string
*/
public
$subject
=
'ContactForm[subject]'
;
/**
* contact form body textarea locator
* @var string
*/
public
$body
=
'ContactForm[body]'
;
/**
* contact form verification code text field locator
* @var string
*/
public
$verifyCode
=
'ContactForm[verifyCode]'
;
/**
*
* @param array $contactData
*/
public
function
submit
(
array
$contactData
)
{
if
(
empty
(
$contactData
))
$this
->
guy
->
submitForm
(
'#contact-form'
,[]);
else
$this
->
guy
->
submitForm
(
'#contact-form'
,[
$this
->
name
=>
$contactData
[
'name'
],
$this
->
email
=>
$contactData
[
'email'
],
$this
->
subject
=>
$contactData
[
'subject'
],
$this
->
body
=>
$contactData
[
'body'
],
$this
->
verifyCode
=>
$contactData
[
'verifyCode'
],
]);
}
}
apps/basic/tests/functional/_pages/LoginPage.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\functional\_pages
;
class
LoginPage
extends
\tests\_pages\LoginPage
{
/**
* login form username text field locator
* @var string
*/
public
$username
=
'LoginForm[username]'
;
/**
* login form password text field locator
* @var string
*/
public
$password
=
'LoginForm[password]'
;
/**
*
* @param string $username
* @param string $password
*/
public
function
login
(
$username
,
$password
)
{
$this
->
guy
->
submitForm
(
'#login-form'
,[
$this
->
username
=>
$username
,
$this
->
password
=>
$password
,
]);
}
}
apps/basic/tests/unit/CodeGuy.php
View file @
44e515b4
...
@@ -26,5 +26,22 @@ use Codeception\Module\CodeHelper;
...
@@ -26,5 +26,22 @@ use Codeception\Module\CodeHelper;
class
CodeGuy
extends
\Codeception\AbstractGuy
class
CodeGuy
extends
\Codeception\AbstractGuy
{
{
/**
* This method is generated.
* Documentation taken from corresponding module.
* ----------------------------------------------
*
*
* @see Codeception\Module::getName()
* @return \Codeception\Maybe
*/
public
function
getName
()
{
$this
->
scenario
->
addStep
(
new
\Codeception\Step\Action
(
'getName'
,
func_get_args
()));
if
(
$this
->
scenario
->
running
())
{
$result
=
$this
->
scenario
->
runStep
();
return
new
Maybe
(
$result
);
}
return
new
Maybe
();
}
}
}
apps/basic/tests/unit/_bootstrap.php
View file @
44e515b4
<?php
<?php
// Here you can initialize variables that will for your tests
$config
=
require
(
__DIR__
.
'/../yii_bootstrap.php'
);
$config
=
yii\helpers\ArrayHelper
::
merge
(
$config
,
require
(
__DIR__
.
'/../../config/codeception/unit.php'
)
);
$application
=
new
yii\web\Application
(
$config
);
apps/basic/tests/unit/models/ContactFormTest.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\unit\models
;
class
ContactFormTest
extends
\PHPUnit_Framework_TestCase
{
protected
function
setUp
()
{
}
protected
function
tearDown
()
{
}
}
apps/basic/tests/unit/models/LoginFormTest.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\unit\models
;
class
LoginFormTest
extends
\PHPUnit_Framework_TestCase
{
protected
function
setUp
()
{
}
protected
function
tearDown
()
{
}
}
\ No newline at end of file
apps/basic/tests/unit/models/UserTest.php
0 → 100644
View file @
44e515b4
<?php
namespace
tests\unit\models
;
#use yii\test\DbTestTrait;
class
UserTest
extends
\PHPUnit_Framework_TestCase
{
use
DbTestTrait
;
protected
function
setUp
()
{
/*
* you can load fixtures in this way
*
$this->loadFixtures([
'tbl_user',
]);
*/
}
protected
function
tearDown
()
{
}
}
apps/basic/tests/yii_bootstrap.php
0 → 100644
View file @
44e515b4
<?php
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'test'
);
require_once
(
__DIR__
.
'/../vendor/autoload.php'
);
require_once
(
__DIR__
.
'/../vendor/yiisoft/yii2/yii/Yii.php'
);
return
require
(
__DIR__
.
'/../config/web.php'
);
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