@@ -57,10 +57,14 @@ public function testGetCollection()
57
57
$ linkedProductOneMock = $ this ->createMock (Product::class);
58
58
$ linkedProductTwoMock = $ this ->createMock (Product::class);
59
59
$ linkedProductThreeMock = $ this ->createMock (Product::class);
60
+ $ linkedProductFourMock = $ this ->createMock (Product::class);
61
+ $ linkedProductFiveMock = $ this ->createMock (Product::class);
60
62
61
63
$ linkedProductOneMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (1 );
62
64
$ linkedProductTwoMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (2 );
63
65
$ linkedProductThreeMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (3 );
66
+ $ linkedProductFourMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (4 );
67
+ $ linkedProductFiveMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (5 );
64
68
65
69
$ this ->converterPoolMock ->expects ($ this ->once ())
66
70
->method ('getConverter ' )
@@ -71,9 +75,11 @@ public function testGetCollection()
71
75
[$ linkedProductOneMock , ['name ' => 'Product One ' , 'position ' => 10 ]],
72
76
[$ linkedProductTwoMock , ['name ' => 'Product Two ' , 'position ' => 2 ]],
73
77
[$ linkedProductThreeMock , ['name ' => 'Product Three ' , 'position ' => 2 ]],
78
+ [$ linkedProductFourMock , ['name ' => 'Product Four ' , 'position ' => null ]],
79
+ [$ linkedProductFiveMock , ['name ' => 'Product Five ' ]],
74
80
];
75
81
76
- $ this ->converterMock ->expects ($ this ->exactly (3 ))->method ('convert ' )->willReturnMap ($ map );
82
+ $ this ->converterMock ->expects ($ this ->exactly (5 ))->method ('convert ' )->willReturnMap ($ map );
77
83
78
84
$ this ->providerMock ->expects ($ this ->once ())
79
85
->method ('getLinkedProducts ' )
@@ -82,14 +88,18 @@ public function testGetCollection()
82
88
[
83
89
$ linkedProductOneMock ,
84
90
$ linkedProductTwoMock ,
85
- $ linkedProductThreeMock
91
+ $ linkedProductThreeMock ,
92
+ $ linkedProductFourMock ,
93
+ $ linkedProductFiveMock ,
86
94
]
87
95
);
88
96
89
97
$ expectedResult = [
90
- 2 => ['name ' => 'Product Two ' , 'position ' => 2 ],
91
- 3 => ['name ' => 'Product Three ' , 'position ' => 2 ],
92
- 10 => ['name ' => 'Product One ' , 'position ' => 10 ],
98
+ 0 => ['name ' => 'Product Four ' , 'position ' => 0 ],
99
+ 1 => ['name ' => 'Product Five ' , 'position ' => 0 ],
100
+ 2 => ['name ' => 'Product Three ' , 'position ' => 2 ],
101
+ 3 => ['name ' => 'Product Two ' , 'position ' => 2 ],
102
+ 4 => ['name ' => 'Product One ' , 'position ' => 10 ],
93
103
];
94
104
95
105
$ actualResult = $ this ->model ->getCollection ($ this ->productMock , 'crosssell ' );
0 commit comments