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
7f1b8c10
Commit
7f1b8c10
authored
Jun 23, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust for test integration.
parent
4e1fc27f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
12 deletions
+21
-12
AboutCept.php
apps/basic/tests/functional/AboutCept.php
+5
-0
YiiBase.php
framework/yii/YiiBase.php
+1
-1
Response.php
framework/yii/web/Response.php
+15
-11
No files found.
apps/basic/tests/functional/AboutCept.php
0 → 100644
View file @
7f1b8c10
<?php
$I
=
new
TestGuy
(
$scenario
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
amOnPage
(
'?r=site/about'
);
$I
->
see
(
'About'
,
'h1'
);
framework/yii/YiiBase.php
View file @
7f1b8c10
...
...
@@ -65,7 +65,7 @@ class YiiBase
* @var boolean whether to search PHP include_path when autoloading unknown classes.
* You may want to turn this off if you are also using autoloaders from other libraries.
*/
public
static
$enableIncludePath
=
tru
e
;
public
static
$enableIncludePath
=
fals
e
;
/**
* @var \yii\console\Application|\yii\web\Application the application instance
*/
...
...
framework/yii/web/Response.php
View file @
7f1b8c10
...
...
@@ -35,7 +35,7 @@ class Response extends \yii\base\Response
* @event ResponseEvent an event that is triggered right after [[prepare()]] is called in [[send()]].
* You may respond to this event to filter the response content before it is sent to the client.
*/
const
EVENT_
PREPARE
=
'p
repare'
;
const
EVENT_
AFTER_PREPARE
=
'afterP
repare'
;
const
FORMAT_RAW
=
'raw'
;
const
FORMAT_HTML
=
'html'
;
...
...
@@ -218,6 +218,11 @@ class Response extends \yii\base\Response
*/
public
function
setStatusCode
(
$value
,
$text
=
null
)
{
if
(
$value
===
null
)
{
$this
->
_statusCode
=
null
;
$this
->
statusText
=
null
;
return
;
}
$this
->
_statusCode
=
(
int
)
$value
;
if
(
$this
->
getIsInvalid
())
{
throw
new
InvalidParamException
(
"The HTTP status code is invalid:
$value
"
);
...
...
@@ -249,7 +254,7 @@ class Response extends \yii\base\Response
{
$this
->
trigger
(
self
::
EVENT_BEFORE_SEND
,
new
ResponseEvent
(
$this
));
$this
->
prepare
();
$this
->
trigger
(
self
::
EVENT_PREPARE
,
new
ResponseEvent
(
$this
));
$this
->
trigger
(
self
::
EVENT_
AFTER_
PREPARE
,
new
ResponseEvent
(
$this
));
$this
->
sendHeaders
();
$this
->
sendContent
();
$this
->
trigger
(
self
::
EVENT_AFTER_SEND
,
new
ResponseEvent
(
$this
));
...
...
@@ -319,14 +324,8 @@ class Response extends \yii\base\Response
*/
protected
function
sendContent
()
{
if
(
is_array
(
$this
->
content
))
{
echo
'array()'
;
}
elseif
(
is_object
(
$this
->
content
))
{
echo
method_exists
(
$this
->
content
,
'__toString'
)
?
(
string
)
$this
->
content
:
get_class
(
$this
->
content
);
}
else
{
echo
$this
->
content
;
}
}
/**
* Sends a file to the browser.
...
...
@@ -721,12 +720,10 @@ class Response extends \yii\base\Response
}
if
(
$formatter
instanceof
ResponseFormatter
)
{
$formatter
->
format
(
$this
);
return
;
}
else
{
throw
new
InvalidConfigException
(
"The '
{
$this
->
format
}
' response formatter is invalid. It must implement the ResponseFormatter interface."
);
}
}
}
else
{
switch
(
$this
->
format
)
{
case
self
::
FORMAT_HTML
:
$this
->
getHeaders
()
->
setDefault
(
'Content-Type'
,
'text/html; charset='
.
$this
->
charset
);
...
...
@@ -755,4 +752,11 @@ class Response extends \yii\base\Response
throw
new
InvalidConfigException
(
"Unsupported response format:
{
$this
->
format
}
"
);
}
}
if
(
is_array
(
$this
->
content
))
{
$this
->
content
=
'array()'
;
}
elseif
(
is_object
(
$this
->
content
))
{
$this
->
content
=
method_exists
(
$this
->
content
,
'__toString'
)
?
(
string
)
$this
->
content
:
get_class
(
$this
->
content
);
}
}
}
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