@@ -20,21 +20,21 @@ class ValidatorTest extends \PHPUnit\Framework\TestCase
20
20
*
21
21
* @var \Magento\Framework\View\Element\Template\File\Validator
22
22
*/
23
- private $ _validator ;
23
+ private $ validator ;
24
24
25
25
/**
26
26
* Mock for view file system
27
27
*
28
28
* @var \Magento\Framework\FileSystem|\PHPUnit_Framework_MockObject_MockObject
29
29
*/
30
- private $ _fileSystemMock ;
30
+ private $ fileSystemMock ;
31
31
32
32
/**
33
33
* Mock for scope config
34
34
*
35
35
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
36
36
*/
37
- private $ _scopeConfigMock ;
37
+ private $ scopeConfigMock ;
38
38
39
39
/**
40
40
* Mock for root directory reader
@@ -62,12 +62,12 @@ class ValidatorTest extends \PHPUnit\Framework\TestCase
62
62
*/
63
63
protected function setUp ()
64
64
{
65
- $ this ->_fileSystemMock = $ this ->createMock (\Magento \Framework \Filesystem::class);
66
- $ this ->_scopeConfigMock = $ this ->createMock (\Magento \Framework \App \Config \ScopeConfigInterface::class);
65
+ $ this ->fileSystemMock = $ this ->createMock (\Magento \Framework \Filesystem::class);
66
+ $ this ->scopeConfigMock = $ this ->createMock (\Magento \Framework \App \Config \ScopeConfigInterface::class);
67
67
$ this ->rootDirectoryMock = $ this ->createMock (\Magento \Framework \Filesystem \Directory \ReadInterface::class);
68
68
$ this ->compiledDirectoryMock = $ this ->createMock (\Magento \Framework \Filesystem \Directory \ReadInterface::class);
69
69
70
- $ this ->_fileSystemMock ->expects ($ this ->any ())
70
+ $ this ->fileSystemMock ->expects ($ this ->any ())
71
71
->method ('getDirectoryRead ' )
72
72
->will ($ this ->returnValueMap (
73
73
[
@@ -91,10 +91,18 @@ protected function setUp()
91
91
]
92
92
)
93
93
);
94
- $ this ->_validator = new \Magento \Framework \View \Element \Template \File \Validator (
95
- $ this ->_fileSystemMock ,
96
- $ this ->_scopeConfigMock ,
97
- $ this ->componentRegistrar
94
+
95
+ $ fileDriverMock = $ this ->createMock (\Magento \Framework \Filesystem \Driver \File::class);
96
+ $ fileDriverMock ->expects ($ this ->any ())
97
+ ->method ('getRealPath ' )
98
+ ->willReturnArgument (0 );
99
+
100
+ $ this ->validator = new \Magento \Framework \View \Element \Template \File \Validator (
101
+ $ this ->fileSystemMock ,
102
+ $ this ->scopeConfigMock ,
103
+ $ this ->componentRegistrar ,
104
+ null ,
105
+ $ fileDriverMock
98
106
);
99
107
}
100
108
@@ -103,23 +111,22 @@ protected function setUp()
103
111
*
104
112
* @param string $file
105
113
* @param bool $expectedResult
106
- *
107
- * @dataProvider testIsValidDataProvider
108
- *
109
114
* @return void
115
+ *
116
+ * @dataProvider isValidDataProvider
110
117
*/
111
118
public function testIsValid ($ file , $ expectedResult )
112
119
{
113
120
$ this ->rootDirectoryMock ->expects ($ this ->any ())->method ('isFile ' )->will ($ this ->returnValue (true ));
114
- $ this ->assertEquals ($ expectedResult , $ this ->_validator ->isValid ($ file ));
121
+ $ this ->assertEquals ($ expectedResult , $ this ->validator ->isValid ($ file ));
115
122
}
116
123
117
124
/**
118
125
* Data provider for testIsValid
119
126
*
120
- * @return []
127
+ * @return array
121
128
*/
122
- public function testIsValidDataProvider ()
129
+ public function isValidDataProvider ()
123
130
{
124
131
return [
125
132
'empty ' => ['' , false ],
0 commit comments