Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P7243
(An Untitled Masterwork)
Active
Public
Actions
Authored by
hashar
on Jun 11 2018, 1:36 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F21789640:
Jun 11 2018, 1:36 PM
2018-06-11 13:36:52 (UTC+0)
Subscribers
None
<?php
// Exercise https://gerrit.wikimedia.org/r/c/mediawiki/core/+/439289 for T191537
public
function
testPostSendJobDoesNotSetCookie
()
{
// Prevent updates from running
$this
->
setMwGlobals
(
'wgCommandLineMode'
,
false
);
// A job that attempts to set a cookie
DeferredUpdates
::
addCallableUpdate
(
function
()
{
WebResponse
::
setCookie
(
'JobCookie'
,
'yes'
);
}
);
$this
->
assertCount
(
1
,
DeferredUpdates
::
getPendingUpdates
(
DeferredUpdates
::
POSTSEND
)
);
$mw
=
new
MediaWiki
();
$mw
->
doPostOutputShutdown
();
$this
->
assertCount
(
0
,
DeferredUpdates
::
getPendingUpdates
(
DeferredUpdates
::
POSTSEND
),
'Cookie setting job must be run'
);
$this
->
assertFalse
(
WebResponse
::
hasCookies
(),
'Job must not set cookie in post-send'
);
// stack traces because of headers already have been sent, but the code is good
}
Event Timeline
hashar
created this paste.
Jun 11 2018, 1:36 PM
2018-06-11 13:36:51 (UTC+0)
Log In to Comment