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
ab3dfbac
Commit
ab3dfbac
authored
Dec 28, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified tests.
parent
404757bf
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
143 deletions
+10
-143
ContactPage.php
apps/basic/tests/_pages/ContactPage.php
+4
-40
LoginPage.php
apps/basic/tests/_pages/LoginPage.php
+4
-20
ContactCept.php
apps/basic/tests/functional/ContactCept.php
+1
-1
LoginCept.php
apps/basic/tests/functional/LoginCept.php
+1
-1
ContactPage.php
apps/basic/tests/functional/_pages/ContactPage.php
+0
-51
LoginPage.php
apps/basic/tests/functional/_pages/LoginPage.php
+0
-30
No files found.
apps/basic/tests/_pages/ContactPage.php
View file @
ab3dfbac
...
@@ -9,50 +9,14 @@ class ContactPage extends BasePage
...
@@ -9,50 +9,14 @@ class ContactPage extends BasePage
public
$route
=
'site/contact'
;
public
$route
=
'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
* @param array $contactData
*/
*/
public
function
submit
(
array
$contactData
)
public
function
submit
(
array
$contactData
)
{
{
if
(
!
empty
(
$contactData
))
$data
=
[];
{
foreach
(
$contactData
as
$name
=>
$value
)
{
$this
->
guy
->
fillField
(
$this
->
name
,
$contactData
[
'name'
]);
$data
[
"ContactForm[
$name
]"
]
=
$value
;
$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
);
$this
->
guy
->
submitForm
(
'#contact-form'
,
$data
);
}
}
}
}
apps/basic/tests/_pages/LoginPage.php
View file @
ab3dfbac
...
@@ -9,30 +9,14 @@ class LoginPage extends BasePage
...
@@ -9,30 +9,14 @@ class LoginPage extends BasePage
public
$route
=
'site/login'
;
public
$route
=
'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 $username
* @param string $password
* @param string $password
*/
*/
public
function
login
(
$username
,
$password
)
public
function
login
(
$username
,
$password
)
{
{
$this
->
guy
->
fillField
(
$this
->
username
,
$username
);
$this
->
guy
->
submitForm
(
'#login-form'
,
[
$this
->
guy
->
fillField
(
$this
->
password
,
$password
);
'LoginForm[username]'
=>
$username
,
$this
->
guy
->
click
(
$this
->
button
);
'LoginForm[password]'
=>
$password
,
]);
}
}
}
}
apps/basic/tests/functional/ContactCept.php
View file @
ab3dfbac
<?php
<?php
use
tests\
functional\
_pages\ContactPage
;
use
tests\_pages\ContactPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
wantTo
(
'ensure that contact works'
);
...
...
apps/basic/tests/functional/LoginCept.php
View file @
ab3dfbac
<?php
<?php
use
tests\
functional\
_pages\LoginPage
;
use
tests\_pages\LoginPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that login works'
);
$I
->
wantTo
(
'ensure that login works'
);
...
...
apps/basic/tests/functional/_pages/ContactPage.php
deleted
100644 → 0
View file @
404757bf
<?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
deleted
100644 → 0
View file @
404757bf
<?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
,
]);
}
}
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