@@ -57,10 +57,14 @@ public function testGetCollection()
5757 $ linkedProductOneMock = $ this ->createMock (Product::class);
5858 $ linkedProductTwoMock = $ this ->createMock (Product::class);
5959 $ linkedProductThreeMock = $ this ->createMock (Product::class);
60+ $ linkedProductFourMock = $ this ->createMock (Product::class);
61+ $ linkedProductFiveMock = $ this ->createMock (Product::class);
6062
6163 $ linkedProductOneMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (1 );
6264 $ linkedProductTwoMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (2 );
6365 $ 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 );
6468
6569 $ this ->converterPoolMock ->expects ($ this ->once ())
6670 ->method ('getConverter ' )
@@ -71,9 +75,11 @@ public function testGetCollection()
7175 [$ linkedProductOneMock , ['name ' => 'Product One ' , 'position ' => 10 ]],
7276 [$ linkedProductTwoMock , ['name ' => 'Product Two ' , 'position ' => 2 ]],
7377 [$ linkedProductThreeMock , ['name ' => 'Product Three ' , 'position ' => 2 ]],
78+ [$ linkedProductFourMock , ['name ' => 'Product Four ' , 'position ' => null ]],
79+ [$ linkedProductFiveMock , ['name ' => 'Product Five ' ]],
7480 ];
7581
76- $ this ->converterMock ->expects ($ this ->exactly (3 ))->method ('convert ' )->willReturnMap ($ map );
82+ $ this ->converterMock ->expects ($ this ->exactly (5 ))->method ('convert ' )->willReturnMap ($ map );
7783
7884 $ this ->providerMock ->expects ($ this ->once ())
7985 ->method ('getLinkedProducts ' )
@@ -82,14 +88,18 @@ public function testGetCollection()
8288 [
8389 $ linkedProductOneMock ,
8490 $ linkedProductTwoMock ,
85- $ linkedProductThreeMock
91+ $ linkedProductThreeMock ,
92+ $ linkedProductFourMock ,
93+ $ linkedProductFiveMock ,
8694 ]
8795 );
8896
8997 $ 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 ],
93103 ];
94104
95105 $ actualResult = $ this ->model ->getCollection ($ this ->productMock , 'crosssell ' );
0 commit comments