15 private $designExceptions;
18 private $objectManagerHelper;
21 private $scopeConfigMock;
27 private $exceptionConfigPath =
'exception_path';
30 private $scopeType =
'scope_type';
33 private $serializerMock;
37 $this->scopeConfigMock = $this->createMock(\
Magento\Framework\
App\
Config\ScopeConfigInterface::class);
38 $this->requestMock = $this->createMock(\
Magento\Framework\
App\Request\Http::class);
39 $this->serializerMock = $this->createMock(Json::class);
41 $this->objectManagerHelper =
new ObjectManagerHelper($this);
42 $this->designExceptions = $this->objectManagerHelper->getObject(
43 \
Magento\Framework\View\DesignExceptions::class,
45 'scopeConfig' => $this->scopeConfigMock,
46 'exceptionConfigPath' => $this->exceptionConfigPath,
47 'scopeType' => $this->scopeType,
48 'serializer' => $this->serializerMock,
63 $this->requestMock->expects($this->once())
65 ->with($this->equalTo(
'HTTP_USER_AGENT'))
66 ->will($this->returnValue($userAgent));
69 $this->scopeConfigMock->expects($this->once())
71 ->with($this->equalTo($this->exceptionConfigPath), $this->equalTo($this->scopeType))
72 ->will($this->returnValue($configValue));
75 $this->serializerMock->expects($this->exactly($callNum))
76 ->method(
'unserialize')
80 $this->assertSame(
$result, $this->designExceptions->getThemeByRequest($this->requestMock));
89 [
false,
null, 0,
false],
90 [
'iphone',
null, 0,
false],
91 [
'iphone',
'serializedExpressions1', 1,
false],
92 [
'iphone',
'serializedExpressions2', 1,
'matched', [[
'regexp' =>
'/iphone/',
'value' =>
'matched']]],
93 [
'explorer',
'serializedExpressions3', 1,
false, [[
'regexp' =>
'/iphone/',
'value' =>
'matched']]],
testGetThemeByRequest($userAgent, $configValue, $callNum, $result, $expressions=[])
getThemeByRequestDataProvider()