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
5698a10c
Commit
5698a10c
authored
Jun 23, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added functional tests for the basic app.
parent
7f1b8c10
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1163 additions
and
53 deletions
+1163
-53
WebGuy.php
apps/basic/tests/acceptance/WebGuy.php
+42
-43
functional.suite.dist.yml
apps/basic/tests/functional.suite.dist.yml
+5
-1
ContactCept.php
apps/basic/tests/functional/ContactCept.php
+36
-0
HomeCept.php
apps/basic/tests/functional/HomeCept.php
+8
-0
LoginCept.php
apps/basic/tests/functional/LoginCept.php
+23
-0
TestGuy.php
apps/basic/tests/functional/TestGuy.php
+1043
-5
index-test.php
apps/basic/www/index-test.php
+2
-2
ErrorHandler.php
framework/yii/base/ErrorHandler.php
+1
-1
User.php
framework/yii/web/User.php
+3
-1
No files found.
apps/basic/tests/acceptance/WebGuy.php
View file @
5698a10c
This diff is collapsed.
Click to expand it.
apps/basic/tests/functional.suite.dist.yml
View file @
5698a10c
...
@@ -8,4 +8,8 @@
...
@@ -8,4 +8,8 @@
class_name
:
TestGuy
class_name
:
TestGuy
modules
:
modules
:
enabled
:
[
Filesystem
,
TestHelper
]
enabled
:
[
Filesystem
,
TestHelper
,
Yii2
]
config
:
Yii2
:
entryScript
:
'
www/index-test.php'
url
:
'
http://localhost/'
apps/basic/tests/functional/ContactCept.php
0 → 100644
View file @
5698a10c
<?php
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
amOnPage
(
'?r=site/contact'
);
$I
->
see
(
'Contact'
,
'h1'
);
$I
->
submitForm
(
'#contact-form'
,
array
());
$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
->
submitForm
(
'#contact-form'
,
array
(
'ContactForm[name]'
=>
'tester'
,
'ContactForm[email]'
=>
'tester.email'
,
'ContactForm[subject]'
=>
'test subject'
,
'ContactForm[body]'
=>
'test content'
,
'ContactForm[verifyCode]'
=>
'testme'
,
));
$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
->
submitForm
(
'#contact-form'
,
array
(
'ContactForm[name]'
=>
'tester'
,
'ContactForm[email]'
=>
'tester@example.com'
,
'ContactForm[subject]'
=>
'test subject'
,
'ContactForm[body]'
=>
'test content'
,
'ContactForm[verifyCode]'
=>
'testme'
,
));
$I
->
dontSeeElement
(
'#contact-form'
);
$I
->
see
(
'Thank you for contacting us. We will respond to you as soon as possible.'
);
apps/basic/tests/functional/HomeCept.php
0 → 100644
View file @
5698a10c
<?php
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
amOnPage
(
''
);
$I
->
see
(
'My Company'
);
$I
->
seeLink
(
'About'
);
$I
->
click
(
'About'
);
$I
->
see
(
'This is the About page.'
);
apps/basic/tests/functional/LoginCept.php
0 → 100644
View file @
5698a10c
<?php
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that login works'
);
$I
->
amOnPage
(
'?r=site/login'
);
$I
->
see
(
'Login'
,
'h1'
);
$I
->
submitForm
(
'#login-form'
,
array
());
$I
->
dontSee
(
'Logout (admin)'
);
$I
->
see
(
'Username cannot be blank'
);
$I
->
see
(
'Password cannot be blank'
);
$I
->
submitForm
(
'#login-form'
,
array
(
'LoginForm[username]'
=>
'admin'
,
'LoginForm[password]'
=>
'wrong'
,
));
$I
->
dontSee
(
'Logout (admin)'
);
$I
->
see
(
'Incorrect username or password'
);
$I
->
submitForm
(
'#login-form'
,
array
(
'LoginForm[username]'
=>
'admin'
,
'LoginForm[password]'
=>
'admin'
,
));
$I
->
see
(
'Logout (admin)'
);
apps/basic/tests/functional/TestGuy.php
View file @
5698a10c
This diff is collapsed.
Click to expand it.
apps/basic/www/index-test.php
View file @
5698a10c
...
@@ -8,8 +8,8 @@ defined('YII_DEBUG') or define('YII_DEBUG', true);
...
@@ -8,8 +8,8 @@ defined('YII_DEBUG') or define('YII_DEBUG', true);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'test'
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'test'
);
require
(
__DIR__
.
'/../vendor/yiisoft/yii2/yii/Yii.php'
);
require
_once
(
__DIR__
.
'/../vendor/yiisoft/yii2/yii/Yii.php'
);
require
(
__DIR__
.
'/../vendor/autoload.php'
);
require
_once
(
__DIR__
.
'/../vendor/autoload.php'
);
$config
=
require
(
__DIR__
.
'/../config/web-test.php'
);
$config
=
require
(
__DIR__
.
'/../config/web-test.php'
);
...
...
framework/yii/base/ErrorHandler.php
View file @
5698a10c
...
@@ -82,7 +82,7 @@ class ErrorHandler extends Component
...
@@ -82,7 +82,7 @@ class ErrorHandler extends Component
*/
*/
protected
function
renderException
(
$exception
)
protected
function
renderException
(
$exception
)
{
{
if
(
Yii
::
$app
instanceof
\yii\console\Application
)
{
if
(
Yii
::
$app
instanceof
\yii\console\Application
||
YII_ENV
===
'test'
)
{
echo
Yii
::
$app
->
renderException
(
$exception
);
echo
Yii
::
$app
->
renderException
(
$exception
);
return
;
return
;
}
}
...
...
framework/yii/web/User.php
View file @
5698a10c
...
@@ -416,7 +416,9 @@ class User extends Component
...
@@ -416,7 +416,9 @@ class User extends Component
public
function
switchIdentity
(
$identity
,
$duration
=
0
)
public
function
switchIdentity
(
$identity
,
$duration
=
0
)
{
{
$session
=
Yii
::
$app
->
getSession
();
$session
=
Yii
::
$app
->
getSession
();
$session
->
regenerateID
(
true
);
if
(
YII_ENV
!==
'test'
)
{
$session
->
regenerateID
(
true
);
}
$this
->
setIdentity
(
$identity
);
$this
->
setIdentity
(
$identity
);
$session
->
remove
(
$this
->
idVar
);
$session
->
remove
(
$this
->
idVar
);
$session
->
remove
(
$this
->
authTimeoutVar
);
$session
->
remove
(
$this
->
authTimeoutVar
);
...
...
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