Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1820209
BearerTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
1 KB
Subscribers
None
BearerTest.php
View Options
<?php
namespace
Sabre\HTTP\Auth
;
use
Sabre\HTTP\Request
;
use
Sabre\HTTP\Response
;
class
BearerTest
extends
\PHPUnit_Framework_TestCase
{
function
testGetToken
()
{
$request
=
new
Request
(
'GET'
,
'/'
,
[
'Authorization'
=>
'Bearer 12345'
]);
$bearer
=
new
Bearer
(
'Dagger'
,
$request
,
new
Response
());
$this
->
assertEquals
(
'12345'
,
$bearer
->
getToken
(
$request
)
);
}
function
testGetCredentialsNoheader
()
{
$request
=
new
Request
(
'GET'
,
'/'
,
[]);
$bearer
=
new
Bearer
(
'Dagger'
,
$request
,
new
Response
());
$this
->
assertNull
(
$bearer
->
getToken
(
$request
));
}
function
testGetCredentialsNotBearer
()
{
$request
=
new
Request
(
'GET'
,
'/'
,
[
'Authorization'
=>
'QBearer 12345'
]);
$bearer
=
new
Bearer
(
'Dagger'
,
$request
,
new
Response
());
$this
->
assertNull
(
$bearer
->
getToken
(
$request
));
}
function
testRequireLogin
()
{
$response
=
new
Response
();
$bearer
=
new
Bearer
(
'Dagger'
,
new
Request
(),
$response
);
$bearer
->
requireLogin
();
$this
->
assertEquals
(
'Bearer realm="Dagger"'
,
$response
->
getHeader
(
'WWW-Authenticate'
));
$this
->
assertEquals
(
401
,
$response
->
getStatus
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Dec 21, 10:16 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
916508
Default Alt Text
BearerTest.php (1 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment