@@ -24,11 +24,15 @@ class RecommendationsServiceTest extends TestCase
2424{
2525 public function testRecommendByIdentifierReturnsRecommendationsResponse ()
2626 {
27- $ expectedData = [
28- ['id ' => 1 , 'name ' => 'Empfehlung 1 ' ],
29- ['id ' => 2 , 'name ' => 'Empfehlung 2 ' ],
27+ $ rawData = [
28+ ['type ' => 'together ' , 'id ' => 1 , 'name ' => 'Zusammen gekauft 1 ' ],
29+ ['type ' => 'together ' , 'id ' => 2 , 'name ' => 'Zusammen gekauft 2 ' ],
30+ ['type ' => 'also ' , 'id ' => 3 , 'name ' => 'Auch gekauft 1 ' ],
31+ ['type ' => 'also ' , 'id ' => 4 , 'name ' => 'Auch gekauft 2 ' ],
32+ ['type ' => 'related ' , 'id ' => 5 , 'name ' => 'Verknüpft 1 ' ],
33+ ['type ' => 'related ' , 'id ' => 6 , 'name ' => 'Verknüpft 2 ' ],
3034 ];
31- $ jsonResponse = json_encode ($ expectedData );
35+ $ jsonResponse = json_encode ($ rawData );
3236
3337 $ mockResponse = $ this ->createMock (Response::class);
3438 $ mockResponse ->method ('getRawResponse ' )->willReturn ($ jsonResponse );
@@ -40,6 +44,9 @@ public function testRecommendByIdentifierReturnsRecommendationsResponse()
4044 $ result = $ service ->recommendByIdentifier ('720 ' );
4145
4246 $ this ->assertInstanceOf (RecommendationsResponse::class, $ result );
43- $ this ->assertSame ($ expectedData , $ result ->getRecommendations ());
47+ $ recommendations = $ result ->getRecommendations ();
48+ $ this ->assertCount (2 , $ recommendations ['together ' ]);
49+ $ this ->assertCount (2 , $ recommendations ['also ' ]);
50+ $ this ->assertCount (2 , $ recommendations ['related ' ]);
4451 }
4552}
0 commit comments