17
17
class SecurityTest extends TestCase
18
18
{
19
19
/**
20
- * @var MockObject
20
+ * @var CacheInterface| MockObject
21
21
*/
22
- protected $ _cacheMock ;
22
+ private $ cacheMock ;
23
23
24
24
/**
25
- * @var MockObject
25
+ * @var ScopeConfigInterface| MockObject
26
26
*/
27
- protected $ _scopeConfigMock ;
27
+ private $ scopeConfigMock ;
28
28
29
29
/**
30
- * @var MockObject
30
+ * @var CurlFactory| MockObject
31
31
*/
32
- protected $ _configMock ;
33
-
34
- /**
35
- * @var MockObject
36
- */
37
- protected $ _curlFactoryMock ;
32
+ private $ curlFactoryMock ;
38
33
39
34
/**
40
35
* @var Security
41
36
*/
42
- protected $ _messageModel ;
37
+ private $ messageModel ;
43
38
44
39
protected function setUp (): void
45
40
{
46
41
//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 (
50
45
CurlFactory::class,
51
46
['create ' ]
52
47
);
53
48
54
49
$ objectManagerHelper = new ObjectManager ($ this );
55
50
$ 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 ,
59
54
];
60
- $ this ->_messageModel = $ objectManagerHelper ->getObject (
55
+ $ this ->messageModel = $ objectManagerHelper ->getObject (
61
56
Security::class,
62
57
$ arguments
63
58
);
@@ -73,16 +68,16 @@ protected function setUp(): void
73
68
*/
74
69
public function testIsDisplayed ($ expectedResult , $ cached , $ response )
75
70
{
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 ));
78
73
79
74
$ httpAdapterMock = $ this ->createMock (Curl::class);
80
75
$ 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 ));
82
77
83
- $ this ->_scopeConfigMock ->expects ($ this ->any ())->method ('getValue ' )->will ($ this ->returnValue (null ));
78
+ $ this ->scopeConfigMock ->expects ($ this ->any ())->method ('getValue ' )->will ($ this ->returnValue (null ));
84
79
85
- $ this ->assertEquals ($ expectedResult , $ this ->_messageModel ->isDisplayed ());
80
+ $ this ->assertEquals ($ expectedResult , $ this ->messageModel ->isDisplayed ());
86
81
}
87
82
88
83
/**
@@ -101,6 +96,6 @@ public function testGetText()
101
96
{
102
97
$ messageStart = 'Your web server is set up incorrectly ' ;
103
98
104
- $ this ->assertStringStartsWith ($ messageStart , (string )$ this ->_messageModel ->getText ());
99
+ $ this ->assertStringStartsWith ($ messageStart , (string )$ this ->messageModel ->getText ());
105
100
}
106
101
}
0 commit comments