Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7462900
CustomHeaderDeviceDetectorTest.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
CustomHeaderDeviceDetectorTest.php
View Options
<?php
namespace
Tests\MobileFrontend\Devices
;
use
MediaWiki\Config\HashConfig
;
use
MediaWiki\Request\FauxRequest
;
use
MobileFrontend\Devices\CustomHeaderDeviceDetector
;
/**
* @group MobileFrontend
*/
class
CustomHeaderDeviceDetectorTest
extends
\MediaWikiUnitTestCase
{
/**
* @var \MobileFrontend\Devices\UADeviceDetector
*/
private
$detector
;
/**
* @var FauxRequest
*/
private
$request
;
protected
function
setUp
():
void
{
parent
::
setUp
();
$config
=
new
HashConfig
();
$config
->
set
(
'MFMobileHeader'
,
'FooHeader'
);
$this
->
detector
=
new
CustomHeaderDeviceDetector
(
$config
);
$this
->
request
=
new
FauxRequest
();
}
/**
* @covers \MobileFrontend\Devices\CustomHeaderDeviceDetector::detectDeviceProperties
*/
public
function
testIsNullWhenCustomHeaderIsntPresent
()
{
$this
->
assertNull
(
$this
->
detector
->
detectDeviceProperties
(
$this
->
request
,
[]
)
);
}
/**
* @covers \MobileFrontend\Devices\CustomHeaderDeviceDetector::detectDeviceProperties
* @covers \MobileFrontend\Devices\CustomHeaderDeviceDetector::__construct
* @covers \MobileFrontend\Devices\DeviceProperties::isMobileDevice
* @covers \MobileFrontend\Devices\DeviceProperties::isTabletDevice
*/
public
function
testIsMobileWhenMobileHeaderIsPresent
()
{
$this
->
request
->
setHeader
(
'FooHeader'
,
''
);
$properties
=
$this
->
detector
->
detectDeviceProperties
(
$this
->
request
,
[]
);
$this
->
assertTrue
(
$properties
->
isMobileDevice
()
);
$this
->
assertFalse
(
$properties
->
isTabletDevice
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 23, 03:50 (3 d, 5 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4e/92/f244311465f297afe6c2d5267b12
Default Alt Text
CustomHeaderDeviceDetectorTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment