@@ -70,10 +70,10 @@ public function testHasResponseFound(): void
7070 public  function  testPlaybackOfIdenticalRequestsFromLegacyCassette (): void 
7171 {
7272 $ request1new  Request ('GET ' , 'https://example.com ' );
73-  $ response1new  Response (200 , [], 'response1 ' );
73+  $ response1new  Response (' 200 ' 'response1 ' );
7474
7575 $ request2new  Request ('GET ' , 'https://example.com ' );
76-  $ response2new  Response (200 , [], 'response2 ' );
76+  $ response2new  Response (' 200 ' 'response2 ' );
7777
7878 // These are legacy recordings with no index keys. 
7979 $ recordings
@@ -94,17 +94,48 @@ public function testPlaybackOfIdenticalRequestsFromLegacyCassette(): void
9494 }
9595
9696 /** 
97-  * Ensure that if a second identical request is played back from an cassette 
97+  * Ensure also mixed cassettes are working properly, if a legacy cassette has a first entry without index (should be 
98+  * 0) and a second entry for the same request with incremented index (should be 1). 
99+  */ 
100+  public  function  testPlaybackOfIdenticalRequestsFromLegacyCassetteWithIndexedRecords (): void 
101+  {
102+  $ request1new  Request ('GET ' , 'https://example.com ' );
103+  $ response1new  Response ('200 ' , [], 'response1 ' );
104+ 
105+  $ request2new  Request ('GET ' , 'https://example.com ' );
106+  $ response2new  Response ('200 ' , [], 'response2 ' );
107+ 
108+  // These are legacy recordings with no index keys. 
109+  $ recordings
110+  [
111+  'request '  => $ request1toArray (),
112+  'response '  => $ response1toArray (),
113+  ],
114+  [
115+  'request '  => $ request2toArray (),
116+  'response '  => $ response2toArray (),
117+  'index '  => 1 ,
118+  ],
119+  ];
120+ 
121+  $ cassette$ this createCassetteWithRecordings ($ recordings
122+ 
123+  $ this assertEquals ($ response1toArray (), $ cassetteplayback ($ request10 )->toArray ());
124+  $ this assertEquals ($ response2toArray (), $ cassetteplayback ($ request21 )->toArray ());
125+  }
126+ 
127+  /** 
128+  * Ensure that if a second identical request is played back from a cassette 
98129 * with indexed recordings, the response corresponding to the recording 
99130 * index will be returned. 
100131 */ 
101132 public  function  testPlaybackOfIdenticalRequests (): void 
102133 {
103134 $ request1new  Request ('GET ' , 'https://example.com ' );
104-  $ response1new  Response (200 , [], 'response1 ' );
135+  $ response1new  Response (' 200 ' 'response1 ' );
105136
106137 $ request2new  Request ('GET ' , 'https://example.com ' );
107-  $ response2new  Response (200 , [], 'response2 ' );
138+  $ response2new  Response (' 200 ' 'response2 ' );
108139
109140 // These are recordings with index keys which support playback of 
110141 // multiple identical requests. 
0 commit comments