Official tutorials
and knowledge base

Using Paragraph in tests

A more advanced way of integrating with Paragraph is using it in your automated tests. This has a number of major benefits.

Getting started

To get started, first add our special trait to your test class:

use Paragraph\WithParagraph;

class HomeControllerTest extends TestCase
    use WithParagraph;

Now, because we added this trait, all web requests in this test file will be automatically connected to Paragraph:

public function test_can_visit_home_page()
    $response = $this->name('Home Page')->get(route('home'));