Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4056965
GlobalBlockStatusTest.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
GlobalBlockStatusTest.php
View Options
<?php
namespace
MediaWiki\Extension\GlobalBlocking\Test\Unit
;
use
MediaWiki\Extension\GlobalBlocking\GlobalBlockStatus
;
use
MediaWikiUnitTestCase
;
use
StatusValue
;
/**
* @covers \MediaWiki\Extension\GlobalBlocking\GlobalBlockStatus
*/
class
GlobalBlockStatusTest
extends
MediaWikiUnitTestCase
{
public
function
testNewGood
()
{
$status
=
GlobalBlockStatus
::
newGood
(
'value'
);
$this
->
assertInstanceOf
(
GlobalBlockStatus
::
class
,
$status
);
$this
->
assertSame
(
'value'
,
$status
->
getValue
()
);
$this
->
assertTrue
(
$status
->
isGlobalBlockOK
()
);
$this
->
assertFalse
(
$status
->
isLocalBlockOK
()
);
$this
->
assertFalse
(
$status
->
hasLocalBlockError
()
);
$this
->
assertTrue
(
$status
->
getGlobalStatus
()->
isOK
()
);
}
public
function
testNewFatal
()
{
$status
=
GlobalBlockStatus
::
newFatal
(
'some-message'
);
$this
->
assertInstanceOf
(
GlobalBlockStatus
::
class
,
$status
);
$this
->
assertSame
(
'some-message'
,
$status
->
getMessages
()[
0
]->
getKey
()
);
$this
->
assertFalse
(
$status
->
isOK
()
);
$this
->
assertFalse
(
$status
->
isGlobalBlockOK
()
);
$this
->
assertFalse
(
$status
->
isLocalBlockOK
()
);
$this
->
assertFalse
(
$status
->
hasLocalBlockError
()
);
$this
->
assertFalse
(
$status
->
getGlobalStatus
()->
isOK
()
);
}
public
function
testWithLocalStatusFatal
()
{
$status
=
GlobalBlockStatus
::
newGood
(
'value'
);
$status
=
$status
->
withLocalStatus
(
StatusValue
::
newFatal
(
'some-message'
)
);
$this
->
assertFalse
(
$status
->
isOK
()
);
$this
->
assertTrue
(
$status
->
isGlobalBlockOK
()
);
$this
->
assertFalse
(
$status
->
isLocalBlockOK
()
);
$this
->
assertTrue
(
$status
->
hasLocalBlockError
()
);
$this
->
assertSame
(
'some-message'
,
$status
->
getMessages
()[
0
]->
getKey
()
);
$this
->
assertSame
(
'value'
,
$status
->
getValue
()
);
$this
->
assertTrue
(
$status
->
getGlobalStatus
()->
isOK
()
);
}
public
function
testWithLocalStatusGood
()
{
$status
=
GlobalBlockStatus
::
newGood
(
'value'
);
$status
=
$status
->
withLocalStatus
(
StatusValue
::
newGood
(
'local-value'
)
);
$this
->
assertTrue
(
$status
->
isOK
()
);
$this
->
assertTrue
(
$status
->
isGlobalBlockOK
()
);
$this
->
assertTrue
(
$status
->
isLocalBlockOK
()
);
$this
->
assertFalse
(
$status
->
hasLocalBlockError
()
);
$this
->
assertSame
(
'value'
,
$status
->
getValue
()
);
$this
->
assertTrue
(
$status
->
getGlobalStatus
()->
isOK
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 16 2026, 03:45 (12 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ee/a9/66209b86e3283449429724512c7e
Default Alt Text
GlobalBlockStatusTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment