6
6
7
7
namespace Magento \ConfigurableProduct \Test \Unit \Plugin \Model \ResourceModel ;
8
8
9
+ use Magento \Catalog \Api \ProductAttributeRepositoryInterface ;
9
10
use Magento \Catalog \Model \Product \Type ;
11
+ use Magento \Catalog \Model \ProductAttributeSearchResults ;
12
+ use Magento \Catalog \Model \ResourceModel \Eav \Attribute as EavAttribute ;
10
13
use Magento \ConfigurableProduct \Model \Product \Type \Configurable ;
11
- use Magento \Framework \Indexer \ActionInterface ;
12
- use Magento \Catalog \Api \ProductAttributeRepositoryInterface ;
14
+ use Magento \ConfigurableProduct \Model \Product \Type \Configurable \Attribute as ConfigurableAttribute ;
15
+ use Magento \Framework \Api \ExtensionAttributesInterface ;
16
+ use Magento \Framework \Api \FilterBuilder ;
13
17
use Magento \Framework \Api \SearchCriteriaBuilder ;
14
18
use Magento \Framework \Api \SearchCriteria ;
15
- use Magento \Framework \Api \FilterBuilder ;
16
- use Magento \Framework \Api \ExtensionAttributesInterface ;
17
- use Magento \ConfigurableProduct \Model \Product \Type \Configurable \Attribute as ConfigurableAttribute ;
18
- use Magento \Catalog \Model \ProductAttributeSearchResults ;
19
- use Magento \Catalog \Model \ResourceModel \Eav \Attribute as EavAttribute ;
19
+ use Magento \Framework \Indexer \ActionInterface ;
20
20
21
21
class ProductTest extends \PHPUnit \Framework \TestCase
22
22
{
@@ -39,14 +39,17 @@ class ProductTest extends \PHPUnit\Framework\TestCase
39
39
* @var \Magento\ConfigurableProduct\Plugin\Model\ResourceModel\Product
40
40
*/
41
41
private $ model ;
42
+
42
43
/**
43
44
* @var ProductAttributeRepositoryInterface|\PHPUnit\Framework\MockObject\MockObject
44
45
*/
45
- private $ prdAttributeRepositoryMock ;
46
+ private $ productAttributeRepositoryMock ;
47
+
46
48
/**
47
49
* @var SearchCriteriaBuilder|\PHPUnit\Framework\MockObject\MockObject
48
50
*/
49
51
private $ searchCriteriaBuilderMock ;
52
+
50
53
/**
51
54
* @var FilterBuilder|\PHPUnit\Framework\MockObject\MockObject
52
55
*/
@@ -57,7 +60,7 @@ public function setUp()
57
60
$ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
58
61
$ this ->configurableMock = $ this ->createMock (Configurable::class);
59
62
$ this ->actionMock = $ this ->createMock (ActionInterface::class);
60
- $ this ->prdAttributeRepositoryMock = $ this ->getMockBuilder (ProductAttributeRepositoryInterface::class)
63
+ $ this ->productAttributeRepositoryMock = $ this ->getMockBuilder (ProductAttributeRepositoryInterface::class)
61
64
->disableOriginalConstructor ()
62
65
->setMethods (['getList ' ])
63
66
->getMockForAbstractClass ();
@@ -75,7 +78,7 @@ public function setUp()
75
78
[
76
79
'configurable ' => $ this ->configurableMock ,
77
80
'productIndexer ' => $ this ->actionMock ,
78
- 'productAttributeRepository ' => $ this ->prdAttributeRepositoryMock ,
81
+ 'productAttributeRepository ' => $ this ->productAttributeRepositoryMock ,
79
82
'searchCriteriaBuilder ' => $ this ->searchCriteriaBuilderMock ,
80
83
'filterBuilder ' => $ this ->filterBuilderMock
81
84
]
@@ -125,7 +128,7 @@ public function testBeforeSaveConfigurable()
125
128
ProductAttributeSearchResults::class,
126
129
['getItems ' ]
127
130
);
128
- $ this ->prdAttributeRepositoryMock ->expects ($ this ->once ())
131
+ $ this ->productAttributeRepositoryMock ->expects ($ this ->once ())
129
132
->method ('getList ' )->with ($ searchCriteria )->willReturn ($ searchResultMockClass );
130
133
$ optionAttribute = $ this ->createPartialMock (
131
134
EavAttribute::class,
0 commit comments