title: How to test Laravel resource
body: <p>I am testing an API endpoint returned Laravel resource with pagination </p>
  
  <pre><code> public function test_showing_all_plans(): void
   {
      $plans = Plan::where('is_active', true)
          -&gt;paginate(10);
  
      $resource = PlansResource::collection($plans);
  
      $this-&gt;withHeaders([
          'Accept' =&gt; 'application/json',
          'Content-Type' =&gt; 'application/json',
          'AppKey' =&gt; 5,
      ])
          -&gt;json('GET', '/api/customer/plans')
          -&gt;assertStatus(200)
          -&gt;assertExactJson([
              $resource-&gt;response()-&gt;getData(true),
          ]);
  }
  </code></pre>
  
  <p>so my problem is the returned result is not the same because of the path of the endpoint is not equal to the returned of the resource. </p>
  
  <p>This is the result returned from the endpoint:</p>
  
  <pre><code>"links": {
          "first": "http://www.site.local/api/customer/plans?page=1",
          "last": "http://www.site.local/api/customer/plans?page=3",
          "next": "http://www.site.local/api/customer/plans?page=2",
          "prev": null
      },
      "meta": {
          "current_page": 1,
          "from": 1,
          "last_page": 3,
          "path": "http://www.site.local/api/customer/plans",
          "per_page": 10,
          "to": 10,
          "total": 24
      }
  </code></pre>
  
  <p>This is the code returned from the resource ' <code>$resource-&gt;response()-&gt;getData(true)</code> '</p>
  
  <pre><code> "links": {
              "first": "http://www.site.local?page=1",
              "last": "http://www.site.local?page=3",
              "next": "http://www.site.local?page=2",
              "prev": null
          },
          "meta": {
              "current_page": 1,
              "from": 1,
              "last_page": 3,
              "path": "http://www.site.local",
              "per_page": 10,
              "to": 10,
            }
  </code></pre>
  
  <p>so how can I pass the endpoint to my code or how can I make them equal, and is there is a proper way to test Laravel resource? </p>