6
6
namespace Magento \Variable \Test \Unit \Model ;
7
7
8
8
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
9
+ use Magento \Variable \Model \ResourceModel \Variable \Collection ;
9
10
10
11
class VariableTest extends \PHPUnit \Framework \TestCase
11
12
{
@@ -27,7 +28,7 @@ class VariableTest extends \PHPUnit\Framework\TestCase
27
28
/**
28
29
* @var \Magento\Variable\Model\ResourceModel\Variable\Collection|\PHPUnit_Framework_MockObject_MockObject
29
30
*/
30
- private $ resourceCollection ;
31
+ private $ resourceCollectionMock ;
31
32
32
33
/**
33
34
* @var \Magento\Framework\Phrase
@@ -48,17 +49,15 @@ protected function setUp()
48
49
$ this ->resourceMock = $ this ->getMockBuilder (\Magento \Variable \Model \ResourceModel \Variable::class)
49
50
->disableOriginalConstructor ()
50
51
->getMock ();
51
- $ this ->resourceCollection = $ this ->getMockBuilder (
52
- \Magento \Variable \Model \ResourceModel \Variable \Collection::class
53
- )
52
+ $ this ->resourceCollectionMock = $ this ->getMockBuilder (Collection::class)
54
53
->disableOriginalConstructor ()
55
54
->getMock ();
56
55
$ this ->model = $ this ->objectManager ->getObject (
57
56
\Magento \Variable \Model \Variable::class,
58
57
[
59
58
'escaper ' => $ this ->escaperMock ,
60
59
'resource ' => $ this ->resourceMock ,
61
- 'resourceCollection ' => $ this ->resourceCollection ,
60
+ 'resourceCollection ' => $ this ->resourceCollectionMock ,
62
61
]
63
62
);
64
63
$ this ->validationFailedPhrase = __ ('Validation has failed. ' );
@@ -129,7 +128,7 @@ public function testGetVariablesOptionArrayNoGroup()
129
128
['value ' => '{{customVar code=VAL}} ' , 'label ' => __ ('%1 ' , 'LBL ' )],
130
129
];
131
130
132
- $ this ->resourceCollection ->expects ($ this ->any ())
131
+ $ this ->resourceCollectionMock ->expects ($ this ->any ())
133
132
->method ('toOptionArray ' )
134
133
->willReturn ($ origOptions );
135
134
$ this ->escaperMock ->expects ($ this ->once ())
@@ -146,13 +145,15 @@ public function testGetVariablesOptionArrayWithGroup()
146
145
];
147
146
148
147
$ transformedOptions = [
149
- 'label ' => __ ('Custom Variables ' ),
150
- 'value ' => [
151
- ['value ' => '{{customVar code=VAL}} ' , 'label ' => __ ('%1 ' , 'LBL ' )],
148
+ [
149
+ 'label ' => __ ('Custom Variables ' ),
150
+ 'value ' => [
151
+ ['value ' => '{{customVar code=VAL}} ' , 'label ' => __ ('%1 ' , 'LBL ' )],
152
+ ],
152
153
],
153
154
];
154
155
155
- $ this ->resourceCollection ->expects ($ this ->any ())
156
+ $ this ->resourceCollectionMock ->expects ($ this ->any ())
156
157
->method ('toOptionArray ' )
157
158
->willReturn ($ origOptions );
158
159
$ this ->escaperMock ->expects ($ this ->atLeastOnce ())
0 commit comments