@@ -72,10 +72,13 @@ public function testThatSymfonyResponseIsReflected(): void
7272 $ sfResponse ->expects (self ::once ())->method ('getContent ' )->willReturn ('Test ' );
7373
7474 $ response = $ this ->createMock (Response::class);
75- $ response -> expects ( self :: exactly ( 3 ))-> method ( ' header ' )-> withConsecutive (
75+ $ expectedHeaders = [
7676 ['x-test ' , 'Swoole-Runtime ' ],
7777 ['set-cookie ' , $ fooCookie ],
78- ['set-cookie ' , $ barCookie ]
78+ ['set-cookie ' , $ barCookie ],
79+ ];
80+ $ response ->expects (self ::exactly (3 ))->method ('header ' )->willReturnCallback (
81+ fn ($ key , $ value ) => $ this ->assertEquals ([$ key , $ value ], array_shift ($ expectedHeaders ))
7982 );
8083 $ response ->expects (self ::once ())->method ('status ' )->with (201 );
8184 $ response ->expects (self ::once ())->method ('end ' )->with ('Test ' );
@@ -94,7 +97,14 @@ public function testThatSymfonyStreamedResponseIsReflected(): void
9497 });
9598
9699 $ response = $ this ->createMock (Response::class);
97- $ response ->expects (self ::exactly (3 ))->method ('write ' )->withConsecutive (["Foo \n" ], ["Bar \n" ], ['' ]);
100+ $ expectedWrites = [
101+ "Foo \n" ,
102+ "Bar \n" ,
103+ ''
104+ ];
105+ $ response ->expects (self ::exactly (3 ))->method ('write ' )->willReturnCallback (
106+ fn ($ string ) => $ this ->assertSame (array_shift ($ expectedWrites ), $ string )
107+ );
98108 $ response ->expects (self ::once ())->method ('end ' );
99109
100110 SymfonyHttpBridge::reflectSymfonyResponse ($ sfResponse , $ response );
0 commit comments