File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -572,6 +572,19 @@ public function assertContent($value)
572
572
return $ this ;
573
573
}
574
574
575
+ /**
576
+ * Assert that the given string matches the streamed response content.
577
+ *
578
+ * @param $value
579
+ * @return $this
580
+ */
581
+ public function assertStreamedContent ($ value )
582
+ {
583
+ PHPUnit::assertSame ($ value , $ this ->streamedContent ());
584
+
585
+ return $ this ;
586
+ }
587
+
575
588
/**
576
589
* Assert that the given string or array of strings are contained within the response.
577
590
*
Original file line number Diff line number Diff line change @@ -234,6 +234,29 @@ public function testAssertContent()
234
234
}
235
235
}
236
236
237
+ public function testAssertStreamedContent ()
238
+ {
239
+ $ response = TestResponse::fromBaseResponse (
240
+ (new StreamedResponse )->setContent ('expected response data ' )
241
+ );
242
+
243
+ $ this ->assertStreamedContent ('expected response data ' );
244
+
245
+ try {
246
+ $ response ->assertStreamedContent ('expected ' );
247
+ $ this ->fail ('xxxx ' );
248
+ } catch (AssertionFailedError $ e ) {
249
+ $ this ->assertSame ('Failed asserting that two strings are identical. ' , $ e ->getMessage ());
250
+ }
251
+
252
+ try {
253
+ $ response ->assertStreamedContent ('expected response data with extra ' );
254
+ $ this ->fail ('xxxx ' );
255
+ } catch (AssertionFailedError $ e ) {
256
+ $ this ->assertSame ('Failed asserting that two strings are identical. ' , $ e ->getMessage ());
257
+ }
258
+ }
259
+
237
260
public function testAssertSee ()
238
261
{
239
262
$ response = $ this ->makeMockResponse ([
You can’t perform that action at this time.
0 commit comments