Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4114560
MWOAuthExceptionTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MWOAuthExceptionTest.php
View Options
<?php
namespace
MediaWiki\Extension\OAuth\Tests\Backend
;
use
MediaWiki\Extension\OAuth\Backend\MWOAuthException
;
use
MediaWikiIntegrationTestCase
;
/**
* @covers \MediaWiki\Extension\OAuth\Backend\MWOAuthException
* @group OAuth
*/
class
MWOAuthExceptionTest
extends
MediaWikiIntegrationTestCase
{
/**
* @dataProvider provideParameterHandling
*/
public
function
testParameterHandling
(
string
$msg
,
array
$params
,
string
$expectedMessage
,
string
$expectedNormalizedMessage
,
array
$expectedContext
)
{
$exception
=
new
MWOAuthException
(
$msg
,
$params
);
$this
->
assertSame
(
$expectedMessage
,
$exception
->
getMessage
()
);
$this
->
assertSame
(
$expectedNormalizedMessage
,
$exception
->
getNormalizedMessage
()
);
$this
->
assertSame
(
$expectedContext
,
$exception
->
getMessageContext
()
);
}
public
static
function
provideParameterHandling
()
{
return
[
'empty'
=>
[
'msg'
=>
'mwoauth-invalid-field-generic'
,
'params'
=>
[],
'expectedMessage'
=>
'Invalid value provided'
,
'expectedNormalizedMessage'
=>
'Invalid value provided'
,
'expectedContext'
=>
[],
],
'numeric key'
=>
[
'msg'
=>
'mwoauth-missing-field'
,
'params'
=>
[
'name'
],
'expectedMessage'
=>
'Missing value for "name" field'
,
'expectedNormalizedMessage'
=>
'Missing value for "name" field'
,
'expectedContext'
=>
[],
],
'named key'
=>
[
'msg'
=>
'mwoauth-missing-field'
,
'params'
=>
[
'fieldname'
=>
'name'
],
'expectedMessage'
=>
'Missing value for "name" field'
,
'expectedNormalizedMessage'
=>
'Missing value for "{fieldname}" field'
,
'expectedContext'
=>
[
'fieldname'
=>
'name'
],
],
'mixed keys'
=>
[
'msg'
=>
'mwoauth-missing-field'
,
'params'
=>
[
'name'
,
'consumer'
=>
'abcd1234'
],
'expectedMessage'
=>
'Missing value for "name" field'
,
'expectedNormalizedMessage'
=>
'Missing value for "name" field'
,
'expectedContext'
=>
[
'consumer'
=>
'abcd1234'
],
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 00:15 (3 d, 2 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
57/11/22dede77789f8bd5686f5b2a0857
Default Alt Text
MWOAuthExceptionTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment