Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2752368
ButtonAuthenticationRequestTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ButtonAuthenticationRequestTest.php
View Options
<?php
namespace
MediaWiki\Tests\Auth
;
use
MediaWiki\Auth\ButtonAuthenticationRequest
;
/**
* @group AuthManager
* @covers \MediaWiki\Auth\ButtonAuthenticationRequest
*/
class
ButtonAuthenticationRequestTest
extends
AuthenticationRequestTestCase
{
protected
function
getInstance
(
array
$args
=
[]
)
{
$data
=
array_intersect_key
(
$args
,
[
'name'
=>
1
,
'label'
=>
1
,
'help'
=>
1
]
);
if
(
$args
[
'name'
]
===
'foo'
)
{
return
ButtonAuthenticationRequestForLoadFromSubmission
::
__set_state
(
$data
);
}
return
ButtonAuthenticationRequest
::
__set_state
(
$data
);
}
public
static
function
provideGetFieldInfo
()
{
return
[
[
[
'name'
=>
'foo'
,
'label'
=>
'bar'
,
'help'
=>
'baz'
]
]
];
}
public
static
function
provideLoadFromSubmission
()
{
return
[
'Empty request'
=>
[
[
'name'
=>
'foo'
,
'label'
=>
'bar'
,
'help'
=>
'baz'
],
[],
false
],
'Button present'
=>
[
[
'name'
=>
'foo'
,
'label'
=>
'bar'
,
'help'
=>
'baz'
],
[
'foo'
=>
'Foobar'
],
[
'name'
=>
'foo'
,
'label'
=>
'bar'
,
'help'
=>
'baz'
,
'foo'
=>
true
]
],
];
}
public
function
testGetUniqueId
()
{
$req
=
new
ButtonAuthenticationRequest
(
'foo'
,
wfMessage
(
'bar'
),
wfMessage
(
'baz'
)
);
$this
->
assertSame
(
'MediaWiki
\\
Auth
\\
ButtonAuthenticationRequest:foo'
,
$req
->
getUniqueId
()
);
}
public
function
testGetRequestByName
()
{
$reqs
=
[];
$reqs
[
'testOne'
]
=
new
ButtonAuthenticationRequest
(
'foo'
,
wfMessage
(
'msg'
),
wfMessage
(
'help'
)
);
$reqs
[]
=
new
ButtonAuthenticationRequest
(
'bar'
,
wfMessage
(
'msg1'
),
wfMessage
(
'help1'
)
);
$reqs
[]
=
new
ButtonAuthenticationRequest
(
'bar'
,
wfMessage
(
'msg2'
),
wfMessage
(
'help2'
)
);
$reqs
[
'testSub'
]
=
new
ButtonAuthenticationRequest
(
'subclass'
,
wfMessage
(
'msg3'
),
wfMessage
(
'help3'
)
);
$this
->
assertNull
(
ButtonAuthenticationRequest
::
getRequestByName
(
$reqs
,
'missing'
)
);
$this
->
assertSame
(
$reqs
[
'testOne'
],
ButtonAuthenticationRequest
::
getRequestByName
(
$reqs
,
'foo'
)
);
$this
->
assertNull
(
ButtonAuthenticationRequest
::
getRequestByName
(
$reqs
,
'bar'
)
);
$this
->
assertSame
(
$reqs
[
'testSub'
],
ButtonAuthenticationRequest
::
getRequestByName
(
$reqs
,
'subclass'
)
);
}
}
// Dynamic properties from the testLoadFromSubmission not working in php8.2
class
ButtonAuthenticationRequestForLoadFromSubmission
extends
ButtonAuthenticationRequest
{
/** @var string */
public
$foo
;
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Jul 3, 19:55 (1 d, 3 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0c/fb/8062e6c246114107249bcc14b35c
Default Alt Text
ButtonAuthenticationRequestTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment