Skip to content

Commit dbbd826

Browse files
authored
Update SecurityTest.php
1 parent 0b2cf65 commit dbbd826

File tree

1 file changed

+20
-25
lines changed
  • app/code/Magento/AdminNotification/Test/Unit/Model/System/Message

1 file changed

+20
-25
lines changed

app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,42 @@
1717
class SecurityTest extends TestCase
1818
{
1919
/**
20-
* @var MockObject
20+
* @var CacheInterface|MockObject
2121
*/
22-
protected $_cacheMock;
22+
private $cacheMock;
2323

2424
/**
25-
* @var MockObject
25+
* @var ScopeConfigInterface|MockObject
2626
*/
27-
protected $_scopeConfigMock;
27+
private $scopeConfigMock;
2828

2929
/**
30-
* @var MockObject
30+
* @var CurlFactory|MockObject
3131
*/
32-
protected $_configMock;
33-
34-
/**
35-
* @var MockObject
36-
*/
37-
protected $_curlFactoryMock;
32+
private $curlFactoryMock;
3833

3934
/**
4035
* @var Security
4136
*/
42-
protected $_messageModel;
37+
private $messageModel;
4338

4439
protected function setUp(): void
4540
{
4641
//Prepare objects for constructor
47-
$this->_cacheMock = $this->createMock(CacheInterface::class);
48-
$this->_scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
49-
$this->_curlFactoryMock = $this->createPartialMock(
42+
$this->cacheMock = $this->createMock(CacheInterface::class);
43+
$this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
44+
$this->curlFactoryMock = $this->createPartialMock(
5045
CurlFactory::class,
5146
['create']
5247
);
5348

5449
$objectManagerHelper = new ObjectManager($this);
5550
$arguments = [
56-
'cache' => $this->_cacheMock,
57-
'scopeConfig' => $this->_scopeConfigMock,
58-
'curlFactory' => $this->_curlFactoryMock,
51+
'cache' => $this->cacheMock,
52+
'scopeConfig' => $this->scopeConfigMock,
53+
'curlFactory' => $this->curlFactoryMock,
5954
];
60-
$this->_messageModel = $objectManagerHelper->getObject(
55+
$this->messageModel = $objectManagerHelper->getObject(
6156
Security::class,
6257
$arguments
6358
);
@@ -73,16 +68,16 @@ protected function setUp(): void
7368
*/
7469
public function testIsDisplayed($expectedResult, $cached, $response)
7570
{
76-
$this->_cacheMock->expects($this->any())->method('load')->will($this->returnValue($cached));
77-
$this->_cacheMock->expects($this->any())->method('save')->will($this->returnValue(null));
71+
$this->cacheMock->expects($this->any())->method('load')->will($this->returnValue($cached));
72+
$this->cacheMock->expects($this->any())->method('save')->will($this->returnValue(null));
7873

7974
$httpAdapterMock = $this->createMock(Curl::class);
8075
$httpAdapterMock->expects($this->any())->method('read')->will($this->returnValue($response));
81-
$this->_curlFactoryMock->expects($this->any())->method('create')->will($this->returnValue($httpAdapterMock));
76+
$this->curlFactoryMock->expects($this->any())->method('create')->will($this->returnValue($httpAdapterMock));
8277

83-
$this->_scopeConfigMock->expects($this->any())->method('getValue')->will($this->returnValue(null));
78+
$this->scopeConfigMock->expects($this->any())->method('getValue')->will($this->returnValue(null));
8479

85-
$this->assertEquals($expectedResult, $this->_messageModel->isDisplayed());
80+
$this->assertEquals($expectedResult, $this->messageModel->isDisplayed());
8681
}
8782

8883
/**
@@ -101,6 +96,6 @@ public function testGetText()
10196
{
10297
$messageStart = 'Your web server is set up incorrectly';
10398

104-
$this->assertStringStartsWith($messageStart, (string)$this->_messageModel->getText());
99+
$this->assertStringStartsWith($messageStart, (string)$this->messageModel->getText());
105100
}
106101
}

0 commit comments

Comments
 (0)