File tree 2 files changed +30
-0
lines changed
src/Illuminate/Foundation/Testing
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -405,6 +405,21 @@ public function json()
405
405
return $ this ->decodeResponseJson ();
406
406
}
407
407
408
+ /**
409
+ * Assert that the response view equals the given value.
410
+ *
411
+ * @param string $value
412
+ * @return $this
413
+ */
414
+ public function assertViewIs ($ value )
415
+ {
416
+ $ this ->ensureResponseHasView ();
417
+
418
+ PHPUnit::assertEquals ($ value , $ this ->original ->getName ());
419
+
420
+ return $ this ;
421
+ }
422
+
408
423
/**
409
424
* Assert that the response view has a given piece of bound data.
410
425
*
Original file line number Diff line number Diff line change 12
12
13
13
class FoundationTestResponseTest extends TestCase
14
14
{
15
+ public function testAssertViewIs ()
16
+ {
17
+ $ baseResponse = tap (new Response , function ($ response ) {
18
+ $ response ->setContent (\Mockery::mock (View::class, [
19
+ 'render ' => 'hello world ' ,
20
+ 'getData ' => ['foo ' => 'bar ' ],
21
+ 'getName ' => 'dir.my-view ' ,
22
+ ]));
23
+ });
24
+
25
+ $ response = TestResponse::fromBaseResponse ($ baseResponse );
26
+
27
+ $ response ->assertViewIs ('dir.my-view ' );
28
+ }
29
+
15
30
public function testAssertViewHas ()
16
31
{
17
32
$ baseResponse = tap (new Response , function ($ response ) {
You can’t perform that action at this time.
0 commit comments